changeset 21892:9fe51d8fae0f

Merge with 878786299d2d72bf0bdbd4002ccffcd1fad69b7a
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 09 Jun 2015 19:07:39 -0700
parents ccaf9eb1f5eb (current diff) 878786299d2d (diff)
children db885c930362
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/CompilerThread.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/CompilerThreadFactory.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/DebugFilter.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/MethodFilter.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java graal/com.oracle.jvmci.amd64/src/com/oracle/jvmci/amd64/AMD64.java graal/com.oracle.jvmci.code/overview.html graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/AbstractAddress.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/Architecture.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ArithmeticOperation.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BailoutException.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BytecodeFrame.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BytecodePosition.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CalleeSaveLayout.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CallingConvention.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeCacheProvider.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeUtil.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CompilationResult.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/DataSection.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/DebugInfo.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ForeignCallLinkage.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ForeignCallsProvider.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InfopointReason.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InstalledCode.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InvalidInstalledCodeException.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/MemoryBarriers.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ReferenceMap.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/Register.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterAttributes.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterConfig.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterSaveLayout.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterValue.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/SourceStackTrace.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackLockValue.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackSlot.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackSlotValue.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/TargetDescription.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/TypeCheckHints.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/UnsignedMath.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ValueUtil.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/VirtualObject.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/VirtualStackSlot.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/package-info.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/InspectedFrame.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/InspectedFrameVisitor.java graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/StackIntrospection.java graal/com.oracle.jvmci.common/src/com/oracle/jvmci/common/JVMCIError.java graal/com.oracle.jvmci.common/src/com/oracle/jvmci/common/UnsafeAccess.java graal/com.oracle.jvmci.debug.test/src/com/oracle/jvmci/debug/test/DebugHistogramTest.java graal/com.oracle.jvmci.debug.test/src/com/oracle/jvmci/debug/test/DebugTimerTest.java graal/com.oracle.jvmci.debug/overview.html graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/AnsiColor.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Debug.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugCloseable.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugConfig.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugConfigScope.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugDumpHandler.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugDumpScope.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugHistogram.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugInitializationPropertyProvider.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugMemUseTracker.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugMetric.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugTimer.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugVerifyHandler.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DelegatingDebugConfig.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Fingerprint.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Indent.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/LogStream.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TTY.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TopLevelDebugConfig.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/AccumulatedDebugValue.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/CloseableCounterImpl.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramAsciiPrinter.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramImpl.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramRPrinter.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugScope.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugValue.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugValueMap.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/KeyRegistry.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/MemUseTrackerImpl.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/MetricImpl.java graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/TimerImpl.java graal/com.oracle.jvmci.hotspot.amd64/src/com/oracle/jvmci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java graal/com.oracle.jvmci.hotspot.amd64/src/com/oracle/jvmci/hotspot/amd64/AMD64HotSpotRegisterConfig.java graal/com.oracle.jvmci.hotspot.jfr/src/com/oracle/jvmci/hotspot/jfr/events/JFREventProvider.java graal/com.oracle.jvmci.hotspot.sparc/src/com/oracle/jvmci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java graal/com.oracle.jvmci.hotspot.sparc/src/com/oracle/jvmci/hotspot/sparc/SPARCHotSpotRegisterConfig.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVM.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVMImpl.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCodeCacheProvider.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledCode.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledNmethod.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompressedNullConstant.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstant.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantPool.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantReflectionProvider.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotForeignCallTarget.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotInstalledCode.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIBackendFactory.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJavaType.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMemoryAccessProvider.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMemoryAccessProviderImpl.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaAccessProvider.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaspaceConstant.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaspaceConstantImpl.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethod.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodData.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodDataAccessor.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodHandleAccessProvider.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodUnresolved.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotNmethod.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotObjectConstant.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotObjectConstantImpl.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotOptions.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotProfilingInfo.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotProxified.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotReferenceMap.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaField.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaFieldImpl.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethod.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaType.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedObjectType.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedPrimitiveType.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSignature.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSpeculationLog.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotStackFrameReference.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotTargetDescription.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotUnresolvedField.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotUnresolvedJavaType.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMConfig.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMConfigVerifier.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMEventListener.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVmSymbols.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/InitTimer.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/PrintStreamOption.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/Stable.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/events/EmptyEventProvider.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/events/EventProvider.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/CountingProxy.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/Logger.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/LoggingProxy.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/ProxyUtil.java graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/package-info.java graal/com.oracle.jvmci.hotspotvmconfig.processor/src/META-INF/services/javax.annotation.processing.Processor graal/com.oracle.jvmci.hotspotvmconfig.processor/src/com/oracle/jvmci/hotspotvmconfig/processor/HotSpotVMConfigProcessor.java graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMConstant.java graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMField.java graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMFlag.java graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMType.java graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMValue.java graal/com.oracle.jvmci.meta/overview.html graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractJavaProfile.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractProfiledItem.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractValue.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AllocatableValue.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Assumptions.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Constant.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantPool.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantReflectionProvider.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DefaultProfilingInfo.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DeoptimizationAction.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DeoptimizationReason.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ExceptionHandler.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ForeignCallDescriptor.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/InvokeTarget.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaConstant.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaField.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaMethod.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaMethodProfile.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaType.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaTypeProfile.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaValue.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Kind.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/KindProvider.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LIRKind.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LineNumberTable.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LineNumberTableImpl.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Local.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalImpl.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalVariableTable.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalVariableTableImpl.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocationIdentity.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MemoryAccessProvider.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MetaAccessProvider.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MetaUtil.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodHandleAccessProvider.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodIdHolder.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodIdMap.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ModifiersProvider.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/NamedLocationIdentity.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/NullConstant.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/PlatformKind.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/PrimitiveConstant.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ProfilingInfo.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/RawConstant.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaField.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaMethod.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaType.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/SerializableConstant.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Signature.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/SpeculationLog.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/TriState.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/TrustedInterface.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/VMConstant.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Value.java graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/package-info.java graal/com.oracle.jvmci.options.processor/src/META-INF/services/javax.annotation.processing.Processor graal/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/GraalJars.java graal/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/OptionProcessor.java graal/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/OptionsVerifier.java graal/com.oracle.jvmci.options.test/src/com/oracle/jvmci/options/test/NestedBooleanOptionValueTest.java graal/com.oracle.jvmci.options.test/src/com/oracle/jvmci/options/test/TestOptionValue.java graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/DerivedOptionValue.java graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/NestedBooleanOptionValue.java graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/Option.java graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionDescriptor.java graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionType.java graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionUtils.java graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionValue.java graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/Options.java graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionsLoader.java graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/StableOptionValue.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/ConstantTest.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/FieldUniverse.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/MethodUniverse.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/NameAndSignature.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/ResolvedJavaTypeResolveMethodTest.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestConstantReflectionProvider.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestJavaField.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestJavaMethod.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestJavaType.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestMetaAccessProvider.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestResolvedJavaField.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestResolvedJavaMethod.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestResolvedJavaType.java graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TypeUniverse.java graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCI.java graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCIBackend.java graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCIRuntime.java graal/com.oracle.jvmci.service.processor/src/META-INF/services/javax.annotation.processing.Processor graal/com.oracle.jvmci.service.processor/src/com/oracle/jvmci/service/processor/ServiceProviderProcessor.java graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/JVMCIClassLoaderFactory.java graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Service.java graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/ServiceProvider.java graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java graal/com.oracle.jvmci.sparc/src/com/oracle/jvmci/sparc/SPARC.java graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/ForeignAccessFactory.java graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/InteropPredicate.java graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/exception/UnsupportedMessageException.java graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/exception/UnsupportedTypeException.java graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/messages/Message.java graal/com.oracle.truffle.interop/src/META-INF/services/com.oracle.truffle.api.impl.SymbolInvoker graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/ForeignAccessArguments.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/SymbolInvokerImpl.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Argument.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Execute.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/GetSize.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/HasSize.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/IsBoxed.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/IsExecutable.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/IsNull.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/MessageUtil.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Read.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Receiver.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/UnaryMessage.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Unbox.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Write.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/node/ForeignObjectAccessHeadNode.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/node/ForeignObjectAccessNode.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/node/ObjectAccessNode.java graal/findbugs-SuppressFBWarnings.jar make/windows/projectfiles/graal/Makefile make/windows/projectfiles/graal/vm.def make/windows/projectfiles/graal/vm.dsw mx/mx_graal.py mx/suite.py
diffstat 759 files changed, 44795 insertions(+), 43479 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Jun 09 18:48:06 2015 -0700
+++ b/.hgtags	Tue Jun 09 19:07:39 2015 -0700
@@ -547,6 +547,8 @@
 28b50d07f6f8c5a567b6a25e95a423948114a004 jdk8u25-b17
 639abc668bfe995dba811dd35411b9ea8a9041cd jdk8u25-b18
 c3528699fb33fe3eb1d117504184ae7ab2507aa1 jdk8u25-b31
+631f0c7b49c091c6865d79d248d6551a270ac22f jdk8u25-b32
+4e1f52384f9ffa803838acad545cd63de48a7b35 jdk8u25-b33
 5bb683bbe2c74876d585b5c3232fc3aab7b23e97 jdk8u31-b00
 5bb686ae3b89f8aa1c74331b2d24e2a5ebd43448 jdk8u31-b01
 087678da96603c9705b38b6cc4a6569ac7b4420a jdk8u31-b02
@@ -561,6 +563,8 @@
 9906d432d6dbd2cda242e3f3cfde7cf6c90245bf jdk8u31-b11
 e13839545238d1ecf17f0489bb6fb765de46719a jdk8u31-b12
 4206e725d584be942c25ff46ff23d8e299ca4a4c jdk8u31-b13
+b517d3a9aebf0fee64808f9a7c0ef8e0b82d5ed3 jdk8u31-b31
+15d8108258cb60a58bdd03b9ff8e77dd6727a804 jdk8u31-b32
 1b3abbeee961dee49780c0e4af5337feb918c555 jdk8u40-b10
 f10fe402dfb1543723b4b117a7cba3ea3d4159f1 hs25.40-b15
 99372b2fee0eb8b3452f47230e84aa6e97003184 jdk8u40-b11
@@ -587,12 +591,20 @@
 0ee548a1cda08c884eccd563e2d5fdb6ee769b5a jdk8u40-b22
 0e67683b700174eab71ea205d1cfa4f1cf4523ba jdk8u40-b23
 fa4e797f61e6dda1a60e06944018213bff2a1b76 jdk8u40-b24
-b124e22eb772806c13d942cc110de38da0108147 graal-0.1
-483d05bf77a7c2a762aca1e06c4191bc06647176 graal-0.2
-9535eccd2a115f6c6f0b15efb508b11ff74cc0d3 graal-0.3
-7d4f630172a16e983212d46c0f1ad6cdb826dfce graal-0.4
-ae5b662550836e851c39e4fbb5c80517fc62488f graal-0.5
-3b60f720b955c466d913abb0113af9b38962950b graal-0.6
-1b0ef9634252c422b6f9839fc62eebc112545486 gpu-0.1
-9a12234da10cfa6934617274c203672389a1bbdd baseline-0.1
-754f2b20d8bc43053d254826e6b9f09db3f3c992 graal-0.7
+698dd28ecc785ffc43e3f12266b13e85382c26a8 jdk8u40-b25
+f39b6944ad447269b81e06ca5da9edff9e9e67c8 jdk8u40-b26
+6824e2475e0432e27f9cc51838bc34ea5fbf5113 jdk8u40-b27
+b95f13f05f553309cd74d6ccf8fcedb259c6716c jdk8u45-b00
+41c3c456e326185053f0654be838f4b0bfb38078 jdk8u45-b01
+626fd8c2eec63e2a2dff3839bfe12c0431bf00a4 jdk8u45-b02
+f41aa01b0a043611ee0abcb81a40f7d80085ec27 jdk8u45-b03
+2f586e3c4b6db807ac6036b485b2890ff82f7bfd jdk8u45-b04
+344ff6e45a1e2960ac4a583f63ebfb54cd52e6b4 jdk8u45-b05
+3afa9cc6e8d537ee456b8e12d1abb1da520b5ddc jdk8u45-b06
+5871f3dd9b4a2c4b44e7da2184f4430323e0c04b jdk8u45-b07
+35c7330b68e21d0dfaaedaaf74b794fd10606e9c jdk8u45-b08
+35d8318de0b6d4e68e2e0a04f6e20cafd113ca54 jdk8u45-b09
+a9f5786079202b74b3651e1097c0b2341b2178b9 jdk8u45-b10
+f4822d12204179e6a3e7aaf98991b6171670cbf2 jdk8u45-b11
+dc29108bcbcbfcd49eaa9135368306dc85db73a6 jdk8u45-b12
+efbf340fc7f56e49735111c23cef030413146409 jdk8u45-b13
--- a/THIRD_PARTY_README	Tue Jun 09 18:48:06 2015 -0700
+++ b/THIRD_PARTY_README	Tue Jun 09 19:07:39 2015 -0700
@@ -1250,7 +1250,7 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to libpng 1.5.4, which may be 
+%% This notice is provided with respect to libpng 1.6.16, which may be
 included with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
@@ -1266,8 +1266,8 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
-Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
 
@@ -1364,7 +1364,7 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-July 7, 2011
+December 22, 2014
 
 --- end of LICENSE ---
 
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Address.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Address.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -113,6 +113,21 @@
                     return null;
             }
         }
+
+        public static Scale fromShift(int shift) {
+            switch (shift) {
+                case 0:
+                    return Times1;
+                case 1:
+                    return Times2;
+                case 2:
+                    return Times4;
+                case 3:
+                    return Times8;
+                default:
+                    return null;
+            }
+        }
     }
 
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64AddressLowering.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,153 @@
+/*
+ * 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.compiler.amd64;
+
+import com.oracle.graal.asm.*;
+import com.oracle.graal.asm.amd64.AMD64Address.Scale;
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.calc.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.graal.phases.common.AddressLoweringPhase.AddressLowering;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+
+public class AMD64AddressLowering extends AddressLowering {
+
+    private final CodeCacheProvider codeCache;
+
+    public AMD64AddressLowering(CodeCacheProvider codeCache) {
+        this.codeCache = codeCache;
+    }
+
+    @Override
+    public AddressNode lower(ValueNode address) {
+        return lower(address, null);
+    }
+
+    @Override
+    public AddressNode lower(ValueNode base, ValueNode offset) {
+        AMD64AddressNode ret = new AMD64AddressNode(base, offset);
+        boolean changed;
+        do {
+            changed = improve(ret);
+        } while (changed);
+        return base.graph().unique(ret);
+    }
+
+    protected boolean improve(AMD64AddressNode ret) {
+        ValueNode newBase = improveInput(ret, ret.getBase(), 0);
+        if (newBase != ret.getBase()) {
+            ret.setBase(newBase);
+            return true;
+        }
+
+        ValueNode newIdx = improveInput(ret, ret.getIndex(), ret.getScale().log2);
+        if (newIdx != ret.getIndex()) {
+            ret.setIndex(newIdx);
+            return true;
+        }
+
+        if (ret.getIndex() instanceof LeftShiftNode) {
+            LeftShiftNode shift = (LeftShiftNode) ret.getIndex();
+            if (shift.getY().isConstant()) {
+                int amount = ret.getScale().log2 + shift.getY().asJavaConstant().asInt();
+                Scale scale = Scale.fromShift(amount);
+                if (scale != null) {
+                    ret.setIndex(shift.getX());
+                    ret.setScale(scale);
+                    return true;
+                }
+            }
+        }
+
+        if (ret.getScale() == Scale.Times1) {
+            if (ret.getBase() == null || ret.getIndex() == null) {
+                if (ret.getBase() instanceof AddNode) {
+                    AddNode add = (AddNode) ret.getBase();
+                    ret.setBase(add.getX());
+                    ret.setIndex(add.getY());
+                    return true;
+                } else if (ret.getIndex() instanceof AddNode) {
+                    AddNode add = (AddNode) ret.getIndex();
+                    ret.setBase(add.getX());
+                    ret.setIndex(add.getY());
+                    return true;
+                }
+            }
+
+            if (ret.getBase() instanceof LeftShiftNode && !(ret.getIndex() instanceof LeftShiftNode)) {
+                ValueNode tmp = ret.getBase();
+                ret.setBase(ret.getIndex());
+                ret.setIndex(tmp);
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private ValueNode improveInput(AMD64AddressNode address, ValueNode node, int shift) {
+        if (node == null) {
+            return null;
+        }
+
+        if (node.isConstant()) {
+            return improveConstDisp(address, node, node.asJavaConstant(), null, shift);
+        } else {
+            if (node.stamp() instanceof IntegerStamp && ((IntegerStamp) node.stamp()).getBits() == 64) {
+                if (node instanceof ZeroExtendNode) {
+                    if (((ZeroExtendNode) node).getInputBits() == 32) {
+                        /*
+                         * We can just swallow a zero-extend from 32 bit to 64 bit because the upper
+                         * half of the register will always be zero.
+                         */
+                        return ((ZeroExtendNode) node).getValue();
+                    }
+                } else if (node instanceof AddNode) {
+                    AddNode add = (AddNode) node;
+                    if (add.getX().isConstant()) {
+                        return improveConstDisp(address, node, add.getX().asJavaConstant(), add.getY(), shift);
+                    } else if (add.getY().isConstant()) {
+                        return improveConstDisp(address, node, add.getY().asJavaConstant(), add.getX(), shift);
+                    }
+                }
+            }
+        }
+
+        return node;
+    }
+
+    private ValueNode improveConstDisp(AMD64AddressNode address, ValueNode original, JavaConstant c, ValueNode other, int shift) {
+        if (c.getKind().isNumericInteger() && !codeCache.needsDataPatch(c)) {
+            long disp = address.getDisplacement();
+            disp += c.asLong() << shift;
+            if (NumUtil.isInt(disp)) {
+                address.setDisplacement((int) disp);
+                return other;
+            }
+        }
+        return original;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64AddressNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,111 @@
+/*
+ * 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.compiler.amd64;
+
+import com.oracle.graal.asm.amd64.AMD64Address.Scale;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.lir.amd64.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Represents an address of the form [base + index*scale + displacement]. Both base and index are
+ * optional.
+ */
+@NodeInfo
+public class AMD64AddressNode extends AddressNode implements LIRLowerable {
+
+    public static final NodeClass<AMD64AddressNode> TYPE = NodeClass.create(AMD64AddressNode.class);
+
+    @OptionalInput private ValueNode base;
+
+    @OptionalInput private ValueNode index;
+    private Scale scale;
+
+    private int displacement;
+
+    public AMD64AddressNode(ValueNode base) {
+        this(base, null);
+    }
+
+    public AMD64AddressNode(ValueNode base, ValueNode index) {
+        super(TYPE);
+        this.base = base;
+        this.index = index;
+        this.scale = Scale.Times1;
+    }
+
+    public void generate(NodeLIRBuilderTool gen) {
+        AMD64LIRGenerator tool = (AMD64LIRGenerator) gen.getLIRGeneratorTool();
+
+        AllocatableValue baseValue = base == null ? Value.ILLEGAL : tool.asAllocatable(gen.operand(base));
+        AllocatableValue indexValue = index == null ? Value.ILLEGAL : tool.asAllocatable(gen.operand(index));
+
+        LIRKind kind = tool.getLIRKind(stamp());
+        gen.setResult(this, new AMD64AddressValue(kind, baseValue, indexValue, scale, displacement));
+    }
+
+    public ValueNode getBase() {
+        return base;
+    }
+
+    public void setBase(ValueNode base) {
+        // allow modification before inserting into the graph
+        if (isAlive()) {
+            updateUsages(this.base, base);
+        }
+        this.base = base;
+    }
+
+    public ValueNode getIndex() {
+        return index;
+    }
+
+    public void setIndex(ValueNode index) {
+        // allow modification before inserting into the graph
+        if (isAlive()) {
+            updateUsages(this.index, index);
+        }
+        this.index = index;
+    }
+
+    public Scale getScale() {
+        return scale;
+    }
+
+    public void setScale(Scale scale) {
+        this.scale = scale;
+    }
+
+    public int getDisplacement() {
+        return displacement;
+    }
+
+    public void setDisplacement(int displacement) {
+        this.displacement = displacement;
+    }
+}
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Tue Jun 09 19:07:39 2015 -0700
@@ -23,24 +23,6 @@
 
 package com.oracle.graal.compiler.amd64;
 
-import com.oracle.jvmci.amd64.*;
-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.*;
@@ -48,12 +30,21 @@
 import static com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize.*;
 import static com.oracle.graal.lir.amd64.AMD64Arithmetic.*;
 import static com.oracle.graal.lir.amd64.AMD64MathIntrinsicOp.IntrinsicOpcode.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
 import com.oracle.graal.asm.*;
-import com.oracle.graal.asm.amd64.AMD64Address.*;
-import com.oracle.graal.asm.amd64.AMD64Assembler.*;
+import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic;
+import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MIOp;
+import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MOp;
+import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MROp;
+import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMIOp;
+import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMOp;
+import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64Shift;
+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.calc.*;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.compiler.common.util.*;
@@ -79,7 +70,10 @@
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.phases.util.*;
+import com.oracle.jvmci.amd64.*;
+import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This class implements the AMD64 specific portion of the LIR generator.
@@ -214,74 +208,17 @@
         append(new LeaDataOp(dst, data));
     }
 
-    @Override
-    public AMD64AddressValue emitAddress(Value base, long displacement, Value index, int scale) {
-        AllocatableValue baseRegister;
-        long finalDisp = displacement;
-        if (isConstant(base)) {
-            if (asConstant(base).isNull()) {
-                baseRegister = Value.ILLEGAL;
-            } else if (asConstant(base).getKind() != Kind.Object && !getCodeCache().needsDataPatch(asConstant(base))) {
-                finalDisp += asConstant(base).asLong();
-                baseRegister = Value.ILLEGAL;
-            } else {
-                baseRegister = load(base);
-            }
-        } else {
-            baseRegister = asAllocatable(base);
-        }
-
-        AllocatableValue indexRegister;
-        Scale scaleEnum;
-        if (!index.equals(Value.ILLEGAL) && scale != 0) {
-            scaleEnum = Scale.fromInt(scale);
-            if (isConstant(index)) {
-                finalDisp += asConstant(index).asLong() * scale;
-                indexRegister = Value.ILLEGAL;
-
-            } else if (scaleEnum == null) {
-                /* Scale value that architecture cannot handle, so scale manually. */
-                Value longIndex = index.getKind() == Kind.Long ? index : emitSignExtend(index, 32, 64);
-                if (CodeUtil.isPowerOf2(scale)) {
-                    indexRegister = emitShl(longIndex, JavaConstant.forLong(CodeUtil.log2(scale)));
-                } else {
-                    indexRegister = emitMul(longIndex, JavaConstant.forLong(scale), false);
-                }
-                scaleEnum = Scale.Times1;
-
-            } else {
-                indexRegister = asAllocatable(index);
-            }
-        } else {
-            indexRegister = Value.ILLEGAL;
-            scaleEnum = Scale.Times1;
-        }
-
-        int displacementInt;
-        if (NumUtil.isInt(finalDisp)) {
-            displacementInt = (int) finalDisp;
-        } else {
-            displacementInt = 0;
-            AllocatableValue displacementRegister = load(JavaConstant.forLong(finalDisp));
-            if (baseRegister.equals(Value.ILLEGAL)) {
-                baseRegister = displacementRegister;
-            } else if (indexRegister.equals(Value.ILLEGAL)) {
-                indexRegister = displacementRegister;
-                scaleEnum = Scale.Times1;
-            } else {
-                baseRegister = emitAdd(baseRegister, displacementRegister, false);
-            }
-        }
-
-        LIRKind resultKind = getAddressKind(base, displacement, index);
-        return new AMD64AddressValue(resultKind, baseRegister, indexRegister, scaleEnum, displacementInt);
-    }
-
     public AMD64AddressValue asAddressValue(Value address) {
         if (address instanceof AMD64AddressValue) {
             return (AMD64AddressValue) address;
         } else {
-            return emitAddress(address, 0, Value.ILLEGAL, 0);
+            if (address instanceof JavaConstant) {
+                long displacement = ((JavaConstant) address).asLong();
+                if (NumUtil.isInt(displacement)) {
+                    return new AMD64AddressValue(address.getLIRKind(), Value.ILLEGAL, (int) displacement);
+                }
+            }
+            return new AMD64AddressValue(address.getLIRKind(), asAllocatable(address), 0);
         }
     }
 
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java	Tue Jun 09 19:07:39 2015 -0700
@@ -140,10 +140,6 @@
         }
     }
 
-    protected AMD64AddressValue makeAddress(Access access) {
-        return (AMD64AddressValue) access.accessLocation().generateAddress(this, gen, operand(access.object()));
-    }
-
     protected ValueNode uncast(ValueNode value) {
         if (value instanceof UnsafeCastNode) {
             UnsafeCastNode cast = (UnsafeCastNode) value;
@@ -197,7 +193,8 @@
                     other = operand(value);
                 }
 
-                getLIRGeneratorTool().emitCompareBranchMemory(kind, other, makeAddress(access), getState(access), finalCondition, unorderedIsTrue, trueLabel, falseLabel, trueLabelProbability);
+                AMD64AddressValue address = (AMD64AddressValue) operand(access.getAddress());
+                getLIRGeneratorTool().emitCompareBranchMemory(kind, other, address, getState(access), finalCondition, unorderedIsTrue, trueLabel, falseLabel, trueLabelProbability);
                 return null;
             }
         };
@@ -219,13 +216,15 @@
                 return null;
             }
             return builder -> {
-                gen.append(new AMD64BinaryConsumer.MemoryConstOp(AMD64MIOp.TEST, size, makeAddress(access), (int) constant.asLong(), getState(access)));
+                AMD64AddressValue address = (AMD64AddressValue) operand(access.getAddress());
+                gen.append(new AMD64BinaryConsumer.MemoryConstOp(AMD64MIOp.TEST, size, address, (int) constant.asLong(), getState(access)));
                 gen.append(new BranchOp(Condition.EQ, trueLabel, falseLabel, trueLabelProbability));
                 return null;
             };
         } else {
             return builder -> {
-                gen.append(new AMD64BinaryConsumer.MemoryRMOp(AMD64RMOp.TEST, size, gen.asAllocatable(operand(value)), makeAddress(access), getState(access)));
+                AMD64AddressValue address = (AMD64AddressValue) operand(access.getAddress());
+                gen.append(new AMD64BinaryConsumer.MemoryRMOp(AMD64RMOp.TEST, size, gen.asAllocatable(operand(value)), address, getState(access)));
                 gen.append(new BranchOp(Condition.EQ, trueLabel, falseLabel, trueLabelProbability));
                 return null;
             };
@@ -234,7 +233,7 @@
 
     protected ComplexMatchResult emitConvertMemoryOp(PlatformKind kind, AMD64RMOp op, OperandSize size, Access access) {
         return builder -> {
-            AMD64AddressValue address = makeAddress(access);
+            AMD64AddressValue address = (AMD64AddressValue) operand(access.getAddress());
             LIRFrameState state = getState(access);
             return getLIRGeneratorTool().emitConvertMemoryOp(kind, op, size, address, state);
         };
@@ -288,7 +287,7 @@
     }
 
     private Value emitReinterpretMemory(LIRKind to, Access access) {
-        AMD64AddressValue address = makeAddress(access);
+        AMD64AddressValue address = (AMD64AddressValue) operand(access.getAddress());
         LIRFrameState state = getState(access);
         return getLIRGeneratorTool().emitLoad(to, address, state);
     }
@@ -338,7 +337,7 @@
     }
 
     private ComplexMatchResult binaryRead(AMD64RMOp op, OperandSize size, ValueNode value, Access access) {
-        return builder -> getLIRGeneratorTool().emitBinaryMemory(op, size, getLIRGeneratorTool().asAllocatable(operand(value)), makeAddress(access), getState(access));
+        return builder -> getLIRGeneratorTool().emitBinaryMemory(op, size, getLIRGeneratorTool().asAllocatable(operand(value)), (AMD64AddressValue) operand(access.getAddress()), getState(access));
     }
 
     @MatchRule("(Add value Read=access)")
@@ -407,13 +406,11 @@
         }
     }
 
-    @MatchRule("(Write object location Narrow=narrow)")
+    @MatchRule("(Write object Narrow=narrow)")
     public ComplexMatchResult writeNarrow(WriteNode root, NarrowNode narrow) {
         return builder -> {
             LIRKind writeKind = getLIRGeneratorTool().getLIRKind(root.value().stamp());
-            Value address = root.location().generateAddress(builder, getLIRGeneratorTool(), operand(root.object()));
-            Value v = operand(narrow.getValue());
-            getLIRGeneratorTool().emitStore(writeKind, address, v, state(root));
+            getLIRGeneratorTool().emitStore(writeKind, operand(root.getAddress()), operand(narrow.getValue()), state(root));
             return null;
         };
     }
@@ -436,7 +433,8 @@
              */
             return null;
         }
-        return builder -> getLIRGeneratorTool().emitZeroExtendMemory(memoryKind == Kind.Short ? Kind.Char : memoryKind, root.getResultBits(), makeAddress(access), getState(access));
+        return builder -> getLIRGeneratorTool().emitZeroExtendMemory(memoryKind == Kind.Short ? Kind.Char : memoryKind, root.getResultBits(), (AMD64AddressValue) operand(access.getAddress()),
+                        getState(access));
     }
 
     @MatchRule("(FloatConvert Read=access)")
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Tue Jun 09 19:07:39 2015 -0700
@@ -128,9 +128,6 @@
     @Option(help = "", type = OptionType.Debug)
     public static final OptionValue<Boolean> VerifyPhases = new OptionValue<>(false);
 
-    @Option(help = "", type = OptionType.Debug)
-    public static final OptionValue<String> PrintFilter = new OptionValue<>(null);
-
     // Debug settings:
     @Option(help = "", type = OptionType.Debug)
     public static final OptionValue<Boolean> BootstrapReplacements = new OptionValue<>(false);
@@ -173,33 +170,16 @@
     public static final OptionValue<Boolean> PrintIdealGraphSchedule = new OptionValue<>(false);
 
     // Other printing settings
-    @Option(help = "", type = OptionType.Debug)
-    public static final OptionValue<Boolean> PrintCompilation = new OptionValue<>(false);
-
-    @Option(help = "", type = OptionType.Debug)
-    public static final OptionValue<Boolean> PrintAfterCompilation = new OptionValue<>(false);
-
     @Option(help = "Print profiling information when parsing a method's bytecode", type = OptionType.Debug)
     public static final OptionValue<Boolean> PrintProfilingInformation = new OptionValue<>(false);
 
     @Option(help = "", type = OptionType.Debug)
     public static final OptionValue<Boolean> PrintCodeBytes = new OptionValue<>(false);
 
-    @Option(help = "", type = OptionType.Debug)
-    public static final OptionValue<Boolean> PrintBailout = new OptionValue<>(false);
 
     @Option(help = "", type = OptionType.Debug)
     public static final StableOptionValue<Boolean> TraceEscapeAnalysis = new StableOptionValue<>(false);
 
-    @Option(help = "", type = OptionType.Debug)
-    public static final OptionValue<Boolean> ExitVMOnBailout = new OptionValue<>(false);
-
-    @Option(help = "", type = OptionType.Debug)
-    public static final OptionValue<Boolean> ExitVMOnException = new OptionValue<>(true);
-
-    @Option(help = "", type = OptionType.Debug)
-    public static final OptionValue<Boolean> PrintStackTraceOnException = new OptionValue<>(false);
-
     // HotSpot command line options
     @Option(help = "Print inlining optimizations", type = OptionType.Debug)
     public static final OptionValue<Boolean> HotSpotPrintInlining = new OptionValue<>(false);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/RawPointerStamp.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,108 @@
+/*
+ * 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.compiler.common.type;
+
+import com.oracle.graal.compiler.common.spi.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Type describing pointers to raw memory. This stamp is used for example for direct pointers to
+ * fields or array elements.
+ */
+public class RawPointerStamp extends AbstractPointerStamp {
+
+    protected RawPointerStamp() {
+        super(false, false);
+    }
+
+    @Override
+    public LIRKind getLIRKind(LIRKindTool tool) {
+        return tool.getWordKind();
+    }
+
+    @Override
+    protected AbstractPointerStamp copyWith(boolean newNonNull, boolean newAlwaysNull) {
+        // RawPointerStamp is a singleton
+        assert newNonNull == nonNull() && newAlwaysNull == alwaysNull();
+        return this;
+    }
+
+    @Override
+    public Stamp meet(Stamp other) {
+        assert isCompatible(other);
+        return this;
+    }
+
+    @Override
+    public Stamp improveWith(Stamp other) {
+        return this;
+    }
+
+    @Override
+    public Stamp join(Stamp other) {
+        assert isCompatible(other);
+        return this;
+    }
+
+    @Override
+    public Stamp unrestricted() {
+        return this;
+    }
+
+    @Override
+    public Stamp empty() {
+        // there is no empty pointer stamp
+        return this;
+    }
+
+    @Override
+    public boolean hasValues() {
+        return true;
+    }
+
+    @Override
+    public ResolvedJavaType javaType(MetaAccessProvider metaAccess) {
+        throw JVMCIError.shouldNotReachHere("pointer has no Java type");
+    }
+
+    @Override
+    public Stamp constant(Constant c, MetaAccessProvider meta) {
+        return this;
+    }
+
+    @Override
+    public boolean isCompatible(Stamp other) {
+        return other instanceof RawPointerStamp;
+    }
+
+    @Override
+    public Constant readConstant(MemoryAccessProvider provider, Constant base, long displacement) {
+        throw JVMCIError.shouldNotReachHere("can't read raw pointer");
+    }
+
+    @Override
+    public String toString() {
+        return "void*";
+    }
+}
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java	Tue Jun 09 19:07:39 2015 -0700
@@ -45,6 +45,7 @@
     private static final Stamp positiveInt = forInteger(Kind.Int, 0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE);
     private static final Stamp booleanTrue = forInteger(Kind.Boolean, -1, -1, 1, 1);
     private static final Stamp booleanFalse = forInteger(Kind.Boolean, 0, 0, 0, 0);
+    private static final Stamp rawPointer = new RawPointerStamp();
 
     private static void setCache(Kind kind, Stamp stamp) {
         stampCache[kind.ordinal()] = stamp;
@@ -350,4 +351,8 @@
 
         return result;
     }
+
+    public static Stamp pointer() {
+        return rawPointer;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCAddressLowering.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,93 @@
+/*
+ * 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.compiler.sparc;
+
+import com.oracle.graal.asm.sparc.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.calc.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.graal.phases.common.AddressLoweringPhase.AddressLowering;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+
+public class SPARCAddressLowering extends AddressLowering {
+
+    private final CodeCacheProvider codeCache;
+
+    public SPARCAddressLowering(CodeCacheProvider codeCache) {
+        this.codeCache = codeCache;
+    }
+
+    @Override
+    public AddressNode lower(ValueNode address) {
+        return lower(address, 0);
+    }
+
+    @Override
+    public AddressNode lower(ValueNode base, ValueNode offset) {
+        JavaConstant immBase = asImmediate(base);
+        if (immBase != null && SPARCAssembler.isSimm13(immBase)) {
+            return lower(offset, immBase.asLong());
+        }
+
+        JavaConstant immOffset = asImmediate(offset);
+        if (immOffset != null && SPARCAssembler.isSimm13(immOffset)) {
+            return lower(base, immOffset.asLong());
+        }
+
+        return base.graph().unique(new SPARCIndexedAddressNode(base, offset));
+    }
+
+    private AddressNode lower(ValueNode base, long displacement) {
+        if (base instanceof AddNode) {
+            AddNode add = (AddNode) base;
+
+            JavaConstant immX = asImmediate(add.getX());
+            if (immX != null && SPARCAssembler.isSimm13(displacement + immX.asLong())) {
+                return lower(add.getY(), displacement + immX.asLong());
+            }
+
+            JavaConstant immY = asImmediate(add.getY());
+            if (immY != null && SPARCAssembler.isSimm13(displacement + immY.asLong())) {
+                return lower(add.getX(), displacement + immY.asLong());
+            }
+
+            if (displacement == 0) {
+                return lower(add.getX(), add.getY());
+            }
+        }
+
+        assert SPARCAssembler.isSimm13(displacement);
+        return base.graph().unique(new SPARCImmediateAddressNode(base, (int) displacement));
+    }
+
+    private JavaConstant asImmediate(ValueNode value) {
+        JavaConstant c = value.asJavaConstant();
+        if (c != null && c.getKind().isNumericInteger() && !codeCache.needsDataPatch(c)) {
+            return c;
+        } else {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCImmediateAddressNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,78 @@
+/*
+ * 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.compiler.sparc;
+
+import com.oracle.graal.asm.sparc.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.lir.sparc.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Represents an address of the form [base + simm13].
+ */
+@NodeInfo
+public class SPARCImmediateAddressNode extends AddressNode implements LIRLowerable {
+
+    public static final NodeClass<SPARCImmediateAddressNode> TYPE = NodeClass.create(SPARCImmediateAddressNode.class);
+
+    @Input private ValueNode base;
+    private int displacement;
+
+    public SPARCImmediateAddressNode(ValueNode base, int displacement) {
+        super(TYPE);
+        assert SPARCAssembler.isSimm13(displacement);
+        this.base = base;
+        this.displacement = displacement;
+    }
+
+    public void generate(NodeLIRBuilderTool gen) {
+        SPARCLIRGenerator tool = (SPARCLIRGenerator) gen.getLIRGeneratorTool();
+
+        AllocatableValue baseValue = tool.asAllocatable(gen.operand(base));
+
+        LIRKind kind = tool.getLIRKind(stamp());
+        gen.setResult(this, new SPARCImmediateAddressValue(kind, baseValue, displacement));
+    }
+
+    public ValueNode getBase() {
+        return base;
+    }
+
+    public void setBase(ValueNode base) {
+        updateUsages(this.base, base);
+        this.base = base;
+    }
+
+    public int getDisplacement() {
+        return displacement;
+    }
+
+    public void setDisplacement(int displacement) {
+        this.displacement = displacement;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCIndexedAddressNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,78 @@
+/*
+ * 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.compiler.sparc;
+
+import com.oracle.graal.graph.*;
+import com.oracle.graal.lir.sparc.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Represents an address of the form [base + index].
+ */
+@NodeInfo
+public class SPARCIndexedAddressNode extends AddressNode implements LIRLowerable {
+
+    public static final NodeClass<SPARCIndexedAddressNode> TYPE = NodeClass.create(SPARCIndexedAddressNode.class);
+
+    @Input private ValueNode base;
+    @Input private ValueNode index;
+
+    public SPARCIndexedAddressNode(ValueNode base, ValueNode index) {
+        super(TYPE);
+        this.base = base;
+        this.index = index;
+    }
+
+    public void generate(NodeLIRBuilderTool gen) {
+        SPARCLIRGenerator tool = (SPARCLIRGenerator) gen.getLIRGeneratorTool();
+
+        AllocatableValue baseValue = tool.asAllocatable(gen.operand(base));
+        AllocatableValue indexValue = tool.asAllocatable(gen.operand(index));
+
+        LIRKind kind = tool.getLIRKind(stamp());
+        gen.setResult(this, new SPARCIndexedAddressValue(kind, baseValue, indexValue));
+    }
+
+    public ValueNode getBase() {
+        return base;
+    }
+
+    public void setBase(ValueNode base) {
+        updateUsages(this.base, base);
+        this.base = base;
+    }
+
+    public ValueNode getIndex() {
+        return index;
+    }
+
+    public void setIndex(ValueNode index) {
+        updateUsages(this.index, index);
+        this.index = index;
+    }
+}
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, 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
@@ -140,74 +140,18 @@
         append(new LoadDataAddressOp(dst, data));
     }
 
-    @Override
-    public SPARCAddressValue emitAddress(Value base, long displacement, Value index, int scale) {
-        AllocatableValue baseRegister;
-        long finalDisp = displacement;
-        if (isConstant(base)) {
-            if (asConstant(base).isNull()) {
-                baseRegister = SPARC.g0.asValue(base.getLIRKind());
-            } else if (asConstant(base).getKind() != Kind.Object) {
-                finalDisp += asConstant(base).asLong();
-                baseRegister = Value.ILLEGAL;
-            } else {
-                baseRegister = load(base);
-            }
-        } else {
-            baseRegister = asAllocatable(base);
-        }
-
-        AllocatableValue indexRegister;
-        if (!index.equals(Value.ILLEGAL) && scale != 0) {
-            if (isConstant(index)) {
-                finalDisp += asConstant(index).asLong() * scale;
-                indexRegister = Value.ILLEGAL;
-            } else {
-                Value longIndex = index.getKind() == Kind.Long ? index : emitSignExtend(index, 32, 64);
-                if (scale != 1) {
-                    if (CodeUtil.isPowerOf2(scale)) {
-                        indexRegister = emitShl(longIndex, JavaConstant.forLong(CodeUtil.log2(scale)));
-                    } else {
-                        indexRegister = emitMul(longIndex, JavaConstant.forLong(scale), false);
-                    }
-                } else {
-                    indexRegister = asAllocatable(longIndex);
-                }
-            }
-        } else {
-            indexRegister = Value.ILLEGAL;
-        }
-
-        int displacementInt;
-
-        // If we don't have an index register we can use a displacement, otherwise load the
-        // displacement into a register and add it to the base.
-        if (indexRegister.equals(Value.ILLEGAL) && SPARCAssembler.isSimm13(finalDisp)) {
-            displacementInt = (int) finalDisp;
-        } else {
-            displacementInt = 0;
-            if (baseRegister.equals(Value.ILLEGAL)) {
-                baseRegister = load(JavaConstant.forLong(finalDisp));
-            } else {
-                if (finalDisp == 0) {
-                    // Nothing to do. Just use the base register.
-                } else {
-                    Variable longBaseRegister = newVariable(LIRKind.derivedReference(Kind.Long));
-                    emitMove(longBaseRegister, baseRegister);
-                    baseRegister = emitAdd(longBaseRegister, JavaConstant.forLong(finalDisp), false);
-                }
-            }
-        }
-
-        LIRKind resultKind = getAddressKind(base, displacement, index);
-        return new SPARCAddressValue(resultKind, baseRegister, indexRegister, displacementInt);
-    }
-
     protected SPARCAddressValue asAddressValue(Value address) {
         if (address instanceof SPARCAddressValue) {
             return (SPARCAddressValue) address;
         } else {
-            return emitAddress(address, 0, Value.ILLEGAL, 0);
+            LIRKind kind = address.getLIRKind();
+            if (address instanceof JavaConstant) {
+                long displacement = ((JavaConstant) address).asLong();
+                if (SPARCAssembler.isSimm13(displacement)) {
+                    return new SPARCImmediateAddressValue(kind, SPARC.g0.asValue(kind), (int) displacement);
+                }
+            }
+            return new SPARCImmediateAddressValue(kind, asAllocatable(address), 0);
         }
     }
 
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCNodeLIRBuilder.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCNodeLIRBuilder.java	Tue Jun 09 19:07:39 2015 -0700
@@ -108,8 +108,7 @@
         Kind localFromKind = fromKind;
         Kind localToKind = toKind;
         return builder -> {
-            Value address = access.accessLocation().generateAddress(builder, gen, operand(access.object()));
-            Value v = getLIRGeneratorTool().emitSignExtendLoad(LIRKind.value(localFromKind), address, getState(access));
+            Value v = getLIRGeneratorTool().emitSignExtendLoad(LIRKind.value(localFromKind), operand(access.getAddress()), getState(access));
             return getLIRGeneratorTool().emitReinterpret(LIRKind.value(localToKind), v);
         };
     }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java	Tue Jun 09 19:07:39 2015 -0700
@@ -33,8 +33,6 @@
 import org.junit.*;
 
 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.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
@@ -48,11 +46,12 @@
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.phases.verify.*;
-import com.oracle.graal.printer.*;
 import com.oracle.graal.runtime.*;
 import com.oracle.graal.test.*;
 import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.code.Register.RegisterCategory;
+import com.oracle.jvmci.compiler.*;
+import com.oracle.jvmci.compiler.CompilerThreadFactory.DebugConfigAccess;
 import com.oracle.jvmci.debug.*;
 import com.oracle.jvmci.meta.*;
 
@@ -125,7 +124,7 @@
         String[] filters = property == null ? null : property.split(",");
 
         CompilerThreadFactory factory = new CompilerThreadFactory("CheckInvariantsThread", new DebugConfigAccess() {
-            public GraalDebugConfig getDebugConfig() {
+            public JVMCIDebugConfig getDebugConfig() {
                 return DebugEnvironment.initialize(System.out);
             }
         });
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest10.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,67 @@
+/*
+ * 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.compiler.test;
+
+import org.junit.*;
+
+import com.oracle.graal.api.directives.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.StructuredGraph.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.phases.common.*;
+import com.oracle.graal.phases.tiers.*;
+
+/**
+ * This test checks the combined action of
+ * {@link com.oracle.graal.phases.common.DominatorConditionalEliminationPhase} and
+ * {@link com.oracle.graal.phases.common.LoweringPhase}. The lowering phase needs to introduce the
+ * null checks at the correct places for the dominator conditional elimination phase to pick them
+ * up.
+ */
+public class ConditionalEliminationTest10 extends ConditionalEliminationTestBase {
+
+    private static class TestClass {
+        int x;
+    }
+
+    @SuppressWarnings("all")
+    public static int testSnippet(int a, TestClass t) {
+        int result = 0;
+        if (a == 0) {
+            GraalDirectives.controlFlowAnchor();
+            result = t.x;
+        }
+        GraalDirectives.controlFlowAnchor();
+        return result + t.x;
+    }
+
+    @Test
+    public void test1() {
+        StructuredGraph graph = parseEager("testSnippet", AllowAssumptions.YES);
+        PhaseContext context = new PhaseContext(getProviders());
+        new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
+        Assert.assertEquals(2, graph.getNodes().filter(GuardNode.class).count());
+        new DominatorConditionalEliminationPhase(true).apply(graph, context);
+        Assert.assertEquals(1, graph.getNodes().filter(GuardNode.class).count());
+    }
+}
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -23,9 +23,9 @@
 package com.oracle.graal.compiler.test;
 
 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 static com.oracle.jvmci.compiler.Compiler.*;
 
 import java.lang.reflect.*;
 import java.util.*;
@@ -33,7 +33,7 @@
 import java.util.function.*;
 
 import org.junit.*;
-import org.junit.internal.*;
+import org.junit.internal.AssumptionViolatedException;
 
 import com.oracle.graal.api.directives.*;
 import com.oracle.graal.api.replacements.*;
@@ -59,7 +59,6 @@
 import com.oracle.graal.phases.schedule.SchedulePhase.SchedulingStrategy;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
-import com.oracle.graal.printer.*;
 import com.oracle.graal.runtime.*;
 import com.oracle.graal.test.*;
 import com.oracle.jvmci.code.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ImplicitNullCheckTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,76 @@
+/*
+ * 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.compiler.test;
+
+import org.junit.*;
+
+import com.oracle.graal.api.directives.*;
+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.*;
+import com.oracle.graal.phases.common.*;
+import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+
+/**
+ * Tests that the hub access and the null check are folded.
+ */
+public class ImplicitNullCheckTest extends GraphScheduleTest {
+
+    public static final class Receiver {
+
+        public int a;
+    }
+
+    public static int test1Snippet(Object o) {
+        if (GraalDirectives.guardingNonNull(o) instanceof Receiver) {
+            return 42;
+        }
+        return 0;
+    }
+
+    @Test
+    public void test1() {
+        test("test1Snippet");
+    }
+
+    private void test(final String snippet) {
+        try (Scope s = Debug.scope("FloatingReadTest", new DebugDumpScope(snippet))) {
+            StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
+            PhaseContext context = new PhaseContext(getProviders());
+            new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
+            new FloatingReadPhase().apply(graph);
+            MidTierContext midTierContext = new MidTierContext(getProviders(), getCodeCache().getTarget(), OptimisticOptimizations.ALL, graph.method().getProfilingInfo(), null);
+            new GuardLoweringPhase().apply(graph, midTierContext);
+
+            Assert.assertEquals(0, graph.getNodes(DeoptimizeNode.TYPE).count());
+            Assert.assertTrue(graph.getNodes().filter(ReadNode.class).first().canNullCheck());
+
+        } catch (Throwable e) {
+            throw Debug.handle(e);
+        }
+    }
+}
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -63,7 +63,7 @@
         StructuredGraph graph = getGraph("testSynchronizedSnippet");
         new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
         new LockEliminationPhase().apply(graph);
-        assertDeepEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count());
+        assertDeepEquals(1, graph.getNodes().filter(RawMonitorEnterNode.class).count());
         assertDeepEquals(1, graph.getNodes().filter(MonitorExitNode.class).count());
     }
 
@@ -81,7 +81,7 @@
         StructuredGraph graph = getGraph("testSynchronizedMethodSnippet");
         new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
         new LockEliminationPhase().apply(graph);
-        assertDeepEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count());
+        assertDeepEquals(1, graph.getNodes().filter(RawMonitorEnterNode.class).count());
         assertDeepEquals(1, graph.getNodes().filter(MonitorExitNode.class).count());
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/OptionsVerifierTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,252 @@
+/*
+ * 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.compiler.test;
+
+import static java.lang.String.*;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.nio.file.*;
+import java.util.*;
+import java.util.zip.*;
+
+import jdk.internal.org.objectweb.asm.*;
+import jdk.internal.org.objectweb.asm.Type;
+
+import org.junit.*;
+
+import com.oracle.jvmci.options.*;
+
+/**
+ * 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 being set.
+ */
+public class OptionsVerifierTest {
+
+    @Test
+    public void verifyOptions() throws IOException {
+        try (Classpath cp = new Classpath()) {
+            HashSet<Class<?>> checked = new HashSet<>();
+            for (Options opts : ServiceLoader.load(Options.class, getClass().getClassLoader())) {
+                for (OptionDescriptor desc : opts) {
+                    OptionsVerifier.checkClass(desc.getDeclaringClass(), desc, checked, cp);
+                }
+            }
+        }
+    }
+
+    static class Classpath implements AutoCloseable {
+        private final Map<String, Object> entries = new LinkedHashMap<>();
+
+        public Classpath() throws ZipException, IOException {
+            String[] names = (System.getProperty("sun.boot.class.path") + File.pathSeparatorChar + System.getProperty("java.class.path")).split(File.pathSeparator);
+            for (String n : names) {
+                File path = new File(n);
+                if (path.exists()) {
+                    if (path.isDirectory()) {
+                        entries.put(n, path);
+                    } else if (n.endsWith(".jar") || n.endsWith(".zip")) {
+                        entries.put(n, new ZipFile(path));
+                    }
+                }
+            }
+        }
+
+        public void close() throws IOException {
+            for (Object e : entries.values()) {
+                if (e instanceof ZipFile) {
+                    ((ZipFile) e).close();
+                }
+            }
+        }
+
+        public byte[] getInputStream(String classFilePath) throws IOException {
+            for (Object e : entries.values()) {
+                if (e instanceof File) {
+                    File path = new File((File) e, classFilePath.replace('/', File.separatorChar));
+                    if (path.exists()) {
+                        return Files.readAllBytes(path.toPath());
+                    }
+                } else if (e instanceof ZipFile) {
+                    ZipFile zf = (ZipFile) e;
+                    ZipEntry ze = zf.getEntry(classFilePath);
+                    if (ze != null) {
+                        byte[] res = new byte[(int) ze.getSize()];
+                        DataInputStream dis = new DataInputStream(zf.getInputStream(ze));
+                        dis.readFully(res);
+                        dis.close();
+                        return res;
+                    }
+                }
+            }
+            return null;
+        }
+    }
+
+    static final class OptionsVerifier extends ClassVisitor {
+
+        public static void checkClass(Class<?> cls, OptionDescriptor option, Set<Class<?>> checked, Classpath cp) throws IOException {
+            if (!checked.contains(cls)) {
+                checked.add(cls);
+                Class<?> superclass = cls.getSuperclass();
+                if (superclass != null && !superclass.equals(Object.class)) {
+                    checkClass(superclass, option, checked, cp);
+                }
+
+                String classFilePath = cls.getName().replace('.', '/') + ".class";
+                ClassReader cr = new ClassReader(Objects.requireNonNull(cp.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.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,22 +22,20 @@
  */
 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.compiler.common.type.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 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;
+import com.oracle.jvmci.meta.*;
 
 public class PushNodesThroughPiTest extends GraalCompilerTest {
 
@@ -72,17 +70,17 @@
         try (Scope s = Debug.scope("PushThroughPi", new DebugDumpScope(snippet))) {
             StructuredGraph graph = compileTestSnippet(snippet);
             for (ReadNode rn : graph.getNodes().filter(ReadNode.class)) {
-                if (rn.location() instanceof ConstantLocationNode && rn.object().stamp() instanceof ObjectStamp) {
-                    long disp = ((ConstantLocationNode) rn.location()).getDisplacement();
-                    ResolvedJavaType receiverType = StampTool.typeOrNull(rn.object());
-                    ResolvedJavaField field = receiverType.findInstanceFieldWithOffset(disp, rn.getKind());
+                OffsetAddressNode address = (OffsetAddressNode) rn.getAddress();
+                long disp = address.getOffset().asJavaConstant().asLong();
+
+                ResolvedJavaType receiverType = StampTool.typeOrNull(address.getBase());
+                ResolvedJavaField field = receiverType.findInstanceFieldWithOffset(disp, rn.getKind());
 
-                    assert field != null : "Node " + rn + " tries to access a field which doesn't exists for this type";
-                    if (field.getName().equals("x")) {
-                        Assert.assertTrue(rn.object() instanceof ParameterNode);
-                    } else {
-                        Assert.assertTrue(rn.object().toString(), rn.object() instanceof PiNode);
-                    }
+                assert field != null : "Node " + rn + " tries to access a field which doesn't exists for this type";
+                if (field.getName().equals("x")) {
+                    Assert.assertTrue(address.getBase() instanceof ParameterNode);
+                } else {
+                    Assert.assertTrue(address.getBase().toString(), address.getBase() instanceof PiNode);
                 }
             }
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -94,7 +94,7 @@
             for (FloatingReadNode node : graph.getNodes(ParameterNode.TYPE).first().usages().filter(FloatingReadNode.class)) {
                 // Checking that the parameter a is not directly used for the access to field
                 // x10 (because x10 must be guarded by the checkcast).
-                Assert.assertTrue(node.location().getLocationIdentity().isImmutable());
+                Assert.assertTrue(node.getLocationIdentity().isImmutable());
             }
         } catch (Throwable e) {
             throw Debug.handle(e);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/CompilerThread.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +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.compiler;
-
-import com.oracle.graal.compiler.CompilerThreadFactory.DebugConfigAccess;
-import com.oracle.jvmci.debug.*;
-
-/**
- * A compiler thread is a daemon thread that runs at {@link Thread#MAX_PRIORITY} and executes in the
- * context of a thread-local {@linkplain GraalDebugConfig debug configuration}.
- */
-public class CompilerThread extends Thread {
-
-    private final DebugConfigAccess debugConfigAccess;
-
-    public CompilerThread(Runnable r, String namePrefix, DebugConfigAccess debugConfigAccess) {
-        super(r);
-        this.setName(namePrefix + "-" + this.getId());
-        this.setPriority(Thread.MAX_PRIORITY);
-        this.setDaemon(true);
-        this.debugConfigAccess = debugConfigAccess;
-    }
-
-    @Override
-    public void run() {
-        GraalDebugConfig debugConfig = debugConfigAccess.getDebugConfig();
-        setContextClassLoader(getClass().getClassLoader());
-        try {
-            super.run();
-        } finally {
-            if (debugConfig != null) {
-                for (DebugDumpHandler dumpHandler : debugConfig.dumpHandlers()) {
-                    try {
-                        dumpHandler.close();
-                    } catch (Throwable t) {
-                    }
-                }
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/CompilerThreadFactory.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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.compiler;
-
-import java.util.concurrent.*;
-
-import com.oracle.jvmci.debug.*;
-
-/**
- * Facility for creating {@linkplain CompilerThread compiler threads}.
- */
-public class CompilerThreadFactory implements ThreadFactory {
-
-    /**
-     * Capability to get a thread-local debug configuration for the current thread.
-     */
-    public interface DebugConfigAccess {
-        /**
-         * Get a thread-local debug configuration for the current thread. This will be null if
-         * debugging is {@linkplain Debug#isEnabled() disabled}.
-         */
-        GraalDebugConfig getDebugConfig();
-    }
-
-    protected final String threadNamePrefix;
-    protected final DebugConfigAccess debugConfigAccess;
-
-    public CompilerThreadFactory(String threadNamePrefix, DebugConfigAccess debugConfigAccess) {
-        this.threadNamePrefix = threadNamePrefix;
-        this.debugConfigAccess = debugConfigAccess;
-    }
-
-    public Thread newThread(Runnable r) {
-        return new CompilerThread(r, threadNamePrefix, debugConfigAccess);
-    }
-}
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/DebugFilter.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +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.compiler;
-
-import java.util.*;
-import java.util.regex.*;
-
-import com.oracle.jvmci.debug.*;
-import com.oracle.jvmci.debug.internal.*;
-
-/**
- * Implements the filter specified by the {@link GraalDebugConfig#Dump},
- * {@link GraalDebugConfig#Log}, {@link GraalDebugConfig#Meter} and {@link GraalDebugConfig#Time}
- * options.
- * <p>
- * These options enable the associated debug facility if their filter matches the
- * {@linkplain DebugScope#getQualifiedName() name} of the {@linkplain Debug#currentScope() current
- * scope}. For the {@link GraalDebugConfig#Dump} and {@link GraalDebugConfig#Log} options, the log
- * or dump level is set. The {@link GraalDebugConfig#Meter} and {@link GraalDebugConfig#Time}
- * options don't have a level, for them {@code level = 0} means disabled and a {@code level > 0}
- * means enabled.
- * <p>
- * A filter is a list of comma-separated terms of the form {@code <pattern>[:<level>]}.
- * {@code <pattern>} is interpreted as a glob pattern if it contains a "*" or "?" character.
- * Otherwise, it is interpreted as a substring. If {@code <pattern>} is empty, it matches every
- * scope. If {@code :<level>} is omitted, it defaults to {@link Debug#DEFAULT_LOG_LEVEL}. The term
- * {@code ~<pattern>} is a shorthand for {@code <pattern>:0} to disable a debug facility for a
- * pattern.
- * <p>
- * The resulting log level of a scope is determined by the <em>last</em> matching term. If no term
- * matches, the log level is 0 (disabled). A filter with no terms matches every scope with a log
- * level of {@link Debug#DEFAULT_LOG_LEVEL}.
- *
- * <h2>Examples of filters</h2>
- *
- * <ul>
- * <li>(empty string)<br>
- * Matches any scope with log level {@link Debug#DEFAULT_LOG_LEVEL}.
- *
- * <li> {@code :1}<br>
- * Matches any scope with log level 1.
- *
- * <li> {@code *}<br>
- * Matches any scope with log level {@link Debug#DEFAULT_LOG_LEVEL}.
- *
- * <li> {@code CodeGen,CodeInstall}<br>
- * Matches scopes containing "CodeGen" or "CodeInstall", both with log level
- * {@link Debug#DEFAULT_LOG_LEVEL}.
- *
- * <li> {@code CodeGen:2,CodeInstall:1}<br>
- * Matches scopes containing "CodeGen" with log level 2, or "CodeInstall" with log level 1.
- *
- * <li> {@code :1,Dead:2}<br>
- * Matches scopes containing "Dead" with log level 2, and all other scopes with log level 1.
- *
- * <li> {@code :1,Dead:0}<br>
- * Matches all scopes with log level 1, except those containing "Dead".
- *
- * <li> {@code Code*}<br>
- * Matches scopes starting with "Code" with log level {@link Debug#DEFAULT_LOG_LEVEL}.
- *
- * <li> {@code Code,~Dead}<br>
- * Matches scopes containing "Code" but not "Dead", with log level {@link Debug#DEFAULT_LOG_LEVEL}.
- * </ul>
- */
-final class DebugFilter {
-
-    public static DebugFilter parse(String spec) {
-        if (spec == null) {
-            return null;
-        }
-        return new DebugFilter(spec.split(","));
-    }
-
-    private final Term[] terms;
-
-    private DebugFilter(String[] terms) {
-        if (terms.length == 0) {
-            this.terms = null;
-        } else {
-            this.terms = new Term[terms.length];
-            for (int i = 0; i < terms.length; i++) {
-                String t = terms[i];
-                int idx = t.indexOf(':');
-
-                String pattern;
-                int level;
-                if (idx < 0) {
-                    if (t.startsWith("~")) {
-                        pattern = t.substring(1);
-                        level = 0;
-                    } else {
-                        pattern = t;
-                        level = Debug.DEFAULT_LOG_LEVEL;
-                    }
-                } else {
-                    pattern = t.substring(0, idx);
-                    if (idx + 1 < t.length()) {
-                        level = Integer.parseInt(t.substring(idx + 1));
-                    } else {
-                        level = Debug.DEFAULT_LOG_LEVEL;
-                    }
-                }
-
-                this.terms[i] = new Term(pattern, level);
-            }
-        }
-    }
-
-    /**
-     * Check whether a given input is matched by this filter, and determine the log level.
-     */
-    public int matchLevel(String input) {
-        if (terms == null) {
-            return Debug.DEFAULT_LOG_LEVEL;
-        } else {
-            int level = 0;
-            for (Term t : terms) {
-                if (t.matches(input)) {
-                    level = t.level;
-                }
-            }
-            return level;
-        }
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder buf = new StringBuilder("DebugFilter");
-        if (terms != null) {
-            buf.append(Arrays.toString(terms));
-        } else {
-            buf.append("[]");
-        }
-        return buf.toString();
-    }
-
-    private static class Term {
-
-        private final Pattern pattern;
-        public final int level;
-
-        public Term(String filter, int level) {
-            this.level = level;
-            if (filter.isEmpty()) {
-                this.pattern = null;
-            } else if (filter.contains("*") || filter.contains("?")) {
-                this.pattern = Pattern.compile(MethodFilter.createGlobString(filter));
-            } else {
-                this.pattern = Pattern.compile(".*" + MethodFilter.createGlobString(filter) + ".*");
-            }
-        }
-
-        /**
-         * Determines if a given input is matched by this filter.
-         */
-        public boolean matches(String input) {
-            return pattern == null || pattern.matcher(input).matches();
-        }
-
-        @Override
-        public String toString() {
-            return (pattern == null ? ".*" : pattern.toString()) + ":" + level;
-        }
-    }
-}
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Tue Jun 09 19:07:39 2015 -0700
@@ -238,7 +238,8 @@
             LIRGenerationResult lirGen = null;
             lirGen = emitLIR(backend, target, schedule, graph, stub, cc, registerConfig, lirSuites);
             try (Scope s2 = Debug.scope("CodeGen", lirGen, lirGen.getLIR())) {
-                emitCode(backend, graph.getAssumptions(), graph.method(), graph.getInlinedMethods(), lirGen, compilationResult, installedCodeOwner, factory);
+                int bytecodeSize = graph.method() == null ? 0 : graph.getBytecodeSize();
+                emitCode(backend, graph.getAssumptions(), graph.method(), graph.getInlinedMethods(), bytecodeSize, lirGen, compilationResult, installedCodeOwner, factory);
             } catch (Throwable e) {
                 throw Debug.handle(e);
             }
@@ -327,7 +328,7 @@
         return lirGenRes;
     }
 
-    public static void emitCode(Backend backend, Assumptions assumptions, ResolvedJavaMethod rootMethod, Set<ResolvedJavaMethod> inlinedMethods, LIRGenerationResult lirGenRes,
+    public static void emitCode(Backend backend, Assumptions assumptions, ResolvedJavaMethod rootMethod, Set<ResolvedJavaMethod> inlinedMethods, int bytecodeSize, LIRGenerationResult lirGenRes,
                     CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner, CompilationResultBuilderFactory factory) {
         try (DebugCloseable a = EmitCode.start()) {
             FrameMap frameMap = lirGenRes.getFrameMap();
@@ -339,6 +340,7 @@
             }
             if (inlinedMethods != null) {
                 compilationResult.setMethods(rootMethod, inlinedMethods);
+                compilationResult.setBytecodeSize(bytecodeSize);
             }
 
             if (Debug.isMeterEnabled()) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,342 +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.compiler;
-
-import java.io.*;
-import java.util.*;
-
-import com.oracle.graal.graph.*;
-import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.alloc.lsra.*;
-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.debug.*;
-import com.oracle.jvmci.meta.*;
-import com.oracle.jvmci.options.*;
-
-public class GraalDebugConfig implements DebugConfig {
-
-    // @formatter:off
-    @Option(help = "Pattern for scope(s) in which dumping is enabled (see DebugFilter and Debug.dump)", type = OptionType.Debug)
-    public static final OptionValue<String> Dump = new OptionValue<>(null);
-    @Option(help = "Pattern for scope(s) in which metering is enabled (see DebugFilter and Debug.metric). " +
-                   "An empty value enables all metrics unconditionally.", type = OptionType.Debug)
-    public static final OptionValue<String> Meter = new OptionValue<>(null);
-    @Option(help = "Pattern for scope(s) in which verification is enabled (see DebugFilter and Debug.verify).", type = OptionType.Debug)
-    public static final OptionValue<String> Verify = new OptionValue<>(null);
-    @Option(help = "Pattern for scope(s) in which memory use tracking is enabled (see DebugFilter and Debug.metric). " +
-                   "An empty value enables all memory use trackers unconditionally.", type = OptionType.Debug)
-    public static final OptionValue<String> TrackMemUse = new OptionValue<>(null);
-    @Option(help = "Pattern for scope(s) in which timing is enabled (see DebugFilter and Debug.timer). " +
-                   "An empty value enables all timers unconditionally.", type = OptionType.Debug)
-    public static final OptionValue<String> Time = new OptionValue<>(null);
-    @Option(help = "Pattern for scope(s) in which logging is enabled (see DebugFilter and Debug.log)", type = OptionType.Debug)
-    public static final OptionValue<String> Log = new OptionValue<>(null);
-    @Option(help = "Pattern for filtering debug scope output based on method context (see MethodFilter)", type = OptionType.Debug)
-    public static final OptionValue<String> MethodFilter = new OptionValue<>(null);
-    @Option(help = "Only check MethodFilter against the root method in the context if true, otherwise check all methods", type = OptionType.Debug)
-    public static final OptionValue<Boolean> MethodFilterRootOnly = new OptionValue<>(false);
-
-    @Option(help = "How to print metric and timing values:%n" +
-                   "Name - aggregate by unqualified name%n" +
-                   "Partial - aggregate by partially qualified name (e.g., A.B.C.D.Counter and X.Y.Z.D.Counter will be merged to D.Counter)%n" +
-                   "Complete - aggregate by qualified name%n" +
-                   "Thread - aggregate by qualified name and thread", type = OptionType.Debug)
-    public static final OptionValue<String> DebugValueSummary = new OptionValue<>("Name");
-    @Option(help = "Omit reporting 0-value metrics", type = OptionType.Debug)
-    public static final OptionValue<Boolean> SuppressZeroDebugValues = new OptionValue<>(true);
-    @Option(help = "Only report debug values for maps which match the regular expression.", type = OptionType.Debug)
-    public static final OptionValue<String> DebugValueThreadFilter = new OptionValue<>(null);
-    @Option(help = "Send Graal IR to dump handlers on error", type = OptionType.Debug)
-    public static final OptionValue<Boolean> DumpOnError = new OptionValue<>(false);
-    @Option(help = "Intercept also bailout exceptions", type = OptionType.Debug)
-    public static final OptionValue<Boolean> InterceptBailout = new OptionValue<>(false);
-    @Option(help = "Enable more verbose log output when available", type = OptionType.Debug)
-    public static final OptionValue<Boolean> LogVerbose = new OptionValue<>(false);
-    // @formatter:on
-
-    static boolean isNotEmpty(OptionValue<String> option) {
-        return option.getValue() != null && !option.getValue().isEmpty();
-    }
-
-    static boolean areDebugScopePatternsEnabled() {
-        return DumpOnError.getValue() || Dump.getValue() != null || Log.getValue() != null || areScopedMetricsOrTimersEnabled();
-    }
-
-    /**
-     * Determines if any of {@link #Meter}, {@link #Time} or {@link #TrackMemUse} has a non-null,
-     * non-empty value.
-     */
-    public static boolean areScopedMetricsOrTimersEnabled() {
-        return isNotEmpty(Meter) || isNotEmpty(Time) || isNotEmpty(TrackMemUse);
-    }
-
-    private final DebugFilter logFilter;
-    private final DebugFilter meterFilter;
-    private final DebugFilter trackMemUseFilter;
-    private final DebugFilter timerFilter;
-    private final DebugFilter dumpFilter;
-    private final DebugFilter verifyFilter;
-    private final MethodFilter[] methodFilter;
-    private final List<DebugDumpHandler> dumpHandlers;
-    private final List<DebugVerifyHandler> verifyHandlers;
-    private final PrintStream output;
-    private final Set<Object> extraFilters = new HashSet<>();
-
-    public GraalDebugConfig(String logFilter, String meterFilter, String trackMemUseFilter, String timerFilter, String dumpFilter, String verifyFilter, String methodFilter, PrintStream output,
-                    List<DebugDumpHandler> dumpHandlers, List<DebugVerifyHandler> verifyHandlers) {
-        this.logFilter = DebugFilter.parse(logFilter);
-        this.meterFilter = DebugFilter.parse(meterFilter);
-        this.trackMemUseFilter = DebugFilter.parse(trackMemUseFilter);
-        this.timerFilter = DebugFilter.parse(timerFilter);
-        this.dumpFilter = DebugFilter.parse(dumpFilter);
-        this.verifyFilter = DebugFilter.parse(verifyFilter);
-        if (methodFilter == null || methodFilter.isEmpty()) {
-            this.methodFilter = null;
-        } else {
-            this.methodFilter = com.oracle.graal.compiler.MethodFilter.parse(methodFilter);
-        }
-
-        // Report the filters that have been configured so the user can verify it's what they expect
-        if (logFilter != null || meterFilter != null || timerFilter != null || dumpFilter != null || methodFilter != null) {
-            // TTY.println(Thread.currentThread().getName() + ": " + toString());
-        }
-        this.dumpHandlers = dumpHandlers;
-        this.verifyHandlers = verifyHandlers;
-        this.output = output;
-    }
-
-    public int getLogLevel() {
-        return getLevel(logFilter);
-    }
-
-    public boolean isLogEnabledForMethod() {
-        return isEnabledForMethod(logFilter);
-    }
-
-    public boolean isMeterEnabled() {
-        return isEnabled(meterFilter);
-    }
-
-    public boolean isMemUseTrackingEnabled() {
-        return isEnabled(trackMemUseFilter);
-    }
-
-    public int getDumpLevel() {
-        return getLevel(dumpFilter);
-    }
-
-    public boolean isDumpEnabledForMethod() {
-        return isEnabledForMethod(dumpFilter);
-    }
-
-    public boolean isVerifyEnabled() {
-        return isEnabled(verifyFilter);
-    }
-
-    public boolean isVerifyEnabledForMethod() {
-        return isEnabledForMethod(verifyFilter);
-    }
-
-    public boolean isTimeEnabled() {
-        return isEnabled(timerFilter);
-    }
-
-    public PrintStream output() {
-        return output;
-    }
-
-    private boolean isEnabled(DebugFilter filter) {
-        return getLevel(filter) > 0;
-    }
-
-    private int getLevel(DebugFilter filter) {
-        int level;
-        if (filter == null) {
-            level = 0;
-        } else {
-            level = filter.matchLevel(Debug.currentScope());
-        }
-        if (level > 0 && !checkMethodFilter()) {
-            level = 0;
-        }
-        return level;
-    }
-
-    private boolean isEnabledForMethod(DebugFilter filter) {
-        return filter != null && checkMethodFilter();
-    }
-
-    /**
-     * Extracts a {@link JavaMethod} from an opaque debug context.
-     *
-     * @return the {@link JavaMethod} represented by {@code context} or null
-     */
-    public static JavaMethod asJavaMethod(Object context) {
-        if (context instanceof JavaMethod) {
-            return (JavaMethod) context;
-        }
-        if (context instanceof StructuredGraph) {
-            ResolvedJavaMethod method = ((StructuredGraph) context).method();
-            if (method != null) {
-                return method;
-            }
-        }
-        return null;
-    }
-
-    private boolean checkMethodFilter() {
-        if (methodFilter == null && extraFilters.isEmpty()) {
-            return true;
-        } else {
-            JavaMethod lastMethod = null;
-            for (Object o : Debug.context()) {
-                if (extraFilters.contains(o)) {
-                    return true;
-                } else if (methodFilter != null) {
-                    JavaMethod method = asJavaMethod(o);
-                    if (method != null) {
-                        if (!MethodFilterRootOnly.getValue()) {
-                            if (com.oracle.graal.compiler.MethodFilter.matches(methodFilter, method)) {
-                                return true;
-                            }
-                        } else {
-                            /*
-                             * The context values operate as a stack so if we want MethodFilter to
-                             * only apply to the root method we have to check only the last method
-                             * seen.
-                             */
-                            lastMethod = method;
-                        }
-                    }
-                }
-            }
-            if (lastMethod != null && com.oracle.graal.compiler.MethodFilter.matches(methodFilter, lastMethod)) {
-                return true;
-            }
-            return false;
-        }
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("Debug config:");
-        add(sb, "Log", logFilter);
-        add(sb, "Meter", meterFilter);
-        add(sb, "Time", timerFilter);
-        add(sb, "Dump", dumpFilter);
-        add(sb, "MethodFilter", methodFilter);
-        return sb.toString();
-    }
-
-    private static void add(StringBuilder sb, String name, Object filter) {
-        if (filter != null) {
-            sb.append(' ');
-            sb.append(name);
-            sb.append('=');
-            if (filter instanceof Object[]) {
-                sb.append(Arrays.toString((Object[]) filter));
-            } else {
-                sb.append(String.valueOf(filter));
-            }
-        }
-    }
-
-    @Override
-    public RuntimeException interceptException(Throwable e) {
-        if (e instanceof BailoutException && !InterceptBailout.getValue()) {
-            return null;
-        }
-        Debug.setConfig(Debug.fixedConfig(Debug.DEFAULT_LOG_LEVEL, Debug.DEFAULT_LOG_LEVEL, false, false, false, false, dumpHandlers, verifyHandlers, output));
-        Debug.log(String.format("Exception occurred in scope: %s", Debug.currentScope()));
-        boolean dumpedLIR = false;
-        Interval[] intervals = null;
-        for (Object o : Debug.context()) {
-            if (o instanceof Graph) {
-                Debug.log("Context obj %s", o);
-                if (DumpOnError.getValue()) {
-                    Debug.dump(o, "Exception graph: " + e);
-                } else {
-                    Debug.log("Use -G:+DumpOnError to enable dumping of graphs on this error");
-                }
-            } else if (o instanceof LIR) {
-                Debug.log("Context obj %s", o);
-                if (DumpOnError.getValue()) {
-                    Debug.dump(o, "Exception LIR: " + e);
-                    dumpedLIR = true;
-                    if (intervals != null) {
-                        Debug.dump(intervals, "Exception Intervals: " + e);
-                        intervals = null;
-                    }
-                } else {
-                    Debug.log("Use -G:+DumpOnError to enable dumping of graphs on this error");
-                }
-            } else if (o instanceof Interval[]) {
-                if (DumpOnError.getValue()) {
-                    if (dumpedLIR) {
-                        // Can only dump intervals if LIR has been dumped.
-                        Debug.dump(o, "Exception Intervals: " + e);
-                    } else {
-                        intervals = (Interval[]) o;
-                    }
-                } else {
-                    Debug.log("Use -G:+DumpOnError to enable dumping of intervals on this error");
-                }
-            } else if (o instanceof Node) {
-                String location = GraphUtil.approxSourceLocation((Node) o);
-                String node = ((Node) o).toString(Verbosity.Debugger);
-                if (location != null) {
-                    Debug.log("Context obj %s (approx. location: %s)", node, location);
-                } else {
-                    Debug.log("Context obj %s", node);
-                }
-            } else {
-                Debug.log("Context obj %s", o);
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public Collection<DebugDumpHandler> dumpHandlers() {
-        return dumpHandlers;
-    }
-
-    @Override
-    public Collection<DebugVerifyHandler> verifyHandlers() {
-        return verifyHandlers;
-    }
-
-    @Override
-    public void addToContext(Object o) {
-        extraFilters.add(o);
-    }
-
-    @Override
-    public void removeFromContext(Object o) {
-        extraFilters.remove(o);
-    }
-}
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationPropertyProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationPropertyProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -27,23 +27,23 @@
 
 /**
  * Sets system properties used in the initialization of {@link Debug} based on the values specified
- * for various {@link GraalDebugConfig} options.
+ * for various {@link JVMCIDebugConfig} options.
  */
 @ServiceProvider(DebugInitializationPropertyProvider.class)
 class GraalDebugInitializationPropertyProvider implements DebugInitializationPropertyProvider {
 
     @Override
     public void apply() {
-        if (GraalDebugConfig.areDebugScopePatternsEnabled()) {
+        if (JVMCIDebugConfig.areDebugScopePatternsEnabled()) {
             System.setProperty(Debug.Initialization.INITIALIZER_PROPERTY_NAME, "true");
         }
-        if ("".equals(GraalDebugConfig.Meter.getValue())) {
+        if ("".equals(JVMCIDebugConfig.Meter.getValue())) {
             System.setProperty(Debug.ENABLE_UNSCOPED_METRICS_PROPERTY_NAME, "true");
         }
-        if ("".equals(GraalDebugConfig.Time.getValue())) {
+        if ("".equals(JVMCIDebugConfig.Time.getValue())) {
             System.setProperty(Debug.ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME, "true");
         }
-        if ("".equals(GraalDebugConfig.TrackMemUse.getValue())) {
+        if ("".equals(JVMCIDebugConfig.TrackMemUse.getValue())) {
             System.setProperty(Debug.ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME, "true");
         }
     }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/MethodFilter.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +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.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.*;
-
-/**
- * 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:
- *
- * <pre>
- * SourcePatterns = SourcePattern ["," SourcePatterns] .
- * SourcePattern = [ Class "." ] method [ "(" [ Parameter { ";" Parameter } ] ")" ] .
- * Parameter = Class | "int" | "long" | "float" | "double" | "short" | "char" | "boolean" .
- * Class = { package "." } class .
- * </pre>
- *
- *
- * Glob pattern matching (*, ?) is allowed in all parts of the source pattern. Examples for valid
- * filters are:
- *
- * <ul>
- * <li>
- *
- * <pre>
- * visit(Argument;BlockScope)
- * </pre>
- *
- * Matches all methods named "visit", with the first parameter of type "Argument", and the second
- * parameter of type "BlockScope". The packages of the parameter types are irrelevant.</li>
- * <li>
- *
- * <pre>
- * arraycopy(Object;;;;)
- * </pre>
- *
- * Matches all methods named "arraycopy", with the first parameter of type "Object", and four more
- * parameters of any type. The packages of the parameter types are irrelevant.</li>
- * <li>
- *
- * <pre>
- * com.oracle.graal.compiler.graph.PostOrderNodeIterator.*
- * </pre>
- *
- * Matches all methods in the class "com.oracle.graal.compiler.graph.PostOrderNodeIterator".</li>
- * <li>
- *
- * <pre>
- * *
- * </pre>
- *
- * Matches all methods in all classes</li>
- * <li>
- *
- * <pre>
- * com.oracle.graal.compiler.graph.*.visit
- * </pre>
- *
- * Matches all methods named "visit" in classes in the package "com.oracle.graal.compiler.graph".
- * <li>
- *
- * <pre>
- * arraycopy,toString
- * </pre>
- *
- * Matches all methods named "arraycopy" or "toString", meaning that ',' acts as an <i>or</i>
- * operator.</li>
- * </ul>
- */
-public class MethodFilter {
-
-    private final Pattern clazz;
-    private final Pattern methodName;
-    private final Pattern[] signature;
-
-    /**
-     * Parses a string containing list of comma separated filter patterns into an array of
-     * {@link MethodFilter}s.
-     */
-    public static MethodFilter[] parse(String commaSeparatedPatterns) {
-        String[] filters = commaSeparatedPatterns.split(",");
-        MethodFilter[] methodFilters = new MethodFilter[filters.length];
-        for (int i = 0; i < filters.length; i++) {
-            methodFilters[i] = new MethodFilter(filters[i]);
-        }
-        return methodFilters;
-    }
-
-    /**
-     * Determines if a given method is matched by a given array of filters.
-     */
-    public static boolean matches(MethodFilter[] filters, JavaMethod method) {
-        for (MethodFilter filter : filters) {
-            if (filter.matches(method)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Determines if a given class name is matched by a given array of filters.
-     */
-    public static boolean matchesClassName(MethodFilter[] filters, String className) {
-        for (MethodFilter filter : filters) {
-            if (filter.matchesClassName(className)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public MethodFilter(String sourcePattern) {
-        String pattern = sourcePattern.trim();
-
-        // extract parameter part
-        int pos = pattern.indexOf('(');
-        if (pos != -1) {
-            if (pattern.charAt(pattern.length() - 1) != ')') {
-                throw new IllegalArgumentException("missing ')' at end of method filter pattern: " + pattern);
-            }
-            String[] signatureClasses = pattern.substring(pos + 1, pattern.length() - 1).split(";", -1);
-            signature = new Pattern[signatureClasses.length];
-            for (int i = 0; i < signatureClasses.length; i++) {
-                signature[i] = createClassGlobPattern(signatureClasses[i].trim());
-            }
-            pattern = pattern.substring(0, pos);
-        } else {
-            signature = null;
-        }
-
-        // If there is at least one "." then everything before the last "." is the class name.
-        // Otherwise, the pattern contains only the method name.
-        pos = pattern.lastIndexOf('.');
-        if (pos != -1) {
-            clazz = createClassGlobPattern(pattern.substring(0, pos));
-            methodName = Pattern.compile(createGlobString(pattern.substring(pos + 1)));
-        } else {
-            clazz = null;
-            methodName = Pattern.compile(createGlobString(pattern));
-        }
-    }
-
-    static String createGlobString(String pattern) {
-        return Pattern.quote(pattern).replace("?", "\\E.\\Q").replace("*", "\\E.*\\Q");
-    }
-
-    private static Pattern createClassGlobPattern(String pattern) {
-        if (pattern.length() == 0) {
-            return null;
-        } else if (pattern.contains(".")) {
-            return Pattern.compile(createGlobString(pattern));
-        } else {
-            return Pattern.compile("([^\\.\\$]*[\\.\\$])*" + createGlobString(pattern));
-        }
-    }
-
-    /**
-     * Determines if the class part of this filter matches a given class name.
-     */
-    public boolean matchesClassName(String className) {
-        return clazz == null || clazz.matcher(className).matches();
-    }
-
-    public boolean matches(JavaMethod o) {
-        // check method name first, since MetaUtil.toJavaName is expensive
-        if (methodName != null && !methodName.matcher(o.getName()).matches()) {
-            return false;
-        }
-        if (clazz != null && !clazz.matcher(o.getDeclaringClass().toJavaName()).matches()) {
-            return false;
-        }
-        if (signature != null) {
-            Signature sig = o.getSignature();
-            if (sig.getParameterCount(false) != signature.length) {
-                return false;
-            }
-            for (int i = 0; i < signature.length; i++) {
-                JavaType type = sig.getParameterType(i, null);
-                String javaName = type.toJavaName();
-                if (signature[i] != null && !signature[i].matcher(javaName).matches()) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder buf = new StringBuilder("MethodFilter[");
-        String sep = "";
-        if (clazz != null) {
-            buf.append(sep).append("clazz=").append(clazz);
-            sep = ", ";
-        }
-        if (methodName != null) {
-            buf.append(sep).append("methodName=").append(methodName);
-            sep = ", ";
-        }
-        if (signature != null) {
-            buf.append(sep).append("signature=").append(Arrays.toString(signature));
-            sep = ", ";
-        }
-        return buf.append("]").toString();
-    }
-}
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java	Tue Jun 09 19:07:39 2015 -0700
@@ -31,8 +31,9 @@
 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.jvmci.debug.JVMCIDebugConfig.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.lir.LIR.*;
 
@@ -67,16 +68,16 @@
  */
 @MatchableNode(nodeClass = ConstantNode.class, shareable = true)
 @MatchableNode(nodeClass = FloatConvertNode.class, inputs = {"value"})
-@MatchableNode(nodeClass = FloatingReadNode.class, inputs = {"object", "location"})
+@MatchableNode(nodeClass = FloatingReadNode.class, inputs = {"address"})
 @MatchableNode(nodeClass = IfNode.class, inputs = {"condition"})
 @MatchableNode(nodeClass = SubNode.class, inputs = {"x", "y"})
 @MatchableNode(nodeClass = LeftShiftNode.class, inputs = {"x", "y"})
 @MatchableNode(nodeClass = NarrowNode.class, inputs = {"value"})
-@MatchableNode(nodeClass = ReadNode.class, inputs = {"object", "location"})
+@MatchableNode(nodeClass = ReadNode.class, inputs = {"address"})
 @MatchableNode(nodeClass = ReinterpretNode.class, inputs = {"value"})
 @MatchableNode(nodeClass = SignExtendNode.class, inputs = {"value"})
 @MatchableNode(nodeClass = UnsignedRightShiftNode.class, inputs = {"x", "y"})
-@MatchableNode(nodeClass = WriteNode.class, inputs = {"object", "location", "value"})
+@MatchableNode(nodeClass = WriteNode.class, inputs = {"address", "value"})
 @MatchableNode(nodeClass = ZeroExtendNode.class, inputs = {"value"})
 @MatchableNode(nodeClass = AndNode.class, inputs = {"x", "y"}, commutative = true)
 @MatchableNode(nodeClass = FloatEqualsNode.class, inputs = {"x", "y"}, commutative = true)
@@ -91,7 +92,6 @@
 @MatchableNode(nodeClass = OrNode.class, inputs = {"x", "y"}, commutative = true)
 @MatchableNode(nodeClass = XorNode.class, inputs = {"x", "y"}, commutative = true)
 @MatchableNode(nodeClass = PiNode.class, inputs = {"object"})
-@MatchableNode(nodeClass = ConstantLocationNode.class, shareable = true)
 public abstract class NodeLIRBuilder implements NodeLIRBuilderTool, LIRGenerationDebugContext {
 
     private final NodeMap<Value> nodeOperands;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchContext.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchContext.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.compiler.match;
 
-import static com.oracle.graal.compiler.GraalDebugConfig.*;
+import static com.oracle.jvmci.debug.JVMCIDebugConfig.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.compiler.match;
 
-import static com.oracle.graal.compiler.GraalDebugConfig.*;
+import static com.oracle.jvmci.debug.JVMCIDebugConfig.*;
 
 import java.util.*;
 import java.util.Map.Entry;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatement.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatement.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.compiler.match;
 
-import static com.oracle.graal.compiler.GraalDebugConfig.*;
+import static com.oracle.jvmci.debug.JVMCIDebugConfig.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java	Tue Jun 09 19:07:39 2015 -0700
@@ -67,16 +67,12 @@
 
         appendPhase(new CleanTypeProfileProxyPhase(canonicalizer));
 
-        if (FullUnroll.getValue()) {
-            appendPhase(new LoopFullUnrollPhase(canonicalizer));
+        if (OptConvertDeoptsToGuards.getValue()) {
+            appendPhase(new ConvertDeoptimizeToGuardPhase());
         }
 
-        if (PartialEscapeAnalysis.getValue()) {
-            appendPhase(new PartialEscapePhase(true, canonicalizer));
-        }
-
-        if (OptConvertDeoptsToGuards.getValue()) {
-            appendPhase(new ConvertDeoptimizeToGuardPhase());
+        if (FullUnroll.getValue()) {
+            appendPhase(new LoopFullUnrollPhase(canonicalizer));
         }
 
         if (OptLoopTransform.getValue()) {
@@ -87,12 +83,16 @@
                 appendPhase(new LoopUnswitchingPhase());
             }
         }
-        appendPhase(new RemoveValueProxyPhase());
 
         if (OptCanonicalizer.getValue()) {
             appendPhase(canonicalizer);
         }
 
+        if (PartialEscapeAnalysis.getValue()) {
+            appendPhase(new PartialEscapePhase(true, canonicalizer));
+        }
+        appendPhase(new RemoveValueProxyPhase());
+
         appendPhase(new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER));
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotAddressLowering.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,122 @@
+/*
+ * 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.hotspot.amd64;
+
+import com.oracle.graal.asm.*;
+import com.oracle.graal.asm.amd64.AMD64Address.Scale;
+import com.oracle.graal.compiler.amd64.*;
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.graph.*;
+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.code.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
+import com.oracle.jvmci.meta.*;
+
+public class AMD64HotSpotAddressLowering extends AMD64AddressLowering {
+
+    private final long heapBase;
+    private final Register heapBaseRegister;
+
+    @NodeInfo
+    public static class HeapBaseNode extends FloatingNode implements LIRLowerable {
+
+        public static final NodeClass<HeapBaseNode> TYPE = NodeClass.create(HeapBaseNode.class);
+
+        private final Register heapBaseRegister;
+
+        public HeapBaseNode(Register heapBaseRegister) {
+            super(TYPE, StampFactory.pointer());
+            this.heapBaseRegister = heapBaseRegister;
+        }
+
+        public void generate(NodeLIRBuilderTool generator) {
+            LIRKind kind = generator.getLIRGeneratorTool().getLIRKind(stamp());
+            generator.setResult(this, heapBaseRegister.asValue(kind));
+        }
+    }
+
+    public AMD64HotSpotAddressLowering(CodeCacheProvider codeCache, long heapBase, Register heapBaseRegister) {
+        super(codeCache);
+        this.heapBase = heapBase;
+        if (heapBase == 0) {
+            this.heapBaseRegister = null;
+        } else {
+            this.heapBaseRegister = heapBaseRegister;
+        }
+    }
+
+    @Override
+    protected boolean improve(AMD64AddressNode addr) {
+        if (addr.getScale() == Scale.Times1) {
+            if (addr.getBase() == null && addr.getIndex() instanceof CompressionNode) {
+                if (improveUncompression(addr, (CompressionNode) addr.getIndex())) {
+                    return true;
+                }
+            }
+
+            if (addr.getIndex() == null && addr.getBase() instanceof CompressionNode) {
+                if (improveUncompression(addr, (CompressionNode) addr.getBase())) {
+                    return true;
+                }
+            }
+        }
+
+        return super.improve(addr);
+    }
+
+    private boolean improveUncompression(AMD64AddressNode addr, CompressionNode compression) {
+        if (compression.getOp() == CompressionOp.Uncompress) {
+            CompressEncoding encoding = compression.getEncoding();
+            Scale scale = Scale.fromShift(encoding.shift);
+            if (scale == null) {
+                return false;
+            }
+
+            if (heapBaseRegister != null && encoding.base == heapBase) {
+                ValueNode base = compression.graph().unique(new HeapBaseNode(heapBaseRegister));
+                addr.setBase(base);
+            } else if (encoding.base != 0) {
+                long disp = addr.getDisplacement() + heapBase;
+                if (NumUtil.isInt(disp)) {
+                    addr.setDisplacement((int) disp);
+                } else {
+                    return false;
+                }
+            } else {
+                addr.setBase(null);
+            }
+
+            addr.setScale(scale);
+            addr.setIndex(compression.getValue());
+            return true;
+        } else {
+            return false;
+        }
+    }
+}
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java	Tue Jun 09 19:07:39 2015 -0700
@@ -91,7 +91,7 @@
                 replacements.setGraphBuilderPlugins(plugins);
             }
             try (InitTimer rt = timer("create Suites provider")) {
-                suites = createSuites(runtime, plugins);
+                suites = createSuites(runtime, plugins, codeCache, registers);
             }
             providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, suites, registers, snippetReflection, wordTypes, plugins);
         }
@@ -125,8 +125,8 @@
         return new AMD64HotSpotForeignCallsProvider(runtime, metaAccess, codeCache, nativeABICallerSaveRegisters);
     }
 
-    protected HotSpotSuitesProvider createSuites(HotSpotGraalRuntimeProvider runtime, Plugins plugins) {
-        return new HotSpotSuitesProvider(runtime, plugins);
+    protected HotSpotSuitesProvider createSuites(HotSpotGraalRuntimeProvider runtime, Plugins plugins, CodeCacheProvider codeCache, HotSpotRegistersProvider registers) {
+        return new HotSpotSuitesProvider(runtime, plugins, new AMD64HotSpotAddressLowering(codeCache, runtime.getConfig().getOopEncoding().base, registers.getHeapBaseRegister()));
     }
 
     protected HotSpotSnippetReflectionProvider createSnippetReflection(HotSpotGraalRuntimeProvider runtime) {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Jun 09 19:07:39 2015 -0700
@@ -30,7 +30,9 @@
 
 import java.util.*;
 
-import com.oracle.graal.asm.amd64.AMD64Assembler.*;
+import com.oracle.graal.asm.amd64.AMD64Address.Scale;
+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.*;
@@ -565,10 +567,17 @@
     @Override
     protected AMD64LIRInstruction createMove(AllocatableValue dst, Value src) {
         if (src instanceof JavaConstant) {
-            return new AMD64HotSpotMove.HotSpotLoadConstantOp(dst, (JavaConstant) src);
-        } else {
-            return super.createMove(dst, src);
+            if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(src)) {
+                return super.createMove(dst, JavaConstant.INT_0);
+            }
+            if (src instanceof HotSpotObjectConstant) {
+                return new AMD64HotSpotMove.HotSpotLoadObjectConstantOp(dst, (HotSpotObjectConstant) src);
+            }
+            if (src instanceof HotSpotMetaspaceConstant) {
+                return new AMD64HotSpotMove.HotSpotLoadMetaspaceConstantOp(dst, (HotSpotMetaspaceConstant) src);
+            }
         }
+        return super.createMove(dst, src);
     }
 
     @Override
@@ -577,7 +586,8 @@
             CompressEncoding encoding = config.getOopEncoding();
             Value uncompressed;
             if (encoding.shift <= 3) {
-                uncompressed = emitAddress(getProviders().getRegisters().getHeapBaseRegister().asValue(), 0, load(address), 1 << encoding.shift);
+                LIRKind wordKind = LIRKind.derivedReference(target().wordKind);
+                uncompressed = new AMD64AddressValue(wordKind, getProviders().getRegisters().getHeapBaseRegister().asValue(wordKind), asAllocatable(address), Scale.fromInt(1 << encoding.shift), 0);
             } else {
                 uncompressed = emitUncompress(address, encoding, false);
             }
@@ -647,4 +657,10 @@
         }
         return null;
     }
+
+    @Override
+    public void emitPrefetchAllocate(Value address) {
+        append(new AMD64PrefetchOp(asAddressValue(address), config.allocatePrefetchInstr));
+    }
+
 }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java	Tue Jun 09 19:07:39 2015 -0700
@@ -43,13 +43,13 @@
 
 public class AMD64HotSpotMove {
 
-    public static final class HotSpotLoadConstantOp extends AMD64LIRInstruction implements MoveOp {
-        public static final LIRInstructionClass<HotSpotLoadConstantOp> TYPE = LIRInstructionClass.create(HotSpotLoadConstantOp.class);
+    public static final class HotSpotLoadObjectConstantOp extends AMD64LIRInstruction implements MoveOp {
+        public static final LIRInstructionClass<HotSpotLoadObjectConstantOp> TYPE = LIRInstructionClass.create(HotSpotLoadObjectConstantOp.class);
 
         @Def({REG, STACK}) private AllocatableValue result;
-        private final JavaConstant input;
+        private final HotSpotObjectConstant input;
 
-        public HotSpotLoadConstantOp(AllocatableValue result, JavaConstant input) {
+        public HotSpotLoadObjectConstantOp(AllocatableValue result, HotSpotObjectConstant input) {
             super(TYPE);
             this.result = result;
             this.input = input;
@@ -57,83 +57,34 @@
 
         @Override
         public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
-            if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(input)) {
-                if (isRegister(result)) {
-                    masm.movl(asRegister(result), 0);
-                } else {
-                    assert isStackSlot(result);
-                    masm.movl((AMD64Address) crb.asAddress(result), 0);
-                }
-            } else if (input instanceof HotSpotObjectConstant) {
-                boolean compressed = ((HotSpotObjectConstant) input).isCompressed();
-                if (crb.target.inlineObjects) {
-                    crb.recordInlineDataInCode(input);
-                    if (isRegister(result)) {
-                        if (compressed) {
-                            masm.movl(asRegister(result), 0xDEADDEAD);
-                        } else {
-                            masm.movq(asRegister(result), 0xDEADDEADDEADDEADL);
-                        }
-                    } else {
-                        assert isStackSlot(result);
-                        if (compressed) {
-                            masm.movl((AMD64Address) crb.asAddress(result), 0xDEADDEAD);
-                        } else {
-                            throw JVMCIError.shouldNotReachHere("Cannot store 64-bit constants to memory");
-                        }
-                    }
-                } else {
-                    if (isRegister(result)) {
-                        AMD64Address address = (AMD64Address) crb.recordDataReferenceInCode(input, compressed ? 4 : 8);
-                        if (compressed) {
-                            masm.movl(asRegister(result), address);
-                        } else {
-                            masm.movq(asRegister(result), address);
-                        }
-                    } else {
-                        throw JVMCIError.shouldNotReachHere("Cannot directly store data patch to memory");
-                    }
-                }
-            } else if (input instanceof HotSpotMetaspaceConstant) {
-                assert input.getKind() == Kind.Int || input.getKind() == Kind.Long;
-                boolean compressed = input.getKind() == Kind.Int;
-                boolean isImmutable = GraalOptions.ImmutableCode.getValue();
-                boolean generatePIC = GraalOptions.GeneratePIC.getValue();
+            boolean compressed = input.isCompressed();
+            if (crb.target.inlineObjects) {
                 crb.recordInlineDataInCode(input);
                 if (isRegister(result)) {
                     if (compressed) {
-                        if (isImmutable && generatePIC) {
-                            Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
-                            int alignment = hostWordKind.getBitCount() / Byte.SIZE;
-                            // recordDataReferenceInCode forces the mov to be rip-relative
-                            masm.movl(asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(JavaConstant.INT_0, alignment));
-                        } else {
-                            masm.movl(asRegister(result), input.asInt());
-                        }
+                        masm.movl(asRegister(result), 0xDEADDEAD);
                     } else {
-                        if (isImmutable && generatePIC) {
-                            Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
-                            int alignment = hostWordKind.getBitCount() / Byte.SIZE;
-                            // recordDataReferenceInCode forces the mov to be rip-relative
-                            masm.movq(asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(JavaConstant.INT_0, alignment));
-                        } else {
-                            masm.movq(asRegister(result), input.asLong());
-                        }
+                        masm.movq(asRegister(result), 0xDEADDEADDEADDEADL);
                     }
                 } else {
                     assert isStackSlot(result);
                     if (compressed) {
-                        if (isImmutable && generatePIC) {
-                            throw JVMCIError.shouldNotReachHere("Unsupported operation offset(%rip) -> mem (mem -> mem)");
-                        } else {
-                            masm.movl((AMD64Address) crb.asAddress(result), input.asInt());
-                        }
+                        masm.movl((AMD64Address) crb.asAddress(result), 0xDEADDEAD);
                     } else {
                         throw JVMCIError.shouldNotReachHere("Cannot store 64-bit constants to memory");
                     }
                 }
             } else {
-                AMD64Move.move(crb, masm, result, input);
+                if (isRegister(result)) {
+                    AMD64Address address = (AMD64Address) crb.recordDataReferenceInCode(input, compressed ? 4 : 8);
+                    if (compressed) {
+                        masm.movl(asRegister(result), address);
+                    } else {
+                        masm.movq(asRegister(result), address);
+                    }
+                } else {
+                    throw JVMCIError.shouldNotReachHere("Cannot directly store data patch to memory");
+                }
             }
         }
 
@@ -146,6 +97,69 @@
         }
     }
 
+    public static final class HotSpotLoadMetaspaceConstantOp extends AMD64LIRInstruction implements MoveOp {
+        public static final LIRInstructionClass<HotSpotLoadMetaspaceConstantOp> TYPE = LIRInstructionClass.create(HotSpotLoadMetaspaceConstantOp.class);
+
+        @Def({REG, STACK}) private AllocatableValue result;
+        private final HotSpotMetaspaceConstant input;
+
+        public HotSpotLoadMetaspaceConstantOp(AllocatableValue result, HotSpotMetaspaceConstant input) {
+            super(TYPE);
+            this.result = result;
+            this.input = input;
+        }
+
+        @Override
+        public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
+            boolean compressed = input.isCompressed();
+            boolean isImmutable = GraalOptions.ImmutableCode.getValue();
+            boolean generatePIC = GraalOptions.GeneratePIC.getValue();
+            crb.recordInlineDataInCode(input);
+            if (isRegister(result)) {
+                if (compressed) {
+                    if (isImmutable && generatePIC) {
+                        Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
+                        int alignment = hostWordKind.getBitCount() / Byte.SIZE;
+                        // recordDataReferenceInCode forces the mov to be rip-relative
+                        masm.movl(asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(JavaConstant.INT_0, alignment));
+                    } else {
+                        assert NumUtil.isInt(input.rawValue());
+                        masm.movl(asRegister(result), (int) input.rawValue());
+                    }
+                } else {
+                    if (isImmutable && generatePIC) {
+                        Kind hostWordKind = HotSpotGraalRuntime.getHostWordKind();
+                        int alignment = hostWordKind.getBitCount() / Byte.SIZE;
+                        // recordDataReferenceInCode forces the mov to be rip-relative
+                        masm.movq(asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(JavaConstant.INT_0, alignment));
+                    } else {
+                        masm.movq(asRegister(result), input.rawValue());
+                    }
+                }
+            } else {
+                assert isStackSlot(result);
+                if (compressed) {
+                    if (isImmutable && generatePIC) {
+                        throw JVMCIError.shouldNotReachHere("Unsupported operation offset(%rip) -> mem (mem -> mem)");
+                    } else {
+                        assert NumUtil.isInt(input.rawValue());
+                        masm.movl((AMD64Address) crb.asAddress(result), (int) input.rawValue());
+                    }
+                } else {
+                    throw JVMCIError.shouldNotReachHere("Cannot store 64-bit constants to memory");
+                }
+            }
+        }
+
+        public Value getInput() {
+            return (Value) input;
+        }
+
+        public AllocatableValue getResult() {
+            return result;
+        }
+    }
+
     public static final class CompressPointer extends AMD64LIRInstruction {
         public static final LIRInstructionClass<CompressPointer> TYPE = LIRInstructionClass.create(CompressPointer.class);
 
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,31 +22,20 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.jvmci.amd64.AMD64.*;
 import static com.oracle.jvmci.code.ValueUtil.*;
 
-import com.oracle.graal.asm.*;
-import com.oracle.graal.asm.amd64.AMD64Assembler.*;
 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.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
-import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.amd64.*;
 import com.oracle.graal.lir.amd64.AMD64Move.CompareAndSwapOp;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.memory.*;
 import com.oracle.jvmci.amd64.*;
 import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.debug.*;
@@ -58,35 +47,8 @@
  */
 public class AMD64HotSpotNodeLIRBuilder extends AMD64NodeLIRBuilder implements HotSpotNodeLIRBuilder {
 
-    private static ValueNode filterCompression(ValueNode node) {
-        ValueNode result = node;
-        if (result instanceof PiNode) {
-            result = ((PiNode) result).getOriginalNode();
-        }
-        if (result instanceof CompressionNode) {
-            result = ((CompressionNode) result).getValue();
-        }
-        return result;
-    }
-
     private final HotSpotGraalRuntimeProvider runtime;
 
-    private void emitCompareCompressedMemory(Kind kind, IfNode ifNode, ValueNode valueNode, CompressionNode compress, ConstantLocationNode location, Access access, CompareNode compare) {
-        Value value = gen.load(operand(valueNode));
-        AMD64AddressValue address = makeCompressedAddress(compress, location);
-        Condition cond = compare.condition();
-        if (access == filterCompression(compare.getX())) {
-            cond = cond.mirror();
-        } else {
-            assert access == filterCompression(compare.getY());
-        }
-
-        LabelRef trueLabel = getLIRBlock(ifNode.trueSuccessor());
-        LabelRef falseLabel = getLIRBlock(ifNode.falseSuccessor());
-        double trueLabelProbability = ifNode.probability(ifNode.trueSuccessor());
-        getGen().emitCompareBranchMemory(kind, value, address, getState(access), cond, compare.unorderedIsTrue(), trueLabel, falseLabel, trueLabelProbability);
-    }
-
     public AMD64HotSpotNodeLIRBuilder(HotSpotGraalRuntimeProvider runtime, StructuredGraph graph, LIRGeneratorTool gen) {
         super(graph, gen);
         this.runtime = runtime;
@@ -197,169 +159,16 @@
         }
     }
 
-    public void emitPrefetchAllocate(ValueNode address, ValueNode distance) {
-        AMD64AddressValue addr = getGen().emitAddress(operand(address), 0, gen.loadNonConst(operand(distance)), 1);
-        append(new AMD64PrefetchOp(addr, getGen().config.allocatePrefetchInstr));
-    }
-
     @Override
     public void visitDirectCompareAndSwap(DirectCompareAndSwapNode x) {
         Value expected = gen.loadNonConst(operand(x.expectedValue()));
         Variable newVal = gen.load(operand(x.newValue()));
         assert expected.getLIRKind().equals(newVal.getLIRKind());
 
-        AMD64AddressValue address = getGen().emitAddress(operand(x.object()), 0, operand(x.offset()), 1);
-
         RegisterValue raxLocal = AMD64.rax.asValue(expected.getLIRKind());
         gen.emitMove(raxLocal, expected);
-        append(new CompareAndSwapOp(expected.getKind(), raxLocal, address, raxLocal, newVal));
+        append(new CompareAndSwapOp(expected.getKind(), raxLocal, getGen().asAddressValue(operand(x.getAddress())), raxLocal, newVal));
 
         setResult(x, gen.emitMove(raxLocal));
     }
-
-    boolean canFormCompressedMemory(CompressionNode compress, ConstantLocationNode location) {
-        HotSpotVMConfig config = runtime.getConfig();
-        if (config.useCompressedOops && compress.getEncoding().shift <= 3 && NumUtil.isInt(location.getDisplacement())) {
-            Stamp compressedStamp = compress.getValue().stamp();
-            if (compressedStamp instanceof NarrowOopStamp) {
-                return true;
-            } else if (compressedStamp instanceof KlassPointerStamp) {
-                assert ((KlassPointerStamp) compressedStamp).isCompressed();
-                return config.narrowKlassBase == config.narrowOopBase;
-            }
-        }
-        return false;
-    }
-
-    private AMD64AddressValue makeCompressedAddress(CompressionNode compress, ConstantLocationNode location) {
-        assert canFormCompressedMemory(compress, location);
-        AMD64AddressValue address = getGen().emitAddress(getGen().getProviders().getRegisters().getHeapBaseRegister().asValue(), location.getDisplacement(), operand(compress.getValue()),
-                        1 << compress.getEncoding().shift);
-        return address;
-    }
-
-    @MatchRule("(If (IntegerEquals=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))")
-    @MatchRule("(If (IntegerLessThan=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))")
-    @MatchRule("(If (IntegerBelow=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))")
-    @MatchRule("(If (FloatEquals=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))")
-    @MatchRule("(If (FloatLessThan=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))")
-    @MatchRule("(If (IntegerEquals=compare value (Read=access (Compression=compress object) ConstantLocation=location)))")
-    @MatchRule("(If (IntegerLessThan=compare value (Read=access (Compression=compress object) ConstantLocation=location)))")
-    @MatchRule("(If (IntegerBelow=compare value (Read=access (Compression=compress object) ConstantLocation=location)))")
-    @MatchRule("(If (FloatEquals=compare value (Read=access (Compression=compress object) ConstantLocation=location)))")
-    @MatchRule("(If (FloatLessThan=compare value (Read=access (Compression=compress object) ConstantLocation=location)))")
-    public ComplexMatchResult ifCompareCompressedMemory(IfNode root, CompareNode compare, CompressionNode compress, ValueNode value, ConstantLocationNode location, Access access) {
-        if (canFormCompressedMemory(compress, location)) {
-            PlatformKind cmpKind = gen.getLIRKind(compare.getX().stamp()).getPlatformKind();
-            if (cmpKind instanceof Kind) {
-                Kind kind = (Kind) cmpKind;
-                return builder -> {
-                    emitCompareCompressedMemory(kind, root, value, compress, location, access, compare);
-                    return null;
-                };
-            }
-        }
-        return null;
-    }
-
-    private ComplexMatchResult binaryReadCompressed(AMD64RMOp op, OperandSize size, ValueNode value, Access access, CompressionNode compress, ConstantLocationNode location) {
-        if (canFormCompressedMemory(compress, location)) {
-            return builder -> getLIRGeneratorTool().emitBinaryMemory(op, size, getLIRGeneratorTool().asAllocatable(operand(value)), makeCompressedAddress(compress, location), getState(access));
-        } else {
-            return null;
-        }
-    }
-
-    @MatchRule("(Add value (Read=access (Compression=compress object) ConstantLocation=location))")
-    @MatchRule("(Add value (FloatingRead=access (Compression=compress object) ConstantLocation=location))")
-    public ComplexMatchResult addMemoryCompressed(ValueNode value, Access access, CompressionNode compress, ConstantLocationNode location) {
-        OperandSize size = getMemorySize(access);
-        if (size.isXmmType()) {
-            return binaryReadCompressed(SSEOp.ADD, size, value, access, compress, location);
-        } else {
-            return binaryReadCompressed(ADD.getRMOpcode(size), size, value, access, compress, location);
-        }
-    }
-
-    @MatchRule("(Sub value (Read=access (Compression=compress object) ConstantLocation=location))")
-    @MatchRule("(Sub value (FloatingRead=access (Compression=compress object) ConstantLocation=location))")
-    public ComplexMatchResult subMemoryCompressed(ValueNode value, Access access, CompressionNode compress, ConstantLocationNode location) {
-        OperandSize size = getMemorySize(access);
-        if (size.isXmmType()) {
-            return binaryReadCompressed(SSEOp.SUB, size, value, access, compress, location);
-        } else {
-            return binaryReadCompressed(SUB.getRMOpcode(size), size, value, access, compress, location);
-        }
-    }
-
-    @MatchRule("(Mul value (Read=access (Compression=compress object) ConstantLocation=location))")
-    @MatchRule("(Mul value (FloatingRead=access (Compression=compress object) ConstantLocation=location))")
-    public ComplexMatchResult mulMemoryCompressed(ValueNode value, Access access, CompressionNode compress, ConstantLocationNode location) {
-        OperandSize size = getMemorySize(access);
-        if (size.isXmmType()) {
-            return binaryReadCompressed(SSEOp.MUL, size, value, access, compress, location);
-        } else {
-            return binaryReadCompressed(AMD64RMOp.IMUL, size, value, access, compress, location);
-        }
-    }
-
-    @MatchRule("(And value (Read=access (Compression=compress object) ConstantLocation=location))")
-    @MatchRule("(And value (FloatingRead=access (Compression=compress object) ConstantLocation=location))")
-    public ComplexMatchResult andMemoryCompressed(ValueNode value, Access access, CompressionNode compress, ConstantLocationNode location) {
-        OperandSize size = getMemorySize(access);
-        if (size.isXmmType()) {
-            return null;
-        } else {
-            return binaryReadCompressed(AND.getRMOpcode(size), size, value, access, compress, location);
-        }
-    }
-
-    @MatchRule("(Or value (Read=access (Compression=compress object) ConstantLocation=location))")
-    @MatchRule("(Or value (FloatingRead=access (Compression=compress object) ConstantLocation=location))")
-    public ComplexMatchResult orMemoryCompressed(ValueNode value, Access access, CompressionNode compress, ConstantLocationNode location) {
-        OperandSize size = getMemorySize(access);
-        if (size.isXmmType()) {
-            return null;
-        } else {
-            return binaryReadCompressed(OR.getRMOpcode(size), size, value, access, compress, location);
-        }
-    }
-
-    @MatchRule("(Xor value (Read=access (Compression=compress object) ConstantLocation=location))")
-    @MatchRule("(Xor value (FloatingRead=access (Compression=compress object) ConstantLocation=location))")
-    public ComplexMatchResult xorMemoryCompressed(ValueNode value, Access access, CompressionNode compress, ConstantLocationNode location) {
-        OperandSize size = getMemorySize(access);
-        if (size.isXmmType()) {
-            return null;
-        } else {
-            return binaryReadCompressed(XOR.getRMOpcode(size), size, value, access, compress, location);
-        }
-    }
-
-    @MatchRule("(Read (Compression=compress object) ConstantLocation=location)")
-    @MatchRule("(Read (Pi (Compression=compress object)) ConstantLocation=location)")
-    @MatchRule("(FloatingRead (Compression=compress object) ConstantLocation=location)")
-    @MatchRule("(FloatingRead (Pi (Compression=compress object)) ConstantLocation=location)")
-    public ComplexMatchResult readCompressed(Access root, CompressionNode compress, ConstantLocationNode location) {
-        if (canFormCompressedMemory(compress, location)) {
-            LIRKind readKind = getGen().getLIRKind(root.asNode().stamp());
-            return builder -> {
-                return getGen().emitLoad(readKind, makeCompressedAddress(compress, location), getState(root));
-            };
-        }
-        return null;
-    }
-
-    @MatchRule("(Write (Compression=compress object) ConstantLocation=location value)")
-    @MatchRule("(Write (Pi (Compression=compress object)) ConstantLocation=location value)")
-    public ComplexMatchResult writeCompressed(Access root, CompressionNode compress, ConstantLocationNode location, ValueNode value) {
-        if (canFormCompressedMemory(compress, location)) {
-            LIRKind readKind = getGen().getLIRKind(value.asNode().stamp());
-            return builder -> {
-                getGen().emitStore(readKind, makeCompressedAddress(compress, location), operand(value), getState(root));
-                return null;
-            };
-        }
-        return null;
-    }
 }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,21 +22,13 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-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.jvmci.code.CallingConvention.Type.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.jvmci.common.UnsafeAccess.*;
 import static com.oracle.jvmci.sparc.SPARC.*;
 
@@ -58,7 +50,9 @@
 import com.oracle.graal.lir.sparc.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * HotSpot SPARC specific backend.
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java	Tue Jun 09 19:07:39 2015 -0700
@@ -24,6 +24,7 @@
 
 import java.util.*;
 
+import com.oracle.graal.compiler.sparc.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
@@ -60,7 +61,7 @@
         HotSpotWordTypes wordTypes = new HotSpotWordTypes(metaAccess, target.wordKind);
         Plugins plugins = createGraphBuilderPlugins(runtime, metaAccess, constantReflection, foreignCalls, stampProvider, snippetReflection, replacements, wordTypes);
         replacements.setGraphBuilderPlugins(plugins);
-        HotSpotSuitesProvider suites = createSuites(runtime, plugins);
+        HotSpotSuitesProvider suites = createSuites(runtime, plugins, codeCache);
         HotSpotProviders providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, suites, registers, snippetReflection, wordTypes, plugins);
 
         return createBackend(runtime, providers);
@@ -74,8 +75,8 @@
         return plugins;
     }
 
-    protected HotSpotSuitesProvider createSuites(HotSpotGraalRuntimeProvider runtime, Plugins plugins) {
-        return new HotSpotSuitesProvider(runtime, plugins);
+    protected HotSpotSuitesProvider createSuites(HotSpotGraalRuntimeProvider runtime, Plugins plugins, CodeCacheProvider codeCache) {
+        return new HotSpotSuitesProvider(runtime, plugins, new SPARCAddressLowering(codeCache));
     }
 
     protected SPARCHotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) {
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, 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
@@ -193,7 +193,7 @@
     private void moveValueToThread(Value v, int offset) {
         LIRKind wordKind = LIRKind.value(getProviders().getCodeCache().getTarget().wordKind);
         RegisterValue thread = getProviders().getRegisters().getThreadRegister().asValue(wordKind);
-        SPARCAddressValue pendingDeoptAddress = new SPARCAddressValue(wordKind, thread, offset);
+        SPARCAddressValue pendingDeoptAddress = new SPARCImmediateAddressValue(wordKind, thread, offset);
         append(new StoreOp(v.getKind(), pendingDeoptAddress, load(v), null));
     }
 
@@ -258,12 +258,16 @@
         LIRKind kind = newValue.getLIRKind();
         assert kind.equals(expectedValue.getLIRKind());
         Kind memKind = (Kind) kind.getPlatformKind();
-        SPARCAddressValue addressValue = asAddressValue(address);
         Variable result = newVariable(newValue.getLIRKind());
-        append(new CompareAndSwapOp(result, asAllocatable(addressValue), asAllocatable(expectedValue), asAllocatable(newValue)));
+        append(new CompareAndSwapOp(result, asAllocatable(address), asAllocatable(expectedValue), asAllocatable(newValue)));
         return emitConditionalMove(memKind, expectedValue, result, Condition.EQ, true, trueValue, falseValue);
     }
 
+    public void emitPrefetchAllocate(Value address) {
+        SPARCAddressValue addr = asAddressValue(address);
+        append(new SPARCPrefetchOp(addr, config.allocatePrefetchInstr));
+    }
+
     public StackSlot getDeoptimizationRescueSlot() {
         return deoptimizationRescueSlot;
     }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotNodeLIRBuilder.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotNodeLIRBuilder.java	Tue Jun 09 19:07:39 2015 -0700
@@ -23,7 +23,6 @@
 package com.oracle.graal.hotspot.sparc;
 
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
-import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.jvmci.sparc.SPARC.*;
 
 import com.oracle.graal.compiler.gen.*;
@@ -33,7 +32,6 @@
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.gen.*;
-import com.oracle.graal.lir.sparc.*;
 import com.oracle.graal.lir.sparc.SPARCMove.CompareAndSwapOp;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
@@ -72,24 +70,12 @@
 
     @Override
     public void visitDirectCompareAndSwap(DirectCompareAndSwapNode x) {
-        Variable address = gen.load(operand(x.object()));
-        Value offset = operand(x.offset());
-        Variable cmpValue = (Variable) gen.loadNonConst(operand(x.expectedValue()));
-        Variable newValue = gen.load(operand(x.newValue()));
+        AllocatableValue address = gen.asAllocatable(operand(x.getAddress()));
+        AllocatableValue cmpValue = gen.asAllocatable(operand(x.expectedValue()));
+        AllocatableValue newValue = gen.asAllocatable(operand(x.newValue()));
         LIRKind kind = cmpValue.getLIRKind();
         assert kind.equals(newValue.getLIRKind());
 
-        if (ValueUtil.isConstant(offset)) {
-            assert !gen.getCodeCache().needsDataPatch(asConstant(offset));
-            Variable longAddress = gen.newVariable(LIRKind.value(Kind.Long));
-            gen.emitMove(longAddress, address);
-            address = getGen().emitAdd(longAddress, asConstant(offset), false);
-        } else {
-            if (isLegal(offset)) {
-                address = getGen().emitAdd(address, offset, false);
-            }
-        }
-
         Variable result = gen.newVariable(newValue.getLIRKind());
         append(new CompareAndSwapOp(result, address, cmpValue, newValue));
         setResult(x, result);
@@ -145,11 +131,6 @@
         append(op);
     }
 
-    public void emitPrefetchAllocate(ValueNode address, ValueNode distance) {
-        SPARCAddressValue addr = getGen().emitAddress(operand(address), 0, getGen().loadNonConst(operand(distance)), 1);
-        append(new SPARCPrefetchOp(addr, getGen().config.allocatePrefetchInstr));
-    }
-
     @Override
     public void visitFullInfopointNode(FullInfopointNode i) {
         if (i.getState() != null && i.getState().bci == BytecodeFrame.AFTER_BCI) {
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompileTheWorldTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompileTheWorldTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.hotspot.test;
 
-import static com.oracle.graal.compiler.common.GraalOptions.*;
+import static com.oracle.jvmci.compiler.Compiler.*;
 
 import org.junit.*;
 
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.CompileTheWorld.Config;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.CompileTheWorld.Config;
 
 /**
  * Tests {@link CompileTheWorld} functionality.
@@ -41,7 +41,7 @@
         // Compile a couple classes in rt.jar
         String file = System.getProperty("java.home") + "/lib/rt.jar";
         new CompileTheWorld(file, new Config(null), 1, 5, null, null, false).compile();
-        ExitVMOnException.setValue(originalSetting);
+        assert ExitVMOnException.getValue() == originalSetting;
     }
 
 }
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,20 +22,17 @@
  */
 package com.oracle.graal.hotspot.test;
 
-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 static com.oracle.jvmci.hotspot.CompileTheWorld.*;
+import static com.oracle.jvmci.hotspot.CompileTheWorld.Options.*;
 
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.CompileTheWorld.Config;
 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.*;
+import com.oracle.jvmci.hotspot.CompileTheWorld.Config;
 
 /**
  * Used to benchmark memory usage during Graal compilation.
@@ -129,16 +126,15 @@
 
     private void doCompilation(String methodName, String label) {
         HotSpotResolvedJavaMethod method = (HotSpotResolvedJavaMethod) getResolvedJavaMethod(methodName);
-        HotSpotBackend backend = runtime().getHostBackend();
 
         // invalidate any existing compiled code
         method.reprofile();
 
-        int id = method.allocateCompileId(INVOCATION_ENTRY_BCI);
+        int id = method.allocateCompileId(com.oracle.jvmci.compiler.Compiler.INVOCATION_ENTRY_BCI);
         long graalEnv = 0L;
 
         try (MemoryUsageCloseable c = label == null ? null : new MemoryUsageCloseable(label)) {
-            CompilationTask task = new CompilationTask(backend, method, INVOCATION_ENTRY_BCI, graalEnv, id, false);
+            CompilationTask task = new CompilationTask(method, com.oracle.jvmci.compiler.Compiler.INVOCATION_ENTRY_BCI, graalEnv, id, false);
             task.runCompilation();
         }
     }
@@ -146,15 +142,14 @@
     private void allocSpyCompilation(String methodName) {
         if (AllocSpy.isEnabled()) {
             HotSpotResolvedJavaMethod method = (HotSpotResolvedJavaMethod) getResolvedJavaMethod(methodName);
-            HotSpotBackend backend = runtime().getHostBackend();
 
             // invalidate any existing compiled code
             method.reprofile();
 
-            int id = method.allocateCompileId(INVOCATION_ENTRY_BCI);
+            int id = method.allocateCompileId(com.oracle.jvmci.compiler.Compiler.INVOCATION_ENTRY_BCI);
             long graalEnv = 0L;
             try (AllocSpy as = AllocSpy.open(methodName)) {
-                CompilationTask task = new CompilationTask(backend, method, INVOCATION_ENTRY_BCI, graalEnv, id, false);
+                CompilationTask task = new CompilationTask(method, com.oracle.jvmci.compiler.Compiler.INVOCATION_ENTRY_BCI, graalEnv, id, false);
                 task.runCompilation();
             }
         }
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.hotspot.test;
 
-import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.lang.ref.*;
@@ -38,9 +37,9 @@
 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.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
@@ -50,6 +49,7 @@
 import com.oracle.jvmci.debug.*;
 import com.oracle.jvmci.debug.Debug.Scope;
 import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The following unit tests assert the presence of write barriers for both Serial and G1 GCs.
@@ -284,9 +284,10 @@
 
             for (ReadNode read : graph.getNodes().filter(ReadNode.class)) {
                 if (read.getBarrierType() != BarrierType.NONE) {
-                    if (read.location() instanceof ConstantLocationNode) {
-                        Assert.assertEquals(referentOffset, ((ConstantLocationNode) (read.location())).getDisplacement());
-                    }
+                    Assert.assertTrue(read.getAddress() instanceof OffsetAddressNode);
+                    JavaConstant constDisp = ((OffsetAddressNode) read.getAddress()).getOffset().asJavaConstant();
+                    Assert.assertNotNull(constDisp);
+                    Assert.assertEquals(referentOffset, constDisp.asLong());
                     Assert.assertTrue(config.useG1GC);
                     Assert.assertEquals(BarrierType.PRECISE, read.getBarrierType());
                     Assert.assertTrue(read.next() instanceof G1ReferentFieldReadBarrier);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +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;
-
-import static java.lang.Thread.*;
-
-import java.io.*;
-import java.lang.annotation.*;
-import java.lang.management.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import com.oracle.jvmci.hotspot.*;
-import com.sun.management.ThreadMXBean;
-
-@SuppressWarnings("unused")
-public final class CompilationStatistics {
-
-    private static final long RESOLUTION = 100000000;
-    private static final boolean ENABLED = Boolean.getBoolean("graal.comp.stats");
-
-    private static final CompilationStatistics DUMMY = new CompilationStatistics(null, false);
-
-    private static ConcurrentLinkedDeque<CompilationStatistics> list = new ConcurrentLinkedDeque<>();
-
-    private static final ThreadLocal<Deque<CompilationStatistics>> current = new ThreadLocal<Deque<CompilationStatistics>>() {
-
-        @Override
-        protected Deque<CompilationStatistics> initialValue() {
-            return new ArrayDeque<>();
-        }
-    };
-
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target(ElementType.FIELD)
-    private static @interface NotReported {
-    }
-
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target(ElementType.FIELD)
-    private static @interface TimeValue {
-    }
-
-    private static long zeroTime = System.nanoTime();
-
-    private static long getThreadAllocatedBytes() {
-        ThreadMXBean thread = (ThreadMXBean) ManagementFactory.getThreadMXBean();
-        return thread.getThreadAllocatedBytes(currentThread().getId());
-    }
-
-    @NotReported private final long startTime;
-    @NotReported private long threadAllocatedBytesStart;
-
-    private int bytecodeCount;
-    private int codeSize;
-    @TimeValue private long duration;
-    private long memoryUsed;
-    private final boolean osr;
-    private final String holder;
-    private final String name;
-    private final String signature;
-
-    private CompilationStatistics(HotSpotResolvedJavaMethod method, boolean osr) {
-        this.osr = osr;
-        if (method != null) {
-            holder = method.getDeclaringClass().getName();
-            name = method.getName();
-            signature = method.getSignature().toMethodDescriptor();
-            startTime = System.nanoTime();
-            bytecodeCount = method.getCodeSize();
-            threadAllocatedBytesStart = getThreadAllocatedBytes();
-        } else {
-            holder = "";
-            name = "";
-            signature = "";
-            startTime = 0;
-        }
-    }
-
-    public void finish(HotSpotResolvedJavaMethod method, HotSpotInstalledCode code) {
-        if (ENABLED) {
-            duration = System.nanoTime() - startTime;
-            codeSize = (int) code.getCodeSize();
-            memoryUsed = getThreadAllocatedBytes() - threadAllocatedBytesStart;
-            if (current.get().getLast() != this) {
-                throw new RuntimeException("mismatch in finish()");
-            }
-            current.get().removeLast();
-        }
-    }
-
-    public static CompilationStatistics current() {
-        return current.get().isEmpty() ? null : current.get().getLast();
-    }
-
-    public static CompilationStatistics create(HotSpotResolvedJavaMethod method, boolean isOSR) {
-        if (ENABLED) {
-            CompilationStatistics stats = new CompilationStatistics(method, isOSR);
-            list.add(stats);
-            current.get().addLast(stats);
-            return stats;
-        } else {
-            return DUMMY;
-        }
-    }
-
-    @SuppressWarnings("deprecation")
-    public static void clear(String dumpName) {
-        if (!ENABLED) {
-            return;
-        }
-        try {
-            ConcurrentLinkedDeque<CompilationStatistics> snapshot = list;
-            long snapshotZeroTime = zeroTime;
-
-            list = new ConcurrentLinkedDeque<>();
-            zeroTime = System.nanoTime();
-
-            Date now = new Date();
-            String dateString = (now.getYear() + 1900) + "-" + (now.getMonth() + 1) + "-" + now.getDate() + "-" + now.getHours() + "" + now.getMinutes();
-
-            dumpCompilations(snapshot, dumpName, dateString);
-
-            try (FileOutputStream fos = new FileOutputStream("timeline_" + dateString + "_" + dumpName + ".csv", true); PrintStream out = new PrintStream(fos)) {
-
-                long[] timeSpent = new long[10000];
-                int maxTick = 0;
-                for (CompilationStatistics stats : snapshot) {
-                    long start = stats.startTime - snapshotZeroTime;
-                    long duration = stats.duration;
-                    if (start < 0) {
-                        duration -= -start;
-                        start = 0;
-                    }
-
-                    int tick = (int) (start / RESOLUTION);
-                    long timeLeft = RESOLUTION - (start % RESOLUTION);
-
-                    while (tick < timeSpent.length && duration > 0) {
-                        if (tick > maxTick) {
-                            maxTick = tick;
-                        }
-                        timeSpent[tick] += Math.min(timeLeft, duration);
-                        duration -= timeLeft;
-                        tick++;
-                        timeLeft = RESOLUTION;
-                    }
-                }
-                String timelineName = System.getProperty("stats.timeline.name");
-                if (timelineName != null && !timelineName.isEmpty()) {
-                    out.print(timelineName + "\t");
-                }
-                for (int i = 0; i <= maxTick; i++) {
-                    out.print((timeSpent[i] * 100 / RESOLUTION) + "\t");
-                }
-                out.println();
-            }
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    protected static void dumpCompilations(ConcurrentLinkedDeque<CompilationStatistics> snapshot, String dumpName, String dateString) throws IllegalAccessException, FileNotFoundException {
-        String fileName = "compilations_" + dateString + "_" + dumpName + ".csv";
-        try (PrintStream out = new PrintStream(fileName)) {
-            // output the list of all compilations
-
-            Field[] declaredFields = CompilationStatistics.class.getDeclaredFields();
-            ArrayList<Field> fields = new ArrayList<>();
-            for (Field field : declaredFields) {
-                if (!Modifier.isStatic(field.getModifiers()) && !field.isAnnotationPresent(NotReported.class)) {
-                    fields.add(field);
-                }
-            }
-            for (Field field : fields) {
-                out.print(field.getName() + "\t");
-            }
-            out.println();
-            for (CompilationStatistics stats : snapshot) {
-                for (Field field : fields) {
-                    if (field.isAnnotationPresent(TimeValue.class)) {
-                        double value = field.getLong(stats) / 1000000d;
-                        out.print(String.format(Locale.ENGLISH, "%.3f", value) + "\t");
-                    } else {
-                        out.print(field.get(stats) + "\t");
-                    }
-                }
-                out.println();
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,383 +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.hotspot;
-
-import static com.oracle.graal.compiler.GraalCompiler.*;
-import static com.oracle.graal.compiler.common.GraalOptions.*;
-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.runtime.*;
-import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.hotspot.phases.*;
-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.phases.*;
-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.hotspot.events.*;
-import com.oracle.jvmci.hotspot.events.EventProvider.*;
-import com.oracle.jvmci.meta.*;
-import com.oracle.jvmci.service.*;
-
-//JaCoCo Exclude
-
-public class CompilationTask {
-    private static final DebugMetric BAILOUTS = Debug.metric("Bailouts");
-
-    private static final EventProvider eventProvider;
-    static {
-        EventProvider provider = Services.loadSingle(EventProvider.class, false);
-        if (provider == null) {
-            eventProvider = new EmptyEventProvider();
-        } else {
-            eventProvider = provider;
-        }
-    }
-
-    private final HotSpotBackend backend;
-    private final HotSpotResolvedJavaMethod method;
-    private final int entryBCI;
-    private final int id;
-
-    /**
-     * Specifies whether the compilation result is installed as the
-     * {@linkplain HotSpotNmethod#isDefault() default} nmethod for the compiled method.
-     */
-    private final boolean installAsDefault;
-
-    private StructuredGraph graph;
-
-    /**
-     * A {@link com.sun.management.ThreadMXBean} to be able to query some information about the
-     * current compiler thread, e.g. total allocated bytes.
-     */
-    private static final com.sun.management.ThreadMXBean threadMXBean = (com.sun.management.ThreadMXBean) ManagementFactory.getThreadMXBean();
-
-    /**
-     * The address of the GraalEnv associated with this compilation or 0L if no such object exists.
-     */
-    private final long graalEnv;
-
-    public CompilationTask(HotSpotBackend backend, HotSpotResolvedJavaMethod method, int entryBCI, long graalEnv, int id, boolean installAsDefault) {
-        this.backend = backend;
-        this.method = method;
-        this.entryBCI = entryBCI;
-        this.id = id;
-        this.graalEnv = graalEnv;
-        this.installAsDefault = installAsDefault;
-    }
-
-    public ResolvedJavaMethod getMethod() {
-        return method;
-    }
-
-    /**
-     * Returns the compilation id of this task.
-     *
-     * @return compile id
-     */
-    public int getId() {
-        return id;
-    }
-
-    public int getEntryBCI() {
-        return entryBCI;
-    }
-
-    /**
-     * Time spent in compilation.
-     */
-    private static final DebugTimer CompilationTime = Debug.timer("CompilationTime");
-
-    /**
-     * Meters the {@linkplain StructuredGraph#getBytecodeSize() bytecodes} compiled.
-     */
-    private static final DebugMetric CompiledBytecodes = Debug.metric("CompiledBytecodes");
-
-    public static final DebugTimer CodeInstallationTime = Debug.timer("CodeInstallation");
-
-    protected Suites getSuites(HotSpotProviders providers) {
-        return providers.getSuites().getDefaultSuites();
-    }
-
-    protected LIRSuites getLIRSuites(HotSpotProviders providers) {
-        return providers.getSuites().getDefaultLIRSuites();
-    }
-
-    protected PhaseSuite<HighTierContext> getGraphBuilderSuite(HotSpotProviders providers) {
-        PhaseSuite<HighTierContext> suite = withSimpleDebugInfoIfRequested(providers.getSuites().getDefaultGraphBuilderSuite());
-
-        boolean osrCompilation = entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI;
-        if (osrCompilation) {
-            suite = suite.copy();
-            suite.appendPhase(new OnStackReplacementPhase());
-        }
-        return suite;
-    }
-
-    protected OptimisticOptimizations getOptimisticOpts(ProfilingInfo profilingInfo) {
-        return new OptimisticOptimizations(profilingInfo);
-    }
-
-    protected ProfilingInfo getProfilingInfo() {
-        boolean osrCompilation = entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI;
-        return method.getProfilingInfo(!osrCompilation, osrCompilation);
-    }
-
-    public void runCompilation() {
-        HotSpotVMConfig config = backend.getRuntime().getConfig();
-        final long threadId = Thread.currentThread().getId();
-        long startCompilationTime = System.nanoTime();
-        HotSpotInstalledCode installedCode = null;
-        final boolean isOSR = entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI;
-
-        // Log a compilation event.
-        CompilationEvent compilationEvent = eventProvider.newCompilationEvent();
-
-        // If there is already compiled code for this method on our level we simply return.
-        // Graal compiles are always at the highest compile level, even in non-tiered mode so we
-        // only need to check for that value.
-        if (method.hasCodeAtLevel(entryBCI, config.compilationLevelFullOptimization)) {
-            return;
-        }
-
-        try (DebugCloseable a = CompilationTime.start()) {
-            CompilationStatistics stats = CompilationStatistics.create(method, isOSR);
-            final boolean printCompilation = PrintCompilation.getValue() && !TTY.isSuppressed();
-            if (printCompilation) {
-                TTY.println(getMethodDescription() + "...");
-            }
-
-            CompilationResult result = null;
-            TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method);
-            final long start = System.currentTimeMillis();
-            final long allocatedBytesBefore = threadMXBean.getThreadAllocatedBytes(threadId);
-
-            try (Scope s = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true))) {
-                // Begin the compilation event.
-                compilationEvent.begin();
-
-                HotSpotProviders providers = backend.getProviders();
-                graph = new StructuredGraph(method, entryBCI, AllowAssumptions.from(OptAssumptions.getValue()));
-                if (shouldDisableMethodInliningRecording(config)) {
-                    graph.disableInlinedMethodRecording();
-                }
-                CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false);
-                if (graph.getEntryBCI() != StructuredGraph.INVOCATION_ENTRY_BCI) {
-                    // for OSR, only a pointer is passed to the method.
-                    JavaType[] parameterTypes = new JavaType[]{providers.getMetaAccess().lookupJavaType(long.class)};
-                    CallingConvention tmp = providers.getCodeCache().getRegisterConfig().getCallingConvention(JavaCallee, providers.getMetaAccess().lookupJavaType(void.class), parameterTypes,
-                                    backend.getTarget(), false);
-                    cc = new CallingConvention(cc.getStackSize(), cc.getReturn(), tmp.getArgument(0));
-                }
-                Suites suites = getSuites(providers);
-                LIRSuites lirSuites = getLIRSuites(providers);
-                ProfilingInfo profilingInfo = getProfilingInfo();
-                OptimisticOptimizations optimisticOpts = getOptimisticOpts(profilingInfo);
-                if (isOSR) {
-                    // In OSR compiles, we cannot rely on never executed code profiles, because
-                    // all code after the OSR loop is never executed.
-                    optimisticOpts.remove(Optimization.RemoveNeverExecutedCode);
-                }
-                result = compileGraph(graph, cc, method, providers, backend, backend.getTarget(), getGraphBuilderSuite(providers), optimisticOpts, profilingInfo, method.getSpeculationLog(), suites,
-                                lirSuites, new CompilationResult(), CompilationResultBuilderFactory.Default);
-                result.setId(getId());
-                result.setEntryBCI(entryBCI);
-            } catch (Throwable e) {
-                throw Debug.handle(e);
-            } finally {
-                // End the compilation event.
-                compilationEvent.end();
-
-                filter.remove();
-                final boolean printAfterCompilation = PrintAfterCompilation.getValue() && !TTY.isSuppressed();
-
-                if (printAfterCompilation || printCompilation) {
-                    final long stop = System.currentTimeMillis();
-                    final int targetCodeSize = result != null ? result.getTargetCodeSize() : -1;
-                    final long allocatedBytesAfter = threadMXBean.getThreadAllocatedBytes(threadId);
-                    final long allocatedBytes = (allocatedBytesAfter - allocatedBytesBefore) / 1024;
-
-                    if (printAfterCompilation) {
-                        TTY.println(getMethodDescription() + String.format(" | %4dms %5dB %5dkB", stop - start, targetCodeSize, allocatedBytes));
-                    } else if (printCompilation) {
-                        TTY.println(String.format("%-6d Graal %-70s %-45s %-50s | %4dms %5dB %5dkB", id, "", "", "", stop - start, targetCodeSize, allocatedBytes));
-                    }
-                }
-            }
-
-            try (DebugCloseable b = CodeInstallationTime.start()) {
-                installedCode = (HotSpotInstalledCode) installMethod(result);
-                if (!isOSR) {
-                    ProfilingInfo profile = method.getProfilingInfo();
-                    profile.setCompilerIRSize(StructuredGraph.class, graph.getNodeCount());
-                }
-            }
-            stats.finish(method, installedCode);
-        } catch (BailoutException bailout) {
-            BAILOUTS.increment();
-            if (ExitVMOnBailout.getValue()) {
-                TTY.cachedOut.println(method.format("Bailout in %H.%n(%p)"));
-                bailout.printStackTrace(TTY.cachedOut);
-                System.exit(-1);
-            } else if (PrintBailout.getValue()) {
-                TTY.cachedOut.println(method.format("Bailout in %H.%n(%p)"));
-                bailout.printStackTrace(TTY.cachedOut);
-            }
-        } catch (Throwable t) {
-            if (PrintStackTraceOnException.getValue() || ExitVMOnException.getValue()) {
-                t.printStackTrace(TTY.cachedOut);
-            }
-
-            // Log a failure event.
-            CompilerFailureEvent event = eventProvider.newCompilerFailureEvent();
-            if (event.shouldWrite()) {
-                event.setCompileId(getId());
-                event.setMessage(t.getMessage());
-                event.commit();
-            }
-
-            if (ExitVMOnException.getValue()) {
-                System.exit(-1);
-            }
-        } finally {
-            final int compiledBytecodes = graph.getBytecodeSize();
-            CompiledBytecodes.add(compiledBytecodes);
-
-            // Log a compilation event.
-            if (compilationEvent.shouldWrite() && installedCode != null) {
-                compilationEvent.setMethod(method.format("%H.%n(%p)"));
-                compilationEvent.setCompileId(getId());
-                compilationEvent.setCompileLevel(config.compilationLevelFullOptimization);
-                compilationEvent.setSucceeded(true);
-                compilationEvent.setIsOsr(isOSR);
-                compilationEvent.setCodeSize(installedCode.getSize());
-                compilationEvent.setInlinedBytes(compiledBytecodes);
-                compilationEvent.commit();
-            }
-
-            if (graalEnv != 0) {
-                long ctask = unsafe.getAddress(graalEnv + config.jvmciEnvTaskOffset);
-                assert ctask != 0L;
-                unsafe.putInt(ctask + config.compileTaskNumInlinedBytecodesOffset, compiledBytecodes);
-            }
-            long compilationTime = System.nanoTime() - startCompilationTime;
-            if ((config.ciTime || config.ciTimeEach) && installedCode != null) {
-                long timeUnitsPerSecond = TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS);
-                CompilerToVM c2vm = backend.getRuntime().getCompilerToVM();
-                c2vm.notifyCompilationStatistics(id, method, entryBCI != INVOCATION_ENTRY_BCI, compiledBytecodes, compilationTime, timeUnitsPerSecond, installedCode);
-            }
-        }
-    }
-
-    /**
-     * Determines whether to {@linkplain StructuredGraph#disableInlinedMethodRecording() disable}
-     * method inlining recording for the method being compiled.
-     *
-     * @see StructuredGraph#getBytecodeSize()
-     */
-    private boolean shouldDisableMethodInliningRecording(HotSpotVMConfig config) {
-        if (config.ciTime || config.ciTimeEach || CompiledBytecodes.isEnabled()) {
-            return false;
-        }
-        if (graalEnv == 0 || unsafe.getByte(graalEnv + config.jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset) != 0) {
-            return false;
-        }
-        return true;
-    }
-
-    private String getMethodDescription() {
-        return String.format("%-6d Graal %-70s %-45s %-50s %s", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature().toMethodDescriptor(),
-                        entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI ? "" : "(OSR@" + entryBCI + ") ");
-    }
-
-    private InstalledCode installMethod(final CompilationResult compResult) {
-        final HotSpotCodeCacheProvider codeCache = backend.getProviders().getCodeCache();
-        InstalledCode installedCode = null;
-        try (Scope s = Debug.scope("CodeInstall", new DebugDumpScope(String.valueOf(id), true), codeCache, method)) {
-            installedCode = codeCache.installMethod(method, compResult, graalEnv, installAsDefault);
-        } catch (Throwable e) {
-            throw Debug.handle(e);
-        }
-        return installedCode;
-    }
-
-    @Override
-    public String toString() {
-        return "Compilation[id=" + id + ", " + method.format("%H.%n(%p)") + (entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI ? "" : "@" + entryBCI) + "]";
-    }
-
-    /**
-     * Schedules compilation of a metaspace Method.
-     *
-     * Called from the VM.
-     *
-     * @param metaspaceMethod
-     * @param entryBCI
-     * @param jvmciEnv address of native GraalEnv object
-     * @param id CompileTask::_compile_id
-     */
-    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();
-
-        // Ensure a debug configuration for this thread is initialized
-        if (Debug.isEnabled() && DebugScope.getConfig() == null) {
-            DebugEnvironment.initialize(TTY.cachedOut);
-        }
-
-        HotSpotResolvedJavaMethod method = HotSpotResolvedJavaMethodImpl.fromMetaspace(metaspaceMethod);
-        compileMethod(method, entryBCI, jvmciEnv, id);
-    }
-
-    /**
-     * Compiles a method to machine code.
-     */
-    static void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long graalEnv, int id) {
-        HotSpotBackend backend = runtime().getHostBackend();
-        CompilationTask task = new CompilationTask(backend, method, entryBCI, graalEnv, id, true);
-        try (DebugConfigScope dcs = setConfig(new TopLevelDebugConfig())) {
-            task.runCompilation();
-        }
-        return;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,509 +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 static com.oracle.graal.compiler.common.GraalOptions.*;
-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.*;
-import java.net.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-import java.util.jar.*;
-import java.util.stream.*;
-
-import com.oracle.graal.bytecode.*;
-import com.oracle.graal.compiler.*;
-import com.oracle.graal.compiler.CompilerThreadFactory.DebugConfigAccess;
-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.
- */
-public final class CompileTheWorld {
-
-    /**
-     * Magic token to trigger reading files from the boot class path.
-     */
-    public static final String SUN_BOOT_CLASS_PATH = "sun.boot.class.path";
-
-    public static class Options {
-        // @formatter:off
-        @Option(help = "Compile all methods in all classes on given class path", type = OptionType.Debug)
-        public static final OptionValue<String> CompileTheWorldClasspath = new OptionValue<>(SUN_BOOT_CLASS_PATH);
-        @Option(help = "Verbose CompileTheWorld operation", type = OptionType.Debug)
-        public static final OptionValue<Boolean> CompileTheWorldVerbose = new OptionValue<>(true);
-        @Option(help = "The number of CompileTheWorld iterations to perform", type = OptionType.Debug)
-        public static final OptionValue<Integer> CompileTheWorldIterations = new OptionValue<>(1);
-        @Option(help = "Only compile methods matching this filter", type = OptionType.Debug)
-        public static final OptionValue<String> CompileTheWorldMethodFilter = new OptionValue<>(null);
-        @Option(help = "Exclude methods matching this filter from compilation", type = OptionType.Debug)
-        public static final OptionValue<String> CompileTheWorldExcludeMethodFilter = new OptionValue<>(null);
-        @Option(help = "First class to consider when using -XX:+CompileTheWorld", type = OptionType.Debug)
-        public static final OptionValue<Integer> CompileTheWorldStartAt = new OptionValue<>(1);
-        @Option(help = "Last class to consider when using -XX:+CompileTheWorld", type = OptionType.Debug)
-        public static final OptionValue<Integer> CompileTheWorldStopAt = new OptionValue<>(Integer.MAX_VALUE);
-        @Option(help = "Option value overrides to use during compile the world. For example, " +
-                       "to disable inlining and partial escape analysis specify '-PartialEscapeAnalysis -Inline'. " +
-                       "The format for each option is the same as on the command line just without the '-G:' prefix.", type = OptionType.Debug)
-        public static final OptionValue<String> CompileTheWorldConfig = new OptionValue<>(null);
-
-        @Option(help = "Run CTW using as many threads as there are processors on the system", type = OptionType.Debug)
-        public static final OptionValue<Boolean> CompileTheWorldMultiThreaded = new OptionValue<>(false);
-        @Option(help = "Number of threads to use for multithreaded CTW.  Defaults to Runtime.getRuntime().availableProcessors()", type = OptionType.Debug)
-        public static final OptionValue<Integer> CompileTheWorldThreads = new OptionValue<>(0);
-        // @formatter:on
-
-        /**
-         * Overrides {@link #CompileTheWorldStartAt} and {@link #CompileTheWorldStopAt} from
-         * {@code -XX} HotSpot options of the same name if the latter have non-default values.
-         */
-        static void overrideWithNativeOptions(HotSpotVMConfig c) {
-            if (c.compileTheWorldStartAt != 1) {
-                CompileTheWorldStartAt.setValue(c.compileTheWorldStartAt);
-            }
-            if (c.compileTheWorldStopAt != Integer.MAX_VALUE) {
-                CompileTheWorldStopAt.setValue(c.compileTheWorldStopAt);
-            }
-        }
-    }
-
-    /**
-     * A mechanism for overriding Graal options that affect compilation. A {@link Config} object
-     * should be used in a try-with-resources statement to ensure overriding of options is scoped
-     * properly. For example:
-     *
-     * <pre>
-     *     Config config = ...;
-     *     try (AutoCloseable s = config == null ? null : config.apply()) {
-     *         // perform a Graal compilation
-     *     }
-     * </pre>
-     */
-    @SuppressWarnings("serial")
-    public static class Config extends HashMap<OptionValue<?>, Object> implements OptionConsumer {
-        /**
-         * Creates a {@link Config} object by parsing a set of space separated override options.
-         *
-         * @param options a space separated set of option value settings with each option setting in
-         *            a format compatible with
-         *            {@link OptionUtils#parseOption(String, OptionConsumer)}. Ignored if null.
-         */
-        public Config(String options) {
-            if (options != null) {
-                for (String option : options.split("\\s+")) {
-                    OptionUtils.parseOption(option, this);
-                }
-            }
-        }
-
-        /**
-         * Applies the overrides represented by this object. The overrides are in effect until
-         * {@link OverrideScope#close()} is called on the returned object.
-         */
-        OverrideScope apply() {
-            return OptionValue.override(this);
-        }
-
-        public void set(OptionDescriptor desc, Object value) {
-            put(desc.getOptionValue(), value);
-        }
-    }
-
-    // Some runtime instances we need.
-    private final HotSpotGraalRuntimeProvider runtime = runtime();
-
-    /** List of Zip/Jar files to compile (see {@link Options#CompileTheWorldClasspath}). */
-    private final String files;
-
-    /** Class index to start compilation at (see {@link Options#CompileTheWorldStartAt}). */
-    private final int startAt;
-
-    /** Class index to stop compilation at (see {@link Options#CompileTheWorldStopAt}). */
-    private final int stopAt;
-
-    /** Only compile methods matching one of the filters in this array if the array is non-null. */
-    private final MethodFilter[] methodFilters;
-
-    /** Exclude methods matching one of the filters in this array if the array is non-null. */
-    private final MethodFilter[] excludeMethodFilters;
-
-    // Counters
-    private int classFileCounter = 0;
-    private AtomicLong compiledMethodsCounter = new AtomicLong();
-    private AtomicLong compileTime = new AtomicLong();
-    private AtomicLong memoryUsed = new AtomicLong();
-
-    private boolean verbose;
-    private final Config config;
-
-    /**
-     * Signal that the threads should start compiling in multithreaded mode.
-     */
-    private boolean running;
-
-    private ThreadPoolExecutor threadPool;
-
-    /**
-     * Creates a compile-the-world instance.
-     *
-     * @param files {@link File#pathSeparator} separated list of Zip/Jar files to compile
-     * @param startAt index of the class file to start compilation at
-     * @param stopAt index of the class file to stop compilation at
-     * @param methodFilters
-     * @param excludeMethodFilters
-     */
-    public CompileTheWorld(String files, Config config, int startAt, int stopAt, String methodFilters, String excludeMethodFilters, boolean verbose) {
-        this.files = files;
-        this.startAt = startAt;
-        this.stopAt = stopAt;
-        this.methodFilters = methodFilters == null || methodFilters.isEmpty() ? null : MethodFilter.parse(methodFilters);
-        this.excludeMethodFilters = excludeMethodFilters == null || excludeMethodFilters.isEmpty() ? null : MethodFilter.parse(excludeMethodFilters);
-        this.verbose = verbose;
-        this.config = config;
-
-        // We don't want the VM to exit when a method fails to compile...
-        config.putIfAbsent(ExitVMOnException, false);
-
-        // ...but we want to see exceptions.
-        config.putIfAbsent(PrintBailout, true);
-        config.putIfAbsent(PrintStackTraceOnException, true);
-    }
-
-    /**
-     * Compiles all methods in all classes in the Zip/Jar archive files in
-     * {@link Options#CompileTheWorldClasspath}. If {@link Options#CompileTheWorldClasspath}
-     * contains the magic token {@link #SUN_BOOT_CLASS_PATH} passed up from HotSpot we take the
-     * files from the boot class path.
-     */
-    public void compile() throws Throwable {
-        // By default only report statistics for the CTW threads themselves
-        if (GraalDebugConfig.DebugValueThreadFilter.hasDefaultValue()) {
-            GraalDebugConfig.DebugValueThreadFilter.setValue("^CompileTheWorld");
-        }
-
-        if (SUN_BOOT_CLASS_PATH.equals(files)) {
-            final String[] entries = System.getProperty(SUN_BOOT_CLASS_PATH).split(File.pathSeparator);
-            String bcpFiles = "";
-            for (int i = 0; i < entries.length; i++) {
-                final String entry = entries[i];
-
-                // We stop at rt.jar, unless it is the first boot class path entry.
-                if (entry.endsWith("rt.jar") && (i > 0)) {
-                    break;
-                }
-                if (i > 0) {
-                    bcpFiles += File.pathSeparator;
-                }
-                bcpFiles += entry;
-            }
-            compile(bcpFiles);
-        } else {
-            compile(files);
-        }
-    }
-
-    public void println() {
-        println("");
-    }
-
-    public void println(String format, Object... args) {
-        println(String.format(format, args));
-    }
-
-    public void println(String s) {
-        if (verbose) {
-            TTY.println(s);
-        }
-    }
-
-    /**
-     * Compiles all methods in all classes in the Zip/Jar files passed.
-     *
-     * @param fileList {@link File#pathSeparator} separated list of Zip/Jar files to compile
-     * @throws IOException
-     */
-    private void compile(String fileList) throws IOException {
-        final String[] entries = fileList.split(File.pathSeparator);
-        long start = System.currentTimeMillis();
-
-        CompilerThreadFactory factory = new CompilerThreadFactory("CompileTheWorld", new DebugConfigAccess() {
-            public GraalDebugConfig getDebugConfig() {
-                if (Debug.isEnabled() && DebugScope.getConfig() == null) {
-                    return DebugEnvironment.initialize(System.out);
-                }
-                return null;
-            }
-        });
-
-        /*
-         * Always use a thread pool, even for single threaded mode since it simplifies the use of
-         * DebugValueThreadFilter to filter on the thread names.
-         */
-        int threadCount = 1;
-        if (Options.CompileTheWorldMultiThreaded.getValue()) {
-            threadCount = Options.CompileTheWorldThreads.getValue();
-            if (threadCount == 0) {
-                threadCount = Runtime.getRuntime().availableProcessors();
-            }
-        } else {
-            running = true;
-        }
-        threadPool = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), factory);
-
-        try (OverrideScope s = config.apply()) {
-            for (int i = 0; i < entries.length; i++) {
-                final String entry = entries[i];
-
-                // For now we only compile all methods in all classes in zip/jar files.
-                if (!entry.endsWith(".zip") && !entry.endsWith(".jar")) {
-                    println("CompileTheWorld : Skipped classes in " + entry);
-                    println();
-                    continue;
-                }
-
-                if (methodFilters == null || methodFilters.length == 0) {
-                    println("CompileTheWorld : Compiling all classes in " + entry);
-                } else {
-                    String include = Arrays.asList(methodFilters).stream().map(MethodFilter::toString).collect(Collectors.joining(", "));
-                    println("CompileTheWorld : Compiling all methods in " + entry + " matching one of the following filters: " + include);
-                }
-                if (excludeMethodFilters != null && excludeMethodFilters.length > 0) {
-                    String exclude = Arrays.asList(excludeMethodFilters).stream().map(MethodFilter::toString).collect(Collectors.joining(", "));
-                    println("CompileTheWorld : Excluding all methods matching one of the following filters: " + exclude);
-                }
-                println();
-
-                URL url = new URL("jar", "", "file:" + entry + "!/");
-                ClassLoader loader = new URLClassLoader(new URL[]{url});
-
-                JarFile jarFile = new JarFile(entry);
-                Enumeration<JarEntry> e = jarFile.entries();
-
-                while (e.hasMoreElements()) {
-                    JarEntry je = e.nextElement();
-                    if (je.isDirectory() || !je.getName().endsWith(".class")) {
-                        continue;
-                    }
-
-                    // Are we done?
-                    if (classFileCounter >= stopAt) {
-                        break;
-                    }
-
-                    String className = je.getName().substring(0, je.getName().length() - ".class".length());
-                    String dottedClassName = className.replace('/', '.');
-                    classFileCounter++;
-
-                    if (methodFilters != null && !MethodFilter.matchesClassName(methodFilters, dottedClassName)) {
-                        continue;
-                    }
-                    if (excludeMethodFilters != null && MethodFilter.matchesClassName(excludeMethodFilters, dottedClassName)) {
-                        continue;
-                    }
-
-                    if (dottedClassName.startsWith("jdk.management.") || dottedClassName.startsWith("jdk.internal.cmm.*")) {
-                        continue;
-                    }
-
-                    try {
-                        // Load and initialize class
-                        Class<?> javaClass = Class.forName(dottedClassName, true, loader);
-
-                        // Pre-load all classes in the constant pool.
-                        try {
-                            HotSpotResolvedObjectType objectType = HotSpotResolvedObjectTypeImpl.fromObjectClass(javaClass);
-                            ConstantPool constantPool = objectType.constantPool();
-                            for (int cpi = 1; cpi < constantPool.length(); cpi++) {
-                                constantPool.loadReferencedType(cpi, Bytecodes.LDC);
-                            }
-                        } catch (Throwable t) {
-                            // If something went wrong during pre-loading we just ignore it.
-                            println("Preloading failed for (%d) %s: %s", classFileCounter, className, t);
-                        }
-
-                        // Are we compiling this class?
-                        MetaAccessProvider metaAccess = runtime.getHostProviders().getMetaAccess();
-                        if (classFileCounter >= startAt) {
-                            println("CompileTheWorld (%d) : %s", classFileCounter, className);
-
-                            // Compile each constructor/method in the class.
-                            for (Constructor<?> constructor : javaClass.getDeclaredConstructors()) {
-                                HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(constructor);
-                                if (canBeCompiled(javaMethod, constructor.getModifiers())) {
-                                    compileMethod(javaMethod);
-                                }
-                            }
-                            for (Method method : javaClass.getDeclaredMethods()) {
-                                HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(method);
-                                if (canBeCompiled(javaMethod, method.getModifiers())) {
-                                    compileMethod(javaMethod);
-                                }
-                            }
-                        }
-                    } catch (Throwable t) {
-                        println("CompileTheWorld (%d) : Skipping %s %s", classFileCounter, className, t.toString());
-                        t.printStackTrace();
-                    }
-                }
-                jarFile.close();
-            }
-        }
-
-        if (!running) {
-            startThreads();
-        }
-        int wakeups = 0;
-        while (threadPool.getCompletedTaskCount() != threadPool.getTaskCount()) {
-            if (wakeups % 15 == 0) {
-                TTY.println("CompileTheWorld : Waiting for " + (threadPool.getTaskCount() - threadPool.getCompletedTaskCount()) + " compiles");
-            }
-            try {
-                threadPool.awaitTermination(1, TimeUnit.SECONDS);
-                wakeups++;
-            } catch (InterruptedException e) {
-            }
-        }
-        threadPool = null;
-
-        long elapsedTime = System.currentTimeMillis() - start;
-
-        println();
-        if (Options.CompileTheWorldMultiThreaded.getValue()) {
-            TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms elapsed, %d ms compile time, %d bytes of memory used)", classFileCounter, compiledMethodsCounter.get(), elapsedTime,
-                            compileTime.get(), memoryUsed.get());
-        } else {
-            TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms, %d bytes of memory used)", classFileCounter, compiledMethodsCounter.get(), compileTime.get(), memoryUsed.get());
-        }
-    }
-
-    private synchronized void startThreads() {
-        running = true;
-        // Wake up any waiting threads
-        notifyAll();
-    }
-
-    private synchronized void waitToRun() {
-        while (!running) {
-            try {
-                wait();
-            } catch (InterruptedException e) {
-            }
-        }
-    }
-
-    class CTWCompilationTask extends CompilationTask {
-
-        CTWCompilationTask(HotSpotBackend backend, HotSpotResolvedJavaMethod method) {
-            super(backend, method, INVOCATION_ENTRY_BCI, 0L, method.allocateCompileId(INVOCATION_ENTRY_BCI), false);
-        }
-
-        /**
-         * Returns empty profiling info to be as close to the CTW behavior of C1 and C2 as possible.
-         */
-        @Override
-        protected ProfilingInfo getProfilingInfo() {
-            // Be optimistic and return false for exceptionSeen.
-            return DefaultProfilingInfo.get(TriState.FALSE);
-        }
-    }
-
-    private void compileMethod(HotSpotResolvedJavaMethod method) throws InterruptedException, ExecutionException {
-        if (methodFilters != null && !MethodFilter.matches(methodFilters, method)) {
-            return;
-        }
-        if (excludeMethodFilters != null && MethodFilter.matches(excludeMethodFilters, method)) {
-            return;
-        }
-        Future<?> task = threadPool.submit(new Runnable() {
-            public void run() {
-                waitToRun();
-                try (OverrideScope s = config.apply()) {
-                    compileMethod(method, classFileCounter);
-                }
-            }
-        });
-        if (threadPool.getCorePoolSize() == 1) {
-            task.get();
-        }
-    }
-
-    /**
-     * Compiles a method and gathers some statistics.
-     */
-    private void compileMethod(HotSpotResolvedJavaMethod method, int counter) {
-        try {
-            long start = System.currentTimeMillis();
-            long allocatedAtStart = getCurrentThreadAllocatedBytes();
-
-            HotSpotBackend backend = runtime.getHostBackend();
-            CompilationTask task = new CTWCompilationTask(backend, method);
-            task.runCompilation();
-
-            memoryUsed.getAndAdd(getCurrentThreadAllocatedBytes() - allocatedAtStart);
-            compileTime.getAndAdd(System.currentTimeMillis() - start);
-            compiledMethodsCounter.incrementAndGet();
-        } catch (Throwable t) {
-            // Catch everything and print a message
-            println("CompileTheWorld (%d) : Error compiling method: %s", counter, method.format("%H.%n(%p):%r"));
-            t.printStackTrace(TTY.cachedOut);
-        }
-    }
-
-    /**
-     * Determines if a method should be compiled (Cf. CompilationPolicy::can_be_compiled).
-     *
-     * @return true if it can be compiled, false otherwise
-     */
-    private boolean canBeCompiled(HotSpotResolvedJavaMethod javaMethod, int modifiers) {
-        if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
-            return false;
-        }
-        HotSpotVMConfig c = runtime.getConfig();
-        if (c.dontCompileHugeMethods && javaMethod.getCodeSize() > c.hugeMethodLimit) {
-            return false;
-        }
-        // Allow use of -XX:CompileCommand=dontinline to exclude problematic methods
-        if (!javaMethod.canBeInlined()) {
-            return false;
-        }
-        // Skip @Snippets for now
-        if (javaMethod.getAnnotation(Snippet.class) != null) {
-            return false;
-        }
-        return true;
-    }
-
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/DebugValuesPrinter.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/DebugValuesPrinter.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot;
 
-import static com.oracle.graal.compiler.GraalDebugConfig.*;
+import static com.oracle.jvmci.debug.JVMCIDebugConfig.*;
 
 import java.io.*;
 import java.util.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompiler.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,108 @@
+/*
+ * 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.compiler.common.GraalOptions.*;
+import static com.oracle.jvmci.code.CallingConvention.Type.*;
+import static com.oracle.jvmci.code.CodeUtil.*;
+
+import com.oracle.graal.compiler.*;
+import com.oracle.graal.hotspot.meta.*;
+import com.oracle.graal.hotspot.phases.*;
+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.phases.*;
+import com.oracle.graal.phases.OptimisticOptimizations.Optimization;
+import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
+import com.oracle.jvmci.compiler.Compiler;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.service.*;
+
+@ServiceProvider(Compiler.class)
+public class HotSpotGraalCompiler implements Compiler {
+
+    public CompilationResult compile(ResolvedJavaMethod method, int entryBCI, boolean mustRecordMethodInlining) {
+        HotSpotBackend backend = HotSpotGraalRuntime.runtime().getHostBackend();
+        HotSpotProviders providers = HotSpotGraalRuntime.runtime().getHostProviders();
+        final boolean isOSR = entryBCI != INVOCATION_ENTRY_BCI;
+
+        StructuredGraph graph = new StructuredGraph(method, entryBCI, AllowAssumptions.from(OptAssumptions.getValue()));
+        if (!mustRecordMethodInlining) {
+            graph.disableInlinedMethodRecording();
+        }
+
+        CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false);
+        if (isOSR) {
+            // for OSR, only a pointer is passed to the method.
+            JavaType[] parameterTypes = new JavaType[]{providers.getMetaAccess().lookupJavaType(long.class)};
+            CallingConvention tmp = providers.getCodeCache().getRegisterConfig().getCallingConvention(JavaCallee, providers.getMetaAccess().lookupJavaType(void.class), parameterTypes,
+                            backend.getTarget(), false);
+            cc = new CallingConvention(cc.getStackSize(), cc.getReturn(), tmp.getArgument(0));
+        }
+        Suites suites = getSuites(providers);
+        LIRSuites lirSuites = getLIRSuites(providers);
+        ProfilingInfo profilingInfo = method.getProfilingInfo(!isOSR, isOSR);
+        OptimisticOptimizations optimisticOpts = getOptimisticOpts(profilingInfo);
+        if (isOSR) {
+            // In OSR compiles, we cannot rely on never executed code profiles, because
+            // all code after the OSR loop is never executed.
+            optimisticOpts.remove(Optimization.RemoveNeverExecutedCode);
+        }
+        CompilationResult result = GraalCompiler.compileGraph(graph, cc, method, providers, backend, backend.getTarget(), getGraphBuilderSuite(providers, isOSR), optimisticOpts, profilingInfo,
+                        method.getSpeculationLog(), suites, lirSuites, new CompilationResult(), CompilationResultBuilderFactory.Default);
+
+        result.setEntryBCI(entryBCI);
+
+        if (!isOSR) {
+            ProfilingInfo profile = method.getProfilingInfo();
+            profile.setCompilerIRSize(StructuredGraph.class, graph.getNodeCount());
+        }
+
+        return result;
+    }
+
+    protected OptimisticOptimizations getOptimisticOpts(ProfilingInfo profilingInfo) {
+        return new OptimisticOptimizations(profilingInfo);
+    }
+
+    protected Suites getSuites(HotSpotProviders providers) {
+        return providers.getSuites().getDefaultSuites();
+    }
+
+    protected LIRSuites getLIRSuites(HotSpotProviders providers) {
+        return providers.getSuites().getDefaultLIRSuites();
+    }
+
+    protected PhaseSuite<HighTierContext> getGraphBuilderSuite(HotSpotProviders providers, boolean isOSR) {
+        PhaseSuite<HighTierContext> suite = HotSpotSuitesProvider.withSimpleDebugInfoIfRequested(providers.getSuites().getDefaultGraphBuilderSuite());
+        if (isOSR) {
+            suite = suite.copy();
+            suite.appendPhase(new OnStackReplacementPhase());
+        }
+        return suite;
+    }
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.hotspot;
 
-import static com.oracle.graal.compiler.GraalDebugConfig.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.Options.*;
 import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.debug.JVMCIDebugConfig.*;
 import static com.oracle.jvmci.hotspot.InitTimer.*;
 
 import java.lang.reflect.*;
@@ -38,7 +38,6 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.debug.*;
 import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.printer.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.runtime.*;
 import com.oracle.jvmci.code.*;
@@ -259,7 +258,7 @@
         }
 
         if (Debug.isEnabled()) {
-            DebugEnvironment.initialize(TTY.cachedOut);
+            DebugEnvironment.initialize(TTY.out);
 
             String summary = DebugValueSummary.getValue();
             if (summary != null) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,10 +22,6 @@
  */
 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.service.*;
 
@@ -34,16 +30,7 @@
 
     @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
@@ -53,6 +40,6 @@
 
     @Override
     public void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long jvmciEnv, int id) {
-        CompilationTask.compileMetaspaceMethod(metaspaceMethod, entryBCI, jvmciEnv, id);
+
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java	Tue Jun 09 19:07:39 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
@@ -147,4 +147,6 @@
     Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull);
 
     Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull);
+
+    void emitPrefetchAllocate(Value address);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotNodeLIRBuilder.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotNodeLIRBuilder.java	Tue Jun 09 19:07:39 2015 -0700
@@ -43,8 +43,6 @@
 
     void emitJumpToExceptionHandlerInCaller(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc);
 
-    void emitPrefetchAllocate(ValueNode address, ValueNode distance);
-
     void visitDirectCompareAndSwap(DirectCompareAndSwapNode x);
 
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java	Tue Jun 09 19:07:39 2015 -0700
@@ -378,7 +378,7 @@
         if (Options.TimedDynamicCounters.getValue() > 0) {
             Thread thread = new Thread() {
                 long lastTime = System.nanoTime();
-                PrintStream out = TTY.cachedOut;
+                PrintStream out = TTY.out;
 
                 @Override
                 public void run() {
@@ -405,7 +405,7 @@
 
     public static void shutdown(CompilerToVM compilerToVM, long compilerStartTime) {
         if (Options.GenericDynamicCounters.getValue()) {
-            dump(TTY.cachedOut, (System.nanoTime() - compilerStartTime) / 1000000000d, compilerToVM.collectCounters(), 100);
+            dump(TTY.out, (System.nanoTime() - compilerStartTime) / 1000000000d, compilerToVM.collectCounters(), 100);
         }
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,23 +22,11 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-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.*;
 import static com.oracle.graal.hotspot.replacements.NewObjectSnippets.*;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 
 import java.lang.ref.*;
 
@@ -56,12 +44,15 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
+import com.oracle.graal.nodes.memory.address.*;
 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.code.*;
 import com.oracle.jvmci.common.*;
 import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * HotSpot implementation of {@link LoweringProvider}.
@@ -155,9 +146,9 @@
             if (graph.getGuardsStage().areFrameStatesAtDeopts()) {
                 newObjectSnippets.lower((VerifyHeapNode) n, registers, runtime, tool);
             }
-        } else if (n instanceof MonitorEnterNode) {
+        } else if (n instanceof RawMonitorEnterNode) {
             if (graph.getGuardsStage().areFrameStatesAtDeopts()) {
-                monitorSnippets.lower((MonitorEnterNode) n, registers, tool);
+                monitorSnippets.lower((RawMonitorEnterNode) n, registers, tool);
             }
         } else if (n instanceof MonitorExitNode) {
             if (graph.getGuardsStage().areFrameStatesAtDeopts()) {
@@ -212,9 +203,9 @@
             return;
         }
         StructuredGraph graph = n.graph();
-        LocationNode location = graph.unique(new ConstantLocationNode(KLASS_LAYOUT_HELPER_LOCATION, runtime.getConfig().klassLayoutHelperOffset));
         assert !n.getHub().isConstant();
-        graph.replaceFloating(n, graph.unique(new FloatingReadNode(n.getHub(), location, null, n.stamp(), n.getGuard(), BarrierType.NONE)));
+        AddressNode address = createOffsetAddress(graph, n.getHub(), runtime.getConfig().klassLayoutHelperOffset);
+        graph.replaceFloating(n, graph.unique(new FloatingReadNode(address, KLASS_LAYOUT_HELPER_LOCATION, null, n.stamp(), n.getGuard(), BarrierType.NONE)));
     }
 
     private void lowerHubGetClassNode(HubGetClassNode n, LoweringTool tool) {
@@ -223,9 +214,9 @@
         }
 
         StructuredGraph graph = n.graph();
-        LocationNode location = graph.unique(new ConstantLocationNode(CLASS_MIRROR_LOCATION, runtime.getConfig().classMirrorOffset));
         assert !n.getHub().isConstant();
-        FloatingReadNode read = graph.unique(new FloatingReadNode(n.getHub(), location, null, n.stamp(), n.getGuard(), BarrierType.NONE));
+        AddressNode address = createOffsetAddress(graph, n.getHub(), runtime.getConfig().classMirrorOffset);
+        FloatingReadNode read = graph.unique(new FloatingReadNode(address, CLASS_MIRROR_LOCATION, null, n.stamp(), n.getGuard(), BarrierType.NONE));
         graph.replaceFloating(n, read);
     }
 
@@ -235,9 +226,9 @@
         }
 
         StructuredGraph graph = n.graph();
-        LocationNode location = graph.unique(new ConstantLocationNode(CLASS_KLASS_LOCATION, runtime.getConfig().klassOffset));
         assert !n.getValue().isConstant();
-        FloatingReadNode read = graph.unique(new FloatingReadNode(n.getValue(), location, null, n.stamp(), n.getGuard(), BarrierType.NONE));
+        AddressNode address = createOffsetAddress(graph, n.getValue(), runtime.getConfig().klassOffset);
+        FloatingReadNode read = graph.unique(new FloatingReadNode(address, CLASS_KLASS_LOCATION, null, n.stamp(), n.getGuard(), BarrierType.NONE));
         graph.replaceFloating(n, read);
     }
 
@@ -266,8 +257,8 @@
                     // compiled code entry as HotSpot does not guarantee they are final
                     // values.
                     int methodCompiledEntryOffset = runtime.getConfig().methodCompiledEntryOffset;
-                    ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, graph.unique(new ConstantLocationNode(any(), methodCompiledEntryOffset)), StampFactory.forKind(wordKind),
-                                    BarrierType.NONE));
+                    AddressNode address = createOffsetAddress(graph, metaspaceMethod, methodCompiledEntryOffset);
+                    ReadNode compiledEntry = graph.add(new ReadNode(address, any(), StampFactory.forKind(wordKind), BarrierType.NONE));
 
                     loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(),
                                     CallingConvention.Type.JavaCall, callTarget.invokeKind()));
@@ -318,12 +309,12 @@
 
     @Override
     protected ValueNode createReadArrayComponentHub(StructuredGraph graph, ValueNode arrayHub, FixedNode anchor) {
-        LocationNode location = graph.unique(new ConstantLocationNode(OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION, runtime.getConfig().arrayClassElementOffset));
         /*
          * Anchor the read of the element klass to the cfg, because it is only valid when arrayClass
          * is an object class, which might not be the case in other parts of the compiled method.
          */
-        return graph.unique(new FloatingReadNode(arrayHub, location, null, KlassPointerStamp.klassNonNull(), AbstractBeginNode.prevBegin(anchor)));
+        AddressNode address = createOffsetAddress(graph, arrayHub, runtime.getConfig().arrayClassElementOffset);
+        return graph.unique(new FloatingReadNode(address, OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION, null, KlassPointerStamp.klassNonNull(), AbstractBeginNode.prevBegin(anchor)));
     }
 
     @Override
@@ -336,7 +327,7 @@
         }
     }
 
-    private static void lowerLoadMethodNode(LoadMethodNode loadMethodNode) {
+    private void lowerLoadMethodNode(LoadMethodNode loadMethodNode) {
         StructuredGraph graph = loadMethodNode.graph();
         HotSpotResolvedJavaMethod method = (HotSpotResolvedJavaMethod) loadMethodNode.getMethod();
         ReadNode metaspaceMethod = createReadVirtualMethod(graph, loadMethodNode.getHub(), method, loadMethodNode.getReceiverType());
@@ -386,8 +377,8 @@
             for (OSRLocalNode osrLocal : graph.getNodes(OSRLocalNode.TYPE)) {
                 int size = osrLocal.getKind().getSlotCount();
                 int offset = localsOffset - (osrLocal.index() + size - 1) * 8;
-                IndexedLocationNode location = graph.unique(new IndexedLocationNode(any(), offset, ConstantNode.forLong(0, graph), 1));
-                ReadNode load = graph.add(new ReadNode(buffer, location, osrLocal.stamp(), BarrierType.NONE));
+                AddressNode address = createOffsetAddress(graph, buffer, offset);
+                ReadNode load = graph.add(new ReadNode(address, any(), osrLocal.stamp(), BarrierType.NONE));
                 osrLocal.replaceAndDelete(load);
                 graph.addBeforeFixed(migrationEnd, load);
             }
@@ -455,23 +446,23 @@
         return false;
     }
 
-    private static ReadNode createReadVirtualMethod(StructuredGraph graph, ValueNode hub, HotSpotResolvedJavaMethod method, ResolvedJavaType receiverType) {
+    private ReadNode createReadVirtualMethod(StructuredGraph graph, ValueNode hub, HotSpotResolvedJavaMethod method, ResolvedJavaType receiverType) {
         return createReadVirtualMethod(graph, hub, method.vtableEntryOffset(receiverType));
     }
 
-    private static ReadNode createReadVirtualMethod(StructuredGraph graph, ValueNode hub, int vtableEntryOffset) {
+    private ReadNode createReadVirtualMethod(StructuredGraph graph, ValueNode hub, int vtableEntryOffset) {
         assert vtableEntryOffset > 0;
         // We use LocationNode.ANY_LOCATION for the reads that access the vtable
         // entry as HotSpot does not guarantee that this is a final value.
         Stamp methodStamp = MethodPointerStamp.method();
-        ReadNode metaspaceMethod = graph.add(new ReadNode(hub, graph.unique(new ConstantLocationNode(any(), vtableEntryOffset)), methodStamp, BarrierType.NONE));
+        AddressNode address = createOffsetAddress(graph, hub, vtableEntryOffset);
+        ReadNode metaspaceMethod = graph.add(new ReadNode(address, any(), methodStamp, BarrierType.NONE));
         return metaspaceMethod;
     }
 
     @Override
     protected ValueNode createReadHub(StructuredGraph graph, ValueNode object, GuardingNode guard) {
         HotSpotVMConfig config = runtime.getConfig();
-        LocationNode location = graph.unique(new ConstantLocationNode(HUB_LOCATION, config.hubOffset));
         assert !object.isConstant() || object.isNullConstant();
 
         KlassPointerStamp hubStamp = KlassPointerStamp.klassNonNull();
@@ -479,7 +470,8 @@
             hubStamp = hubStamp.compressed(config.getKlassEncoding());
         }
 
-        FloatingReadNode memoryRead = graph.unique(new FloatingReadNode(object, location, null, hubStamp, guard, BarrierType.NONE));
+        AddressNode address = createOffsetAddress(graph, object, config.hubOffset);
+        FloatingReadNode memoryRead = graph.unique(new FloatingReadNode(address, HUB_LOCATION, null, hubStamp, guard, BarrierType.NONE));
         if (config.useCompressedClassPointers) {
             return CompressionNode.uncompress(memoryRead, config.getKlassEncoding());
         } else {
@@ -489,7 +481,6 @@
 
     private WriteNode createWriteHub(StructuredGraph graph, ValueNode object, ValueNode value) {
         HotSpotVMConfig config = runtime.getConfig();
-        LocationNode location = graph.unique(new ConstantLocationNode(HUB_WRITE_LOCATION, config.hubOffset));
         assert !object.isConstant() || object.asConstant().isDefaultForKind();
 
         ValueNode writeValue = value;
@@ -497,7 +488,8 @@
             writeValue = CompressionNode.compress(value, config.getKlassEncoding());
         }
 
-        return graph.add(new WriteNode(object, writeValue, location, BarrierType.NONE));
+        AddressNode address = createOffsetAddress(graph, object, config.hubOffset);
+        return graph.add(new WriteNode(address, HUB_WRITE_LOCATION, writeValue, BarrierType.NONE));
     }
 
     @Override
@@ -539,4 +531,13 @@
     protected LocationIdentity initLocationIdentity() {
         return INIT_LOCATION;
     }
+
+    @Override
+    public int getSizeInBytes(Stamp stamp) {
+        if (stamp instanceof NarrowOopStamp || (stamp instanceof KlassPointerStamp && ((KlassPointerStamp) stamp).isCompressed())) {
+            return Kind.Int.getByteCount();
+        } else {
+            return super.getSizeInBytes(stamp);
+        }
+    }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,13 +22,6 @@
  */
 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.*;
 import static com.oracle.graal.java.BytecodeParser.Options.*;
@@ -48,13 +41,15 @@
 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.BarrierType;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 import com.oracle.jvmci.options.*;
 
 /**
@@ -214,9 +209,10 @@
         r.register0("currentThread", new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
                 CurrentJavaThreadNode thread = b.add(new CurrentJavaThreadNode(wordTypes.getWordKind()));
-                ConstantLocationNode location = b.add(new ConstantLocationNode(JAVA_THREAD_THREAD_OBJECT_LOCATION, config.threadObjectOffset));
                 boolean compressible = false;
-                ValueNode javaThread = WordOperationPlugin.readOp(b, Kind.Object, thread, location, BarrierType.NONE, compressible);
+                ValueNode offset = b.add(ConstantNode.forLong(config.threadObjectOffset));
+                AddressNode address = b.add(new OffsetAddressNode(thread, offset));
+                ValueNode javaThread = WordOperationPlugin.readOp(b, Kind.Object, address, JAVA_THREAD_THREAD_OBJECT_LOCATION, BarrierType.NONE, compressible);
                 boolean exactType = compressible;
                 boolean nonNull = true;
                 b.addPush(Kind.Object, new PiNode(javaThread, metaAccess.lookupJavaType(Thread.class), exactType, nonNull));
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoweringProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoweringProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, 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,12 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * HotSpot implementation of {@link LoweringProvider}.
@@ -39,7 +38,7 @@
 
     int arrayScalingFactor(Kind kind);
 
-    IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index, boolean initialization);
+    AddressNode createArrayAddress(StructuredGraph graph, ValueNode array, Kind elementKind, ValueNode index);
 
     Stamp loadStamp(Stamp stamp, Kind kind);
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -34,6 +34,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.*;
+import com.oracle.graal.phases.common.*;
+import com.oracle.graal.phases.common.AddressLoweringPhase.AddressLowering;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.jvmci.hotspot.*;
 import com.oracle.jvmci.options.*;
@@ -49,6 +51,8 @@
     private final DerivedOptionValue<LIRSuites> defaultLIRSuites;
     protected final HotSpotGraalRuntimeProvider runtime;
 
+    private final AddressLowering addressLowering;
+
     private class SuitesSupplier implements OptionSupplier<Suites> {
 
         private static final long serialVersionUID = -3444304453553320390L;
@@ -69,8 +73,9 @@
 
     }
 
-    public HotSpotSuitesProvider(HotSpotGraalRuntimeProvider runtime, Plugins plugins) {
+    public HotSpotSuitesProvider(HotSpotGraalRuntimeProvider runtime, Plugins plugins, AddressLowering addressLowering) {
         this.runtime = runtime;
+        this.addressLowering = addressLowering;
         this.defaultGraphBuilderSuite = createGraphBuilderSuite(plugins);
         this.defaultSuites = new DerivedOptionValue<>(new SuitesSupplier());
         this.defaultLIRSuites = new DerivedOptionValue<>(new LIRSuitesSupplier());
@@ -100,6 +105,8 @@
             ret.getMidTier().appendPhase(new WriteBarrierVerificationPhase());
         }
 
+        ret.getLowTier().findPhase(ExpandLogicPhase.class).add(new AddressLoweringPhase(addressLowering));
+
         return ret;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotWordOperationPlugin.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotWordOperationPlugin.java	Tue Jun 09 19:07:39 2015 -0700
@@ -35,10 +35,10 @@
 import com.oracle.graal.hotspot.word.HotSpotOperation.HotspotOpcode;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
@@ -126,13 +126,15 @@
             case READ_KLASS_POINTER:
                 assert args.length == 2 || args.length == 3;
                 Stamp readStamp = KlassPointerStamp.klass();
-                LocationNode location;
+                AddressNode address = makeAddress(b, args[0], args[1]);
+                LocationIdentity location;
                 if (args.length == 2) {
-                    location = makeLocation(b, args[1], any());
+                    location = any();
                 } else {
-                    location = makeLocation(b, args[1], args[2]);
+                    assert args[2].isConstant();
+                    location = snippetReflection.asObject(LocationIdentity.class, args[2].asJavaConstant());
                 }
-                ReadNode read = b.add(new ReadNode(args[0], location, readStamp, BarrierType.NONE));
+                ReadNode read = b.add(new ReadNode(address, location, readStamp, BarrierType.NONE));
                 /*
                  * The read must not float outside its block otherwise it may float above an
                  * explicit zero check on its base address.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ArrayRangeWriteBarrier.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ArrayRangeWriteBarrier.java	Tue Jun 09 19:07:39 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,23 +22,31 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+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.*;
 
 @NodeInfo
-public abstract class ArrayRangeWriteBarrier extends WriteBarrier {
+public abstract class ArrayRangeWriteBarrier extends FixedWithNextNode implements Lowerable {
 
     public static final NodeClass<ArrayRangeWriteBarrier> TYPE = NodeClass.create(ArrayRangeWriteBarrier.class);
+    @Input ValueNode object;
     @Input ValueNode startIndex;
     @Input ValueNode length;
 
     protected ArrayRangeWriteBarrier(NodeClass<? extends ArrayRangeWriteBarrier> c, ValueNode object, ValueNode startIndex, ValueNode length) {
-        super(c, object, null, null, true);
+        super(c, StampFactory.forVoid());
+        this.object = object;
         this.startIndex = startIndex;
         this.length = length;
     }
 
+    public ValueNode getObject() {
+        return object;
+    }
+
     public ValueNode getStartIndex() {
         return startIndex;
     }
@@ -46,4 +54,10 @@
     public ValueNode getLength() {
         return length;
     }
+
+    @Override
+    public void lower(LoweringTool tool) {
+        assert graph().getGuardsStage().areFrameStatesAtDeopts();
+        tool.getLowerer().lower(this, tool);
+    }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -154,6 +154,10 @@
         throw JVMCIError.shouldNotReachHere(String.format("Unexpected input stamp %s", input));
     }
 
+    public CompressionOp getOp() {
+        return op;
+    }
+
     public CompressEncoding getEncoding() {
         return encoding;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -29,41 +29,36 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.graal.nodes.memory.address.AddressNode.Address;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.word.*;
 
 /**
  * A special purpose store node that differs from {@link CompareAndSwapNode} in that it is not a
- * {@link StateSplit} and it
- * {@linkplain #compareAndSwap(Object, long, Word, Word, LocationIdentity)} returns either the
- * expected value or the compared against value instead of a boolean.
+ * {@link StateSplit} and it {@linkplain #compareAndSwap(Address, Word, Word, LocationIdentity)}
+ * returns either the expected value or the compared against value instead of a boolean.
  */
 @NodeInfo(allowedUsageTypes = {InputType.Memory})
 public final class DirectCompareAndSwapNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Single {
 
     public static final NodeClass<DirectCompareAndSwapNode> TYPE = NodeClass.create(DirectCompareAndSwapNode.class);
-    @Input ValueNode object;
-    @Input ValueNode offset;
+    @Input(InputType.Association) AddressNode address;
     @Input ValueNode expectedValue;
     @Input ValueNode newValue;
 
     protected final LocationIdentity locationIdentity;
 
-    public DirectCompareAndSwapNode(ValueNode object, ValueNode offset, ValueNode expected, ValueNode newValue, LocationIdentity locationIdentity) {
+    public DirectCompareAndSwapNode(ValueNode address, ValueNode expected, ValueNode newValue, LocationIdentity locationIdentity) {
         super(TYPE, expected.stamp());
-        this.object = object;
-        this.offset = offset;
+        this.address = (AddressNode) address;
         this.expectedValue = expected;
         this.newValue = newValue;
         this.locationIdentity = locationIdentity;
     }
 
-    public ValueNode object() {
-        return object;
-    }
-
-    public ValueNode offset() {
-        return offset;
+    public AddressNode getAddress() {
+        return address;
     }
 
     public ValueNode expectedValue() {
@@ -85,17 +80,16 @@
     }
 
     /**
-     * Compares an expected value with the actual value in a location denoted by an object and a
-     * given offset. Iff they are same, {@code newValue} is placed into the location and the
-     * {@code expectedValue} is returned. Otherwise, the actual value is returned. All of the above
-     * is performed in one atomic hardware transaction.
+     * Compares an expected value with the actual value in a location denoted by an address. Iff
+     * they are same, {@code newValue} is placed into the location and the {@code expectedValue} is
+     * returned. Otherwise, the actual value is returned. All of the above is performed in one
+     * atomic hardware transaction.
      *
-     * @param object the object containing a field to be atomically tested and updated
-     * @param offset offset from {@code object} of the field
+     * @param address the address to be atomically tested and updated
      * @param expectedValue if this value is currently in the field, perform the swap
      * @param newValue the new value to put into the field
      * @return either {@code expectedValue} or the actual value
      */
     @NodeIntrinsic
-    public static native Word compareAndSwap(Object object, long offset, Word expectedValue, Word newValue, @ConstantNodeParameter LocationIdentity locationIdentity);
+    public static native Word compareAndSwap(Address address, Word expectedValue, Word newValue, @ConstantNodeParameter LocationIdentity locationIdentity);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PostWriteBarrier.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PostWriteBarrier.java	Tue Jun 09 19:07:39 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
@@ -25,7 +25,7 @@
 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.address.*;
 
 @NodeInfo
 public class G1PostWriteBarrier extends WriteBarrier {
@@ -33,12 +33,12 @@
     public static final NodeClass<G1PostWriteBarrier> TYPE = NodeClass.create(G1PostWriteBarrier.class);
     protected final boolean alwaysNull;
 
-    public G1PostWriteBarrier(ValueNode object, ValueNode value, LocationNode location, boolean precise, boolean alwaysNull) {
-        this(TYPE, object, value, location, precise, alwaysNull);
+    public G1PostWriteBarrier(AddressNode address, ValueNode value, boolean precise, boolean alwaysNull) {
+        this(TYPE, address, value, precise, alwaysNull);
     }
 
-    protected G1PostWriteBarrier(NodeClass<? extends G1PostWriteBarrier> c, ValueNode object, ValueNode value, LocationNode location, boolean precise, boolean alwaysNull) {
-        super(c, object, value, location, precise);
+    protected G1PostWriteBarrier(NodeClass<? extends G1PostWriteBarrier> c, AddressNode address, ValueNode value, boolean precise, boolean alwaysNull) {
+        super(c, address, value, precise);
         this.alwaysNull = alwaysNull;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PreWriteBarrier.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PreWriteBarrier.java	Tue Jun 09 19:07:39 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
@@ -25,7 +25,7 @@
 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.address.*;
 
 @NodeInfo
 public final class G1PreWriteBarrier extends WriteBarrier implements DeoptimizingNode.DeoptBefore {
@@ -36,8 +36,8 @@
     protected final boolean nullCheck;
     protected final boolean doLoad;
 
-    public G1PreWriteBarrier(ValueNode object, ValueNode expectedObject, LocationNode location, boolean doLoad, boolean nullCheck) {
-        super(TYPE, object, expectedObject, location, true);
+    public G1PreWriteBarrier(AddressNode address, ValueNode expectedObject, boolean doLoad, boolean nullCheck) {
+        super(TYPE, address, expectedObject, true);
         this.doLoad = doLoad;
         this.nullCheck = nullCheck;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ReferentFieldReadBarrier.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ReferentFieldReadBarrier.java	Tue Jun 09 19:07:39 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
@@ -25,7 +25,7 @@
 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.address.*;
 
 /**
  * The {@code G1ReferentFieldReadBarrier} is added when a read access is performed to the referent
@@ -39,8 +39,8 @@
 
     protected final boolean doLoad;
 
-    public G1ReferentFieldReadBarrier(ValueNode object, ValueNode expectedObject, LocationNode location, boolean doLoad) {
-        super(TYPE, object, expectedObject, location, true);
+    public G1ReferentFieldReadBarrier(AddressNode address, ValueNode expectedObject, boolean doLoad) {
+        super(TYPE, address, expectedObject, true);
         this.doLoad = doLoad;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PrefetchAllocateNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PrefetchAllocateNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -28,27 +28,26 @@
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.graal.nodes.memory.address.AddressNode.Address;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.word.*;
 
 @NodeInfo
 public final class PrefetchAllocateNode extends FixedWithNextNode implements LIRLowerable {
 
     public static final NodeClass<PrefetchAllocateNode> TYPE = NodeClass.create(PrefetchAllocateNode.class);
-    @Input ValueNode distance;
-    @Input ValueNode address;
+    @Input(InputType.Association) AddressNode address;
 
-    public PrefetchAllocateNode(ValueNode address, ValueNode distance) {
+    public PrefetchAllocateNode(ValueNode address) {
         super(TYPE, StampFactory.forVoid());
-        this.address = address;
-        this.distance = distance;
+        this.address = (AddressNode) address;
     }
 
     @Override
     public void generate(NodeLIRBuilderTool gen) {
-        ((HotSpotNodeLIRBuilder) gen).emitPrefetchAllocate(address, distance);
+        ((HotSpotLIRGenerator) gen.getLIRGeneratorTool()).emitPrefetchAllocate(gen.operand(address));
     }
 
     @NodeIntrinsic
-    public static native void prefetch(Word address, Word distance);
+    public static native void prefetch(Address address);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialWriteBarrier.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialWriteBarrier.java	Tue Jun 09 19:07:39 2015 -0700
@@ -24,19 +24,18 @@
 
 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.address.*;
 
 @NodeInfo
 public class SerialWriteBarrier extends WriteBarrier {
 
     public static final NodeClass<SerialWriteBarrier> TYPE = NodeClass.create(SerialWriteBarrier.class);
 
-    public SerialWriteBarrier(ValueNode object, LocationNode location, boolean precise) {
-        this(TYPE, object, location, precise);
+    public SerialWriteBarrier(AddressNode address, boolean precise) {
+        this(TYPE, address, precise);
     }
 
-    protected SerialWriteBarrier(NodeClass<? extends SerialWriteBarrier> c, ValueNode object, LocationNode location, boolean precise) {
-        super(c, object, null, location, precise);
+    protected SerialWriteBarrier(NodeClass<? extends SerialWriteBarrier> c, AddressNode address, boolean precise) {
+        super(c, address, null, precise);
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java	Tue Jun 09 19:07:39 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
@@ -26,23 +26,21 @@
 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.address.*;
 import com.oracle.graal.nodes.spi.*;
 
 @NodeInfo
 public abstract class WriteBarrier extends FixedWithNextNode implements Lowerable {
 
     public static final NodeClass<WriteBarrier> TYPE = NodeClass.create(WriteBarrier.class);
-    @Input protected ValueNode object;
+    @Input(InputType.Association) protected AddressNode address;
     @OptionalInput protected ValueNode value;
-    @OptionalInput(InputType.Association) protected LocationNode location;
     protected final boolean precise;
 
-    protected WriteBarrier(NodeClass<? extends WriteBarrier> c, ValueNode object, ValueNode value, LocationNode location, boolean precise) {
+    protected WriteBarrier(NodeClass<? extends WriteBarrier> c, AddressNode address, ValueNode value, boolean precise) {
         super(c, StampFactory.forVoid());
-        this.object = object;
+        this.address = address;
         this.value = value;
-        this.location = location;
         this.precise = precise;
     }
 
@@ -50,12 +48,8 @@
         return value;
     }
 
-    public ValueNode getObject() {
-        return object;
-    }
-
-    public LocationNode getLocation() {
-        return location;
+    public AddressNode getAddress() {
+        return address;
     }
 
     public boolean usePrecise() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -34,8 +34,8 @@
 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.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
@@ -74,8 +74,8 @@
 
                 if (type instanceof HotSpotResolvedObjectType) {
                     ConstantNode klass = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), ((HotSpotResolvedObjectType) type).klass(), metaAccess, graph);
-                    LocationNode location = graph.unique(new ConstantLocationNode(CLASS_MIRROR_LOCATION, classMirrorOffset));
-                    ValueNode read = graph.unique(new FloatingReadNode(klass, location, null, stamp));
+                    AddressNode address = graph.unique(new OffsetAddressNode(klass, ConstantNode.forLong(classMirrorOffset, graph)));
+                    ValueNode read = graph.unique(new FloatingReadNode(address, CLASS_MIRROR_LOCATION, null, stamp));
 
                     if (((HotSpotObjectConstant) constant).isCompressed()) {
                         return CompressionNode.compress(read, oopEncoding);
@@ -102,11 +102,11 @@
                         throw new JVMCIError("Can't find TYPE field in class");
                     }
 
-                    LocationNode location = graph.unique(new ConstantLocationNode(FINAL_LOCATION, typeField.offset()));
                     if (oopEncoding != null) {
                         stamp = NarrowOopStamp.compressed((AbstractObjectStamp) stamp, oopEncoding);
                     }
-                    ValueNode read = graph.unique(new FloatingReadNode(clazz, location, null, stamp));
+                    AddressNode address = graph.unique(new OffsetAddressNode(clazz, ConstantNode.forLong(typeField.offset(), graph)));
+                    ValueNode read = graph.unique(new FloatingReadNode(address, FINAL_LOCATION, null, stamp));
 
                     if (oopEncoding == null || ((HotSpotObjectConstant) constant).isCompressed()) {
                         return read;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,7 +22,6 @@
  */
 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.graph.*;
@@ -34,14 +33,16 @@
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
+import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.compiler.Compiler;
 import com.oracle.jvmci.debug.*;
 
 public class OnStackReplacementPhase extends Phase {
 
     @Override
     protected void run(StructuredGraph graph) {
-        if (graph.getEntryBCI() == StructuredGraph.INVOCATION_ENTRY_BCI) {
+        if (graph.getEntryBCI() == Compiler.INVOCATION_ENTRY_BCI) {
             // This happens during inlining in a OSR method, because the same phase plan will be
             // used.
             return;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -29,6 +29,7 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.phases.*;
 import com.oracle.jvmci.common.*;
@@ -66,34 +67,33 @@
     private void addReadNodeBarriers(ReadNode node, StructuredGraph graph) {
         if (node.getBarrierType() == BarrierType.PRECISE) {
             assert config.useG1GC;
-            G1ReferentFieldReadBarrier barrier = graph.add(new G1ReferentFieldReadBarrier(node.object(), node, node.location(), false));
+            G1ReferentFieldReadBarrier barrier = graph.add(new G1ReferentFieldReadBarrier(node.getAddress(), node, false));
             graph.addAfterFixed(node, barrier);
         } else {
             assert node.getBarrierType() == BarrierType.NONE : "Non precise read barrier has been attached to read node.";
         }
     }
 
-    protected static void addG1PreWriteBarrier(FixedAccessNode node, ValueNode object, ValueNode value, LocationNode location, boolean doLoad, boolean nullCheck, StructuredGraph graph) {
-        G1PreWriteBarrier preBarrier = graph.add(new G1PreWriteBarrier(object, value, location, doLoad, nullCheck));
+    protected static void addG1PreWriteBarrier(FixedAccessNode node, AddressNode address, ValueNode value, boolean doLoad, boolean nullCheck, StructuredGraph graph) {
+        G1PreWriteBarrier preBarrier = graph.add(new G1PreWriteBarrier(address, value, doLoad, nullCheck));
         preBarrier.setStateBefore(node.stateBefore());
         node.setNullCheck(false);
         node.setStateBefore(null);
         graph.addBeforeFixed(node, preBarrier);
     }
 
-    protected void addG1PostWriteBarrier(FixedAccessNode node, ValueNode object, ValueNode value, LocationNode location, boolean precise, StructuredGraph graph) {
+    protected void addG1PostWriteBarrier(FixedAccessNode node, AddressNode address, ValueNode value, boolean precise, StructuredGraph graph) {
         final boolean alwaysNull = StampTool.isPointerAlwaysNull(value);
-        graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(object, value, location, precise, alwaysNull)));
+        graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(address, value, precise, alwaysNull)));
     }
 
-    protected void addSerialPostWriteBarrier(FixedAccessNode node, ValueNode object, ValueNode value, LocationNode location, boolean precise, StructuredGraph graph) {
+    protected void addSerialPostWriteBarrier(FixedAccessNode node, AddressNode address, ValueNode value, boolean precise, StructuredGraph graph) {
         final boolean alwaysNull = StampTool.isPointerAlwaysNull(value);
         if (alwaysNull) {
             // Serial barrier isn't needed for null value
             return;
         }
-        final LocationNode loc = (precise ? location : null);
-        graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(object, loc, precise)));
+        graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(address, precise)));
     }
 
     private void addWriteNodeBarriers(WriteNode node, StructuredGraph graph) {
@@ -107,11 +107,11 @@
                 boolean precise = barrierType == BarrierType.PRECISE;
                 if (config.useG1GC) {
                     if (!node.isInitialization()) {
-                        addG1PreWriteBarrier(node, node.object(), null, node.location(), true, node.getNullCheck(), graph);
+                        addG1PreWriteBarrier(node, node.getAddress(), null, true, node.getNullCheck(), graph);
                     }
-                    addG1PostWriteBarrier(node, node.object(), node.value(), node.location(), precise, graph);
+                    addG1PostWriteBarrier(node, node.getAddress(), node.value(), precise, graph);
                 } else {
-                    addSerialPostWriteBarrier(node, node.object(), node.value(), node.location(), precise, graph);
+                    addSerialPostWriteBarrier(node, node.getAddress(), node.value(), precise, graph);
                 }
                 break;
             default:
@@ -129,10 +129,10 @@
             case PRECISE:
                 boolean precise = barrierType == BarrierType.PRECISE;
                 if (config.useG1GC) {
-                    addG1PreWriteBarrier(node, node.object(), null, node.location(), true, node.getNullCheck(), graph);
-                    addG1PostWriteBarrier(node, node.object(), node.getNewValue(), node.location(), precise, graph);
+                    addG1PreWriteBarrier(node, node.getAddress(), null, true, node.getNullCheck(), graph);
+                    addG1PostWriteBarrier(node, node.getAddress(), node.getNewValue(), precise, graph);
                 } else {
-                    addSerialPostWriteBarrier(node, node.object(), node.getNewValue(), node.location(), precise, graph);
+                    addSerialPostWriteBarrier(node, node.getAddress(), node.getNewValue(), precise, graph);
                 }
                 break;
             default:
@@ -150,10 +150,10 @@
             case PRECISE:
                 boolean precise = barrierType == BarrierType.PRECISE;
                 if (config.useG1GC) {
-                    addG1PreWriteBarrier(node, node.object(), node.getExpectedValue(), node.location(), false, false, graph);
-                    addG1PostWriteBarrier(node, node.object(), node.getNewValue(), node.location(), precise, graph);
+                    addG1PreWriteBarrier(node, node.getAddress(), node.getExpectedValue(), false, false, graph);
+                    addG1PostWriteBarrier(node, node.getAddress(), node.getNewValue(), precise, graph);
                 } else {
-                    addSerialPostWriteBarrier(node, node.object(), node.getNewValue(), node.location(), precise, graph);
+                    addSerialPostWriteBarrier(node, node.getAddress(), node.getNewValue(), precise, graph);
                 }
                 break;
             default:
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -35,6 +35,7 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.phases.*;
 import com.oracle.jvmci.common.*;
@@ -151,9 +152,11 @@
 
     private static boolean validateBarrier(FixedAccessNode write, WriteBarrier barrier) {
         assert write instanceof WriteNode || write instanceof LoweredCompareAndSwapNode || write instanceof LoweredAtomicReadAndWriteNode : "Node must be of type requiring a write barrier " + write;
-        if ((barrier.getObject() == write.object()) && (!barrier.usePrecise() || (barrier.usePrecise() && barrier.getLocation() == write.location()))) {
-            return true;
+        if (!barrier.usePrecise()) {
+            if (barrier.getAddress() instanceof OffsetAddressNode && write.getAddress() instanceof OffsetAddressNode) {
+                return ((OffsetAddressNode) barrier.getAddress()).getBase() == ((OffsetAddressNode) write.getAddress()).getBase();
+            }
         }
-        return false;
+        return barrier.getAddress() == write.getAddress();
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,11 +22,6 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-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.*;
@@ -37,14 +32,16 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Read {@code Class::_klass} to get the hub for a {@link java.lang.Class}. This node mostly exists
  * to replace {@code _klass._java_mirror._klass} with {@code _klass}. The constant folding could be
  * handled by
- * {@link ReadNode#canonicalizeRead(ValueNode, LocationNode, ValueNode, CanonicalizerTool)}.
+ * {@link ReadNode#canonicalizeRead(ValueNode, AddressNode, LocationIdentity, CanonicalizerTool)}.
  */
 @NodeInfo
 public final class ClassGetHubNode extends FloatingGuardedNode implements Lowerable, Canonicalizable, ConvertNode {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java	Tue Jun 09 19:07:39 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
@@ -46,6 +46,7 @@
 import java.util.*;
 
 import com.oracle.graal.api.replacements.*;
+import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.graph.iterators.*;
@@ -57,6 +58,7 @@
 import com.oracle.graal.nodes.debug.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.phases.common.inlining.*;
@@ -107,15 +109,10 @@
     public static final boolean CHECK_BALANCED_MONITORS = Boolean.getBoolean("graal.monitors.checkBalanced");
 
     @Snippet
-    public static void monitorenter(Object object, @ConstantParameter int lockDepth, @ConstantParameter Register threadRegister, @ConstantParameter Register stackPointerRegister,
+    public static void monitorenter(Object object, KlassPointer hub, @ConstantParameter int lockDepth, @ConstantParameter Register threadRegister, @ConstantParameter Register stackPointerRegister,
                     @ConstantParameter boolean trace) {
         verifyOop(object);
 
-        if (object == null) {
-            DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException);
-        }
-        GuardingNode anchorNode = SnippetAnchorNode.anchor();
-
         // Load the mark word - this includes a null-check on object
         final Word mark = loadWordFromObject(object, markOffset());
 
@@ -141,7 +138,6 @@
             } else {
                 // The bias pattern is present in the object's mark word. Need to check
                 // whether the bias owner and the epoch are both still current.
-                KlassPointer hub = loadHubIntrinsic(object, anchorNode);
                 final Word prototypeMarkWord = hub.readWord(prototypeMarkWordOffset(), PROTOTYPE_MARK_WORD_LOCATION);
                 final Word thread = registerAsWord(threadRegister);
                 final Word tmp = prototypeMarkWord.or(thread).xor(mark).and(~ageMaskInPlace());
@@ -185,7 +181,7 @@
                         Word biasedMark = unbiasedMark.or(thread);
                         trace(trace, "     unbiasedMark: 0x%016lx\n", unbiasedMark);
                         trace(trace, "       biasedMark: 0x%016lx\n", biasedMark);
-                        if (probability(VERY_FAST_PATH_PROBABILITY, compareAndSwap(object, markOffset(), unbiasedMark, biasedMark, MARK_WORD_LOCATION).equal(unbiasedMark))) {
+                        if (probability(VERY_FAST_PATH_PROBABILITY, compareAndSwap(OffsetAddressNode.address(object, markOffset()), unbiasedMark, biasedMark, MARK_WORD_LOCATION).equal(unbiasedMark))) {
                             // Object is now biased to current thread -> done
                             traceObject(trace, "+lock{bias:acquired}", object, true);
                             lockBiasAcquired.inc();
@@ -205,7 +201,7 @@
                         // the bias from one thread to another directly in this situation.
                         Word biasedMark = prototypeMarkWord.or(thread);
                         trace(trace, "       biasedMark: 0x%016lx\n", biasedMark);
-                        if (probability(VERY_FAST_PATH_PROBABILITY, compareAndSwap(object, markOffset(), mark, biasedMark, MARK_WORD_LOCATION).equal(mark))) {
+                        if (probability(VERY_FAST_PATH_PROBABILITY, compareAndSwap(OffsetAddressNode.address(object, markOffset()), mark, biasedMark, MARK_WORD_LOCATION).equal(mark))) {
                             // Object is now biased to current thread -> done
                             traceObject(trace, "+lock{bias:transfer}", object, true);
                             lockBiasTransfer.inc();
@@ -228,7 +224,7 @@
                     // that another thread raced us for the privilege of revoking the
                     // bias of this particular object, so it's okay to continue in the
                     // normal locking code.
-                    Word result = compareAndSwap(object, markOffset(), mark, prototypeMarkWord, MARK_WORD_LOCATION);
+                    Word result = compareAndSwap(OffsetAddressNode.address(object, markOffset()), mark, prototypeMarkWord, MARK_WORD_LOCATION);
 
                     // Fall through to the normal CAS-based lock, because no matter what
                     // the result of the above CAS, some thread must have succeeded in
@@ -251,7 +247,7 @@
 
         // Test if the object's mark word is unlocked, and if so, store the
         // (address of) the lock slot into the object's mark word.
-        Word currentMark = compareAndSwap(object, markOffset(), unlockedMark, lock, MARK_WORD_LOCATION);
+        Word currentMark = compareAndSwap(OffsetAddressNode.address(object, markOffset()), unlockedMark, lock, MARK_WORD_LOCATION);
         if (currentMark.notEqual(unlockedMark)) {
             trace(trace, "      currentMark: 0x%016lx\n", currentMark);
             // The mark word in the object header was not the same.
@@ -342,7 +338,8 @@
             // Test if object's mark word is pointing to the displaced mark word, and if so, restore
             // the displaced mark in the object - if the object's mark word is not pointing to
             // the displaced mark word, do unlocking via runtime call.
-            if (probability(VERY_SLOW_PATH_PROBABILITY, DirectCompareAndSwapNode.compareAndSwap(object, markOffset(), lock, displacedMark, MARK_WORD_LOCATION).notEqual(lock))) {
+            if (probability(VERY_SLOW_PATH_PROBABILITY,
+                            DirectCompareAndSwapNode.compareAndSwap(OffsetAddressNode.address(object, markOffset()), lock, displacedMark, MARK_WORD_LOCATION).notEqual(lock))) {
                 // The object's mark word was not pointing to the displaced header,
                 // we do unlocking via runtime call.
                 traceObject(trace, "-lock{stub}", object, false);
@@ -445,10 +442,12 @@
             this.useFastLocking = useFastLocking;
         }
 
-        public void lower(MonitorEnterNode monitorenterNode, HotSpotRegistersProvider registers, LoweringTool tool) {
+        public void lower(RawMonitorEnterNode monitorenterNode, HotSpotRegistersProvider registers, LoweringTool tool) {
             StructuredGraph graph = monitorenterNode.graph();
             checkBalancedMonitors(graph, tool);
 
+            assert ((ObjectStamp) monitorenterNode.object().stamp()).nonNull();
+
             Arguments args;
             if (useFastLocking) {
                 args = new Arguments(monitorenter, graph.getGuardsStage(), tool.getLoweringStage());
@@ -456,6 +455,7 @@
                 args = new Arguments(monitorenterStub, graph.getGuardsStage(), tool.getLoweringStage());
             }
             args.add("object", monitorenterNode.object());
+            args.add("hub", monitorenterNode.getHub());
             args.addConst("lockDepth", monitorenterNode.getMonitorId().getLockDepth());
             args.addConst("threadRegister", registers.getThreadRegister());
             args.addConst("stackPointerRegister", registers.getStackPointerRegister());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Tue Jun 09 19:07:39 2015 -0700
@@ -54,6 +54,7 @@
 import com.oracle.graal.nodes.debug.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.replacements.*;
@@ -135,7 +136,7 @@
             int distance = config().allocatePrefetchDistance;
             ExplodeLoopNode.explodeLoop();
             for (int i = 0; i < lines; i++) {
-                PrefetchAllocateNode.prefetch(address, Word.signed(distance));
+                PrefetchAllocateNode.prefetch(OffsetAddressNode.address(address, distance));
                 distance += stepSize;
             }
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,17 +22,11 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-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 static com.oracle.jvmci.code.MemoryBarriers.*;
 
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
@@ -43,6 +37,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.graal.nodes.memory.address.AddressNode.Address;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
@@ -51,7 +47,9 @@
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
 import com.oracle.graal.replacements.nodes.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
+import com.oracle.jvmci.meta.*;
 
 public class WriteBarrierSnippets implements Snippets {
 
@@ -72,14 +70,8 @@
     public static final LocationIdentity GC_INDEX_LOCATION = NamedLocationIdentity.mutable("GC-Index");
 
     @Snippet
-    public static void serialWriteBarrier(Object object, Object location, @ConstantParameter boolean usePrecise) {
-        Object fixedObject = FixedValueAnchorNode.getObject(object);
-        Pointer oop;
-        if (usePrecise) {
-            oop = Word.fromArray(fixedObject, SnippetLocationProxyNode.location(location));
-        } else {
-            oop = Word.fromObject(fixedObject);
-        }
+    public static void serialWriteBarrier(Address address) {
+        Pointer oop = Word.fromAddress(address);
         serialWriteBarrierCounter.inc();
         int cardTableShift = (isImmutableCode() && generatePIC()) ? CardTableShiftNode.cardTableShift() : cardTableShift();
         long cardTableAddress = (isImmutableCode() && generatePIC()) ? CardTableAddressNode.cardTableAddress() : cardTableStart();
@@ -114,16 +106,15 @@
     }
 
     @Snippet
-    public static void g1PreWriteBarrier(Object object, Object expectedObject, Object location, @ConstantParameter boolean doLoad, @ConstantParameter boolean nullCheck,
+    public static void g1PreWriteBarrier(Address address, Object object, Object expectedObject, @ConstantParameter boolean doLoad, @ConstantParameter boolean nullCheck,
                     @ConstantParameter Register threadRegister, @ConstantParameter boolean trace) {
         if (nullCheck) {
-            NullCheckNode.nullCheck(object);
+            NullCheckNode.nullCheck(address);
         }
         Word thread = registerAsWord(threadRegister);
-        Object fixedObject = FixedValueAnchorNode.getObject(object);
-        verifyOop(fixedObject);
+        verifyOop(object);
         Object fixedExpectedObject = FixedValueAnchorNode.getObject(expectedObject);
-        Word field = Word.fromWordBase(Word.fromArray(fixedObject, SnippetLocationProxyNode.location(location)));
+        Word field = Word.fromWordBase(Word.fromAddress(address));
         Word previousOop = Word.fromWordBase(Word.fromObject(fixedExpectedObject));
         byte markingValue = thread.readByte(g1SATBQueueMarkingOffset());
         Word bufferAddress = thread.readWord(g1SATBQueueBufferOffset());
@@ -132,7 +123,7 @@
         int gcCycle = 0;
         if (trace) {
             gcCycle = (int) Word.unsigned(HotSpotReplacementsUtil.gcTotalCollectionsAddress()).readLong(0);
-            log(trace, "[%d] G1-Pre Thread %p Object %p\n", gcCycle, thread.rawValue(), Word.fromObject(fixedObject).rawValue());
+            log(trace, "[%d] G1-Pre Thread %p Object %p\n", gcCycle, thread.rawValue(), Word.fromObject(object).rawValue());
             log(trace, "[%d] G1-Pre Thread %p Expected Object %p\n", gcCycle, thread.rawValue(), Word.fromObject(fixedExpectedObject).rawValue());
             log(trace, "[%d] G1-Pre Thread %p Field %p\n", gcCycle, thread.rawValue(), field.rawValue());
             log(trace, "[%d] G1-Pre Thread %p Marking %d\n", gcCycle, thread.rawValue(), markingValue);
@@ -170,24 +161,17 @@
     }
 
     @Snippet
-    public static void g1PostWriteBarrier(Object object, Object value, Object location, @ConstantParameter boolean usePrecise, @ConstantParameter Register threadRegister,
-                    @ConstantParameter boolean trace) {
+    public static void g1PostWriteBarrier(Address address, Object object, Object value, @ConstantParameter Register threadRegister, @ConstantParameter boolean trace) {
         Word thread = registerAsWord(threadRegister);
-        Object fixedObject = FixedValueAnchorNode.getObject(object);
         Object fixedValue = FixedValueAnchorNode.getObject(value);
-        verifyOop(fixedObject);
+        verifyOop(object);
         verifyOop(fixedValue);
-        validateObject(fixedObject, fixedValue);
-        Word oop;
-        if (usePrecise) {
-            oop = Word.fromWordBase(Word.fromArray(fixedObject, SnippetLocationProxyNode.location(location)));
-        } else {
-            oop = Word.fromWordBase(Word.fromObject(fixedObject));
-        }
+        validateObject(object, fixedValue);
+        Word oop = Word.fromWordBase(Word.fromAddress(address));
         int gcCycle = 0;
         if (trace) {
             gcCycle = (int) Word.unsigned(HotSpotReplacementsUtil.gcTotalCollectionsAddress()).readLong(0);
-            log(trace, "[%d] G1-Post Thread: %p Object: %p\n", gcCycle, thread.rawValue(), Word.fromObject(fixedObject).rawValue());
+            log(trace, "[%d] G1-Post Thread: %p Object: %p\n", gcCycle, thread.rawValue(), Word.fromObject(object).rawValue());
             log(trace, "[%d] G1-Post Thread: %p Field: %p\n", gcCycle, thread.rawValue(), oop.rawValue());
         }
         Word writtenValue = Word.fromWordBase(Word.fromObject(fixedValue));
@@ -355,9 +339,7 @@
 
         public void lower(SerialWriteBarrier writeBarrier, LoweringTool tool) {
             Arguments args = new Arguments(serialWriteBarrier, writeBarrier.graph().getGuardsStage(), tool.getLoweringStage());
-            args.add("object", writeBarrier.getObject());
-            args.add("location", writeBarrier.getLocation());
-            args.addConst("usePrecise", writeBarrier.usePrecise());
+            args.add("address", writeBarrier.getAddress());
             template(args).instantiate(providers.getMetaAccess(), writeBarrier, DEFAULT_REPLACER, args);
         }
 
@@ -371,7 +353,13 @@
 
         public void lower(G1PreWriteBarrier writeBarrierPre, HotSpotRegistersProvider registers, LoweringTool tool) {
             Arguments args = new Arguments(g1PreWriteBarrier, writeBarrierPre.graph().getGuardsStage(), tool.getLoweringStage());
-            args.add("object", writeBarrierPre.getObject());
+            AddressNode address = writeBarrierPre.getAddress();
+            args.add("address", address);
+            if (address instanceof OffsetAddressNode) {
+                args.add("object", ((OffsetAddressNode) address).getBase());
+            } else {
+                args.add("object", null);
+            }
 
             ValueNode expected = writeBarrierPre.getExpectedObject();
             if (expected != null && expected.stamp() instanceof NarrowOopStamp) {
@@ -380,7 +368,6 @@
             }
             args.add("expectedObject", expected);
 
-            args.add("location", writeBarrierPre.getLocation());
             args.addConst("doLoad", writeBarrierPre.doLoad());
             args.addConst("nullCheck", writeBarrierPre.getNullCheck());
             args.addConst("threadRegister", registers.getThreadRegister());
@@ -390,7 +377,13 @@
 
         public void lower(G1ReferentFieldReadBarrier readBarrier, HotSpotRegistersProvider registers, LoweringTool tool) {
             Arguments args = new Arguments(g1ReferentReadBarrier, readBarrier.graph().getGuardsStage(), tool.getLoweringStage());
-            args.add("object", readBarrier.getObject());
+            AddressNode address = readBarrier.getAddress();
+            args.add("address", address);
+            if (address instanceof OffsetAddressNode) {
+                args.add("object", ((OffsetAddressNode) address).getBase());
+            } else {
+                args.add("object", null);
+            }
 
             ValueNode expected = readBarrier.getExpectedObject();
             if (expected != null && expected.stamp() instanceof NarrowOopStamp) {
@@ -399,7 +392,6 @@
             }
 
             args.add("expectedObject", expected);
-            args.add("location", readBarrier.getLocation());
             args.addConst("doLoad", readBarrier.doLoad());
             args.addConst("nullCheck", false);
             args.addConst("threadRegister", registers.getThreadRegister());
@@ -414,7 +406,13 @@
                 return;
             }
             Arguments args = new Arguments(g1PostWriteBarrier, graph.getGuardsStage(), tool.getLoweringStage());
-            args.add("object", writeBarrierPost.getObject());
+            AddressNode address = writeBarrierPost.getAddress();
+            args.add("address", address);
+            if (address instanceof OffsetAddressNode) {
+                args.add("object", ((OffsetAddressNode) address).getBase());
+            } else {
+                args.add("object", null);
+            }
 
             ValueNode value = writeBarrierPost.getValue();
             if (value.stamp() instanceof NarrowOopStamp) {
@@ -423,8 +421,6 @@
             }
             args.add("value", value);
 
-            args.add("location", writeBarrierPost.getLocation());
-            args.addConst("usePrecise", writeBarrierPost.usePrecise());
             args.addConst("threadRegister", registers.getThreadRegister());
             args.addConst("trace", traceBarrier());
             template(args).instantiate(providers.getMetaAccess(), writeBarrierPost, DEFAULT_REPLACER, args);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -23,12 +23,6 @@
 //JaCoCo Exclude
 package com.oracle.graal.hotspot.replacements.arraycopy;
 
-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.*;
@@ -41,9 +35,12 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.runtime.*;
+import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(allowedUsageTypes = {InputType.Memory})
 public final class ArrayCopyCallNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single, MemoryAccess, Canonicalizable {
@@ -123,9 +120,11 @@
     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.getJVMCIRuntime().getArrayBaseOffset(elementKind), pos, runtime.getJVMCIRuntime().getArrayIndexScale(elementKind)));
-        return graph().unique(new ComputeAddressNode(basePtr, loc, StampFactory.forKind(Kind.Long)));
+        HotSpotJVMCIRuntimeProvider jvmciRuntime = runtime.getJVMCIRuntime();
+        int shift = CodeUtil.log2(jvmciRuntime.getArrayIndexScale(elementKind));
+        ValueNode scaledIndex = graph().unique(new LeftShiftNode(pos, ConstantNode.forInt(shift, graph())));
+        ValueNode offset = graph().unique(new AddNode(scaledIndex, ConstantNode.forInt(jvmciRuntime.getArrayBaseOffset(elementKind), graph())));
+        return graph().unique(new OffsetAddressNode(basePtr, offset));
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -23,9 +23,6 @@
 //JaCoCo Exclude
 package com.oracle.graal.hotspot.replacements.arraycopy;
 
-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,9 +33,12 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(allowedUsageTypes = {InputType.Memory, InputType.Value})
 public final class CheckcastArrayCopyCallNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single {
@@ -97,9 +97,12 @@
     private ValueNode computeBase(ValueNode base, ValueNode pos) {
         FixedWithNextNode basePtr = graph().add(new GetObjectAddressNode(base));
         graph().addBeforeFixed(this, basePtr);
+
         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)));
+        int shift = CodeUtil.log2(jvmciRuntime.getArrayIndexScale(Kind.Object));
+        ValueNode scaledIndex = graph().unique(new LeftShiftNode(pos, ConstantNode.forInt(shift, graph())));
+        ValueNode offset = graph().unique(new AddNode(scaledIndex, ConstantNode.forInt(jvmciRuntime.getArrayBaseOffset(Kind.Object), graph())));
+        return graph().unique(new OffsetAddressNode(basePtr, offset));
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java	Tue Jun 09 19:07:39 2015 -0700
@@ -31,6 +31,7 @@
 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.*;
 
@@ -119,33 +120,40 @@
         return null;
     }
 
+    private class DebugScopeContext implements JavaMethod, JavaMethodContex {
+        public JavaMethod asJavaMethod() {
+            return this;
+        }
+
+        public Signature getSignature() {
+            ForeignCallDescriptor d = linkage.getDescriptor();
+            MetaAccessProvider metaAccess = providers.getMetaAccess();
+            Class<?>[] arguments = d.getArgumentTypes();
+            ResolvedJavaType[] parameters = new ResolvedJavaType[arguments.length];
+            for (int i = 0; i < arguments.length; i++) {
+                parameters[i] = metaAccess.lookupJavaType(arguments[i]);
+            }
+            return new HotSpotSignature(runtime.getJVMCIRuntime(), metaAccess.lookupJavaType(d.getResultType()), parameters);
+        }
+
+        public String getName() {
+            return linkage.getDescriptor().getName();
+        }
+
+        public JavaType getDeclaringClass() {
+            return providers.getMetaAccess().lookupJavaType(ForeignCallStub.class);
+        }
+
+        @Override
+        public String toString() {
+            return format("ForeignCallStub<%n(%p)>");
+        }
+    }
+
     @Override
     protected Object debugScopeContext() {
-        return new JavaMethod() {
-
-            public Signature getSignature() {
-                ForeignCallDescriptor d = linkage.getDescriptor();
-                MetaAccessProvider metaAccess = providers.getMetaAccess();
-                Class<?>[] arguments = d.getArgumentTypes();
-                ResolvedJavaType[] parameters = new ResolvedJavaType[arguments.length];
-                for (int i = 0; i < arguments.length; i++) {
-                    parameters[i] = metaAccess.lookupJavaType(arguments[i]);
-                }
-                return new HotSpotSignature(runtime.getJVMCIRuntime(), metaAccess.lookupJavaType(d.getResultType()), parameters);
-            }
+        return new DebugScopeContext() {
 
-            public String getName() {
-                return linkage.getDescriptor().getName();
-            }
-
-            public JavaType getDeclaringClass() {
-                return providers.getMetaAccess().lookupJavaType(ForeignCallStub.class);
-            }
-
-            @Override
-            public String toString() {
-                return format("ForeignCallStub<%n(%p)>");
-            }
         };
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Tue Jun 09 19:07:39 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
@@ -40,6 +40,7 @@
 import com.oracle.graal.hotspot.replacements.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
 import com.oracle.graal.word.*;
@@ -246,7 +247,7 @@
                 return Word.zero();
             }
 
-            if (compareAndSwap(heapTopAddress, 0, heapTop, newHeapTop, HEAP_TOP_LOCATION).equal(heapTop)) {
+            if (compareAndSwap(RawAddressNode.address(heapTopAddress), heapTop, newHeapTop, HEAP_TOP_LOCATION).equal(heapTop)) {
                 return heapTop;
             }
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/MetaspacePointer.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/MetaspacePointer.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,14 +22,13 @@
  */
 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.nodes.extended.*;
 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;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Marker type for a metaspace pointer.
@@ -51,7 +50,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -66,7 +65,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -81,7 +80,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -96,7 +95,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -111,7 +110,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -126,7 +125,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -141,7 +140,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -156,7 +155,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -171,7 +170,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -182,7 +181,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -193,7 +192,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -204,7 +203,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -215,7 +214,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -226,7 +225,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -237,7 +236,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -248,7 +247,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -259,7 +258,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -270,7 +269,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_POINTER)
@@ -285,7 +284,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -300,7 +299,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -315,7 +314,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -330,7 +329,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -345,7 +344,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -360,7 +359,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -375,7 +374,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -390,7 +389,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -405,7 +404,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.INITIALIZE)
@@ -420,7 +419,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -431,7 +430,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -442,7 +441,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -453,7 +452,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -464,7 +463,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -475,7 +474,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -486,7 +485,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -497,7 +496,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -508,7 +507,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
@@ -519,7 +518,7 @@
      * are in bytes. The memory must be uninitialized or zero prior to this operation.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.INITIALIZE)
@@ -530,7 +529,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_POINTER)
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, 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
@@ -27,7 +27,6 @@
 import static com.oracle.graal.compiler.common.type.StampFactory.*;
 import static com.oracle.graal.graphbuilderconf.IntrinsicContext.CompilationContext.*;
 import static com.oracle.graal.java.BytecodeParser.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.*;
@@ -62,6 +61,7 @@
 import com.oracle.graal.phases.*;
 import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.compiler.Compiler;
 import com.oracle.jvmci.debug.*;
 import com.oracle.jvmci.debug.Debug.Scope;
 import com.oracle.jvmci.meta.*;
@@ -1524,7 +1524,7 @@
     private void parseAndInlineCallee(ResolvedJavaMethod targetMethod, ValueNode[] args, IntrinsicContext calleeIntrinsicContext) {
         try (IntrinsicScope s = calleeIntrinsicContext != null && !parsingIntrinsic() ? new IntrinsicScope(this, targetMethod.getSignature().toParameterKinds(!targetMethod.isStatic()), args) : null) {
 
-            BytecodeParser parser = graphBuilderInstance.createBytecodeParser(graph, this, targetMethod, INVOCATION_ENTRY_BCI, calleeIntrinsicContext);
+            BytecodeParser parser = graphBuilderInstance.createBytecodeParser(graph, this, targetMethod, Compiler.INVOCATION_ENTRY_BCI, calleeIntrinsicContext);
             FrameStateBuilder startFrameState = new FrameStateBuilder(parser, targetMethod, graph);
             if (!targetMethod.isStatic()) {
                 args[0] = nullCheckedValue(args[0]);
@@ -2203,7 +2203,7 @@
                     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));
+                    append(new IfNode(graph.unique(InstanceOfNode.create((ResolvedJavaType) catchType, exception, null)), trueSuccessor, nextDispatch, 0));
                     return;
                 }
             }
@@ -2220,7 +2220,7 @@
             frameState.push(Kind.Object, exception);
             FixedNode nextDispatch = createTarget(nextBlock, frameState);
             checkCast.setNext(catchSuccessor);
-            append(new IfNode(graph.unique(new InstanceOfNode((ResolvedJavaType) catchType, exception, null)), checkCast, nextDispatch, 0.5));
+            append(new IfNode(graph.unique(InstanceOfNode.create((ResolvedJavaType) catchType, exception, null)), checkCast, nextDispatch, 0.5));
         } else {
             handleUnresolvedExceptionType(catchType);
         }
@@ -2294,7 +2294,7 @@
                     throw new BailoutException("OSR into a JSR scope is not supported");
                 }
                 EntryMarkerNode x = append(new EntryMarkerNode());
-                frameState.insertProxies(value -> ProxyNode.forValue(value, x, graph));
+                frameState.insertProxies(value -> graph.unique(new EntryProxyNode(value, x)));
                 x.setStateAfter(createFrameState(bci, x));
             }
 
@@ -2900,7 +2900,7 @@
     private JavaField lookupField(int cpi, int opcode) {
         maybeEagerlyResolve(cpi, opcode);
         JavaField result = constantPool.lookupField(cpi, opcode);
-        if (graphBuilderConfig.unresolvedIsError()) {
+        if (graphBuilderConfig.eagerResolving()) {
             assert result instanceof ResolvedJavaField : "Not resolved: " + result;
             ResolvedJavaType declaringClass = ((ResolvedJavaField) result).getDeclaringClass();
             if (!declaringClass.isInitialized()) {
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Tue Jun 09 19:07:39 2015 -0700
@@ -425,16 +425,16 @@
 
     public void insertLoopPhis(LocalLiveness liveness, int loopId, LoopBeginNode loopBegin, boolean forcePhis) {
         for (int i = 0; i < localsSize(); i++) {
-            boolean changedInLoop = liveness.localIsChangedInLoop(loopId, i);
-            if (changedInLoop || forcePhis) {
-                locals[i] = createLoopPhi(loopBegin, locals[i], !changedInLoop);
+            boolean needPhi = forcePhis || liveness.localIsChangedInLoop(loopId, i);
+            if (needPhi) {
+                locals[i] = createLoopPhi(loopBegin, locals[i]);
             }
         }
         for (int i = 0; i < stackSize(); i++) {
-            stack[i] = createLoopPhi(loopBegin, stack[i], false);
+            stack[i] = createLoopPhi(loopBegin, stack[i]);
         }
         for (int i = 0; i < lockedObjects.length; i++) {
-            lockedObjects[i] = createLoopPhi(loopBegin, lockedObjects[i], false);
+            lockedObjects[i] = createLoopPhi(loopBegin, lockedObjects[i]);
         }
     }
 
@@ -486,13 +486,13 @@
         }
     }
 
-    private ValueNode createLoopPhi(AbstractMergeNode block, ValueNode value, boolean stampFromValue) {
+    private ValueNode createLoopPhi(AbstractMergeNode block, ValueNode value) {
         if (value == null || value == TWO_SLOT_MARKER) {
             return value;
         }
         assert !block.isPhiAtMerge(value) : "phi function for this block already created";
 
-        ValuePhiNode phi = graph.addWithoutUnique(new ValuePhiNode(stampFromValue ? value.stamp() : value.stamp().unrestricted(), block));
+        ValuePhiNode phi = graph.addWithoutUnique(new ValuePhiNode(value.stamp().unrestricted(), block));
         phi.addInput(value);
         return phi;
     }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,14 +22,11 @@
  */
 package com.oracle.graal.java;
 
-import static com.oracle.graal.compiler.common.GraalOptions.*;
-
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
-import com.oracle.jvmci.debug.*;
 import com.oracle.jvmci.meta.*;
 
 /**
@@ -74,12 +71,7 @@
 
         @Override
         protected void run(StructuredGraph graph) {
-            TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), graph.method());
-            try {
-                createBytecodeParser(graph, null, graph.method(), graph.getEntryBCI(), initialIntrinsicContext).buildRootMethod();
-            } finally {
-                filter.remove();
-            }
+            createBytecodeParser(graph, null, graph.method(), graph.getEntryBCI(), initialIntrinsicContext).buildRootMethod();
         }
 
         /* Hook for subclasses of Instance to provide a subclass of BytecodeParser. */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopSpilling.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,103 @@
+/*
+ * 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.jtt.loop;
+
+import org.junit.*;
+
+import com.oracle.graal.jtt.*;
+
+public class LoopSpilling extends JTTTest {
+
+    private static final int ITERATION = 64;
+
+    /**
+     * Modification of sun.security.provider.SHA2.implCompress().
+     */
+    void test(int[] state) {
+
+        int a1 = state[0];
+        int b1 = state[1];
+        int c1 = state[2];
+        int d1 = state[3];
+        int e1 = state[4];
+        int f1 = state[5];
+        int g1 = state[6];
+        int h1 = state[7];
+
+        // 2nd
+        int a2 = state[8];
+        int b2 = state[9];
+        int c2 = state[10];
+        int d2 = state[11];
+        int e2 = state[12];
+        int f2 = state[13];
+        int g2 = state[14];
+        int h2 = state[15];
+
+        for (int i = 0; i < ITERATION; i++) {
+            h1 = g1;
+            g1 = f1;
+            f1 = e1;
+            e1 = d1;
+            d1 = c1;
+            c1 = b1;
+            b1 = a1;
+            a1 = h1;
+            // 2nd
+            h2 = g2;
+            g2 = f2;
+            f2 = e2;
+            e2 = d2;
+            d2 = c2;
+            c2 = b2;
+            b2 = a2;
+            a2 = h2;
+        }
+        state[0] += a1;
+        state[1] += b1;
+        state[2] += c1;
+        state[3] += d1;
+        state[4] += e1;
+        state[5] += f1;
+        state[6] += g1;
+        state[7] += h1;
+        // 2nd
+        state[8] += a2;
+        state[9] += b2;
+        state[10] += c2;
+        state[11] += d2;
+        state[12] += e2;
+        state[13] += f2;
+        state[14] += g2;
+        state[15] += h2;
+    }
+
+    private static final int[] INITIAL_HASHES = {0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4, 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
+                    0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
+
+    @Test
+    public void run0() throws Throwable {
+        runTest("test", supply(() -> INITIAL_HASHES.clone()));
+    }
+
+}
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCAddressValue.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCAddressValue.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,108 +22,17 @@
  */
 package com.oracle.graal.lir.sparc;
 
-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.asm.sparc.*;
 import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.LIRInstruction.OperandFlag;
-import com.oracle.graal.lir.LIRInstruction.OperandMode;
-
-public final class SPARCAddressValue extends CompositeValue {
+import com.oracle.jvmci.meta.*;
 
-    @Component({REG, OperandFlag.ILLEGAL}) protected AllocatableValue base;
-    @Component({REG, OperandFlag.ILLEGAL}) protected AllocatableValue index;
-    protected final int displacement;
-
-    private static final EnumSet<OperandFlag> flags = EnumSet.of(OperandFlag.REG, OperandFlag.ILLEGAL);
+public abstract class SPARCAddressValue extends CompositeValue {
 
-    public SPARCAddressValue(LIRKind kind, AllocatableValue base, int displacement) {
-        this(kind, base, Value.ILLEGAL, displacement);
-    }
-
-    public SPARCAddressValue(LIRKind kind, AllocatableValue base, AllocatableValue index, int displacement) {
+    public SPARCAddressValue(LIRKind kind) {
         super(kind);
-        assert isIllegal(index) || displacement == 0;
-        this.base = base;
-        this.index = index;
-        this.displacement = displacement;
-    }
-
-    @Override
-    public CompositeValue forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueProcedure proc) {
-        AllocatableValue newBase = (AllocatableValue) proc.doValue(inst, base, mode, flags);
-        AllocatableValue newIndex = (AllocatableValue) proc.doValue(inst, index, mode, flags);
-        if (!base.identityEquals(newBase) || !index.identityEquals(newIndex)) {
-            return new SPARCAddressValue(getLIRKind(), newBase, newIndex, displacement);
-        }
-        return this;
-    }
-
-    @Override
-    protected void forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueConsumer proc) {
-        proc.visitValue(inst, base, mode, flags);
-        proc.visitValue(inst, index, mode, flags);
     }
 
-    private static Register toRegister(AllocatableValue value) {
-        if (isIllegal(value)) {
-            return Register.None;
-        } else {
-            RegisterValue reg = (RegisterValue) value;
-            return reg.getRegister();
-        }
-    }
-
-    public SPARCAddress toAddress() {
-        if (isLegal(index)) {
-            return new SPARCAddress(toRegister(base), toRegister(index));
-        } else {
-            return new SPARCAddress(toRegister(base), displacement);
-        }
-    }
+    public abstract SPARCAddress toAddress();
 
-    @Override
-    public String toString() {
-        StringBuilder s = new StringBuilder("[");
-        String sep = "";
-        if (isLegal(base)) {
-            s.append(base);
-            sep = " + ";
-        }
-        if (isLegal(index)) {
-            s.append(sep).append(index);
-            sep = " + ";
-        } else {
-            if (displacement < 0) {
-                s.append(" - ").append(-displacement);
-            } else if (displacement > 0) {
-                s.append(sep).append(displacement);
-            }
-        }
-        s.append("]");
-        return s.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof SPARCAddressValue) {
-            SPARCAddressValue addr = (SPARCAddressValue) obj;
-            return getLIRKind().equals(addr.getLIRKind()) && displacement == addr.displacement && base.equals(addr.base) && index.equals(addr.index);
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return base.hashCode() ^ index.hashCode() ^ (displacement << 4) ^ getLIRKind().hashCode();
-    }
+    public abstract boolean isValidImplicitNullCheckFor(Value value, int implicitNullCheckLimit);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCImmediateAddressValue.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,104 @@
+/*
+ * 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.graal.lir.sparc;
+
+import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.graal.asm.sparc.*;
+import com.oracle.graal.lir.*;
+import com.oracle.graal.lir.LIRInstruction.OperandFlag;
+import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.meta.*;
+
+public final class SPARCImmediateAddressValue extends SPARCAddressValue {
+
+    @Component({REG}) protected AllocatableValue base;
+    protected final int displacement;
+
+    private static final EnumSet<OperandFlag> flags = EnumSet.of(OperandFlag.REG);
+
+    public SPARCImmediateAddressValue(LIRKind kind, AllocatableValue base, int displacement) {
+        super(kind);
+        assert SPARCAssembler.isSimm13(displacement);
+        this.base = base;
+        this.displacement = displacement;
+    }
+
+    @Override
+    public CompositeValue forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueProcedure proc) {
+        AllocatableValue newBase = (AllocatableValue) proc.doValue(inst, base, mode, flags);
+        if (!base.identityEquals(newBase)) {
+            return new SPARCImmediateAddressValue(getLIRKind(), newBase, displacement);
+        }
+        return this;
+    }
+
+    @Override
+    protected void forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueConsumer proc) {
+        proc.visitValue(inst, base, mode, flags);
+    }
+
+    @Override
+    public SPARCAddress toAddress() {
+        return new SPARCAddress(asRegister(base), displacement);
+    }
+
+    @Override
+    public boolean isValidImplicitNullCheckFor(Value value, int implicitNullCheckLimit) {
+        return value.equals(base) && displacement >= 0 && displacement < implicitNullCheckLimit;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder s = new StringBuilder("[");
+        String sep = "";
+        if (isLegal(base)) {
+            s.append(base);
+            sep = " + ";
+        }
+        if (displacement < 0) {
+            s.append(" - ").append(-displacement);
+        } else if (displacement > 0) {
+            s.append(sep).append(displacement);
+        }
+        s.append("]");
+        return s.toString();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof SPARCImmediateAddressValue) {
+            SPARCImmediateAddressValue addr = (SPARCImmediateAddressValue) obj;
+            return getLIRKind().equals(addr.getLIRKind()) && displacement == addr.displacement && base.equals(addr.base);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return base.hashCode() ^ (displacement << 4) ^ getLIRKind().hashCode();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCIndexedAddressValue.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,103 @@
+/*
+ * 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.graal.lir.sparc;
+
+import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.graal.asm.sparc.*;
+import com.oracle.graal.lir.*;
+import com.oracle.graal.lir.LIRInstruction.OperandFlag;
+import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.meta.*;
+
+public final class SPARCIndexedAddressValue extends SPARCAddressValue {
+
+    @Component({REG}) protected AllocatableValue base;
+    @Component({REG}) protected AllocatableValue index;
+
+    private static final EnumSet<OperandFlag> flags = EnumSet.of(OperandFlag.REG);
+
+    public SPARCIndexedAddressValue(LIRKind kind, AllocatableValue base, AllocatableValue index) {
+        super(kind);
+        this.base = base;
+        this.index = index;
+    }
+
+    @Override
+    public CompositeValue forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueProcedure proc) {
+        AllocatableValue newBase = (AllocatableValue) proc.doValue(inst, base, mode, flags);
+        AllocatableValue newIndex = (AllocatableValue) proc.doValue(inst, index, mode, flags);
+        if (!base.identityEquals(newBase) || !index.identityEquals(newIndex)) {
+            return new SPARCIndexedAddressValue(getLIRKind(), newBase, newIndex);
+        }
+        return this;
+    }
+
+    @Override
+    protected void forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueConsumer proc) {
+        proc.visitValue(inst, base, mode, flags);
+        proc.visitValue(inst, index, mode, flags);
+    }
+
+    @Override
+    public SPARCAddress toAddress() {
+        return new SPARCAddress(asRegister(base), asRegister(index));
+    }
+
+    @Override
+    public boolean isValidImplicitNullCheckFor(Value value, int implicitNullCheckLimit) {
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder s = new StringBuilder("[");
+        String sep = "";
+        if (isLegal(base)) {
+            s.append(base);
+            sep = " + ";
+        }
+        if (isLegal(index)) {
+            s.append(sep).append(index);
+        }
+        s.append("]");
+        return s.toString();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof SPARCIndexedAddressValue) {
+            SPARCIndexedAddressValue addr = (SPARCIndexedAddressValue) obj;
+            return getLIRKind().equals(addr.getLIRKind()) && base.equals(addr.base) && index.equals(addr.index);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return base.hashCode() ^ index.hashCode() ^ getLIRKind().hashCode();
+    }
+}
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java	Tue Jun 09 19:07:39 2015 -0700
@@ -338,7 +338,7 @@
         }
 
         public boolean makeNullCheckFor(Value value, LIRFrameState nullCheckState, int implicitNullCheckLimit) {
-            if (state == null && value.equals(address.base) && address.index.equals(Value.ILLEGAL) && address.displacement >= 0 && address.displacement < implicitNullCheckLimit) {
+            if (state == null && address.isValidImplicitNullCheckFor(value, implicitNullCheckLimit)) {
                 state = nullCheckState;
                 return true;
             }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java	Tue Jun 09 19:07:39 2015 -0700
@@ -165,7 +165,7 @@
         @Override
         protected void scanField(Field field, long offset) {
             Class<?> type = field.getType();
-            if (VALUE_CLASS.isAssignableFrom(type) && type != CONSTANT_CLASS) {
+            if (VALUE_CLASS.isAssignableFrom(type) && !CONSTANT_CLASS.isAssignableFrom(type)) {
                 assert !Modifier.isFinal(field.getModifiers()) : "Value field must not be declared final because it is modified by register allocator: " + field;
                 OperandModeAnnotation annotation = getOperandModeAnnotation(field);
                 assert annotation != null : "Field must have operand mode annotation: " + field;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGeneratorTool.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGeneratorTool.java	Tue Jun 09 19:07:39 2015 -0700
@@ -142,8 +142,6 @@
      */
     void emitData(AllocatableValue dst, byte[] data);
 
-    Value emitAddress(Value base, long displacement, Value index, int scale);
-
     Variable emitAddress(StackSlotValue slot);
 
     void emitMembar(int barriers);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryProxyNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,53 @@
+/*
+ * 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.nodes;
+
+import com.oracle.graal.graph.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.spi.*;
+
+/**
+ * Proxy node that is used in OSR. This node drops the stamp information from the value, since the
+ * types we see during OSR may be too precise (if a branch was not parsed for example).
+ */
+@NodeInfo(nameTemplate = "EntryProxy({i#value})")
+public final class EntryProxyNode extends ProxyNode implements ValueProxy {
+
+    public static final NodeClass<EntryProxyNode> TYPE = NodeClass.create(EntryProxyNode.class);
+    @Input ValueNode value;
+
+    public EntryProxyNode(ValueNode value, AbstractBeginNode proxyPoint) {
+        super(TYPE, value.stamp().unrestricted(), proxyPoint);
+        this.value = value;
+    }
+
+    @Override
+    public ValueNode value() {
+        return value;
+    }
+
+    @Override
+    public ValueNode getOriginalNode() {
+        return value();
+    }
+}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java	Tue Jun 09 19:07:39 2015 -0700
@@ -32,6 +32,8 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.compiler.Compiler;
+import com.oracle.jvmci.debug.*;
 import com.oracle.jvmci.meta.*;
 import com.oracle.jvmci.meta.Assumptions.Assumption;
 
@@ -39,7 +41,7 @@
  * A graph that contains at least one distinguished node : the {@link #start() start} node. This
  * node is the start of the control flow of the graph.
  */
-public class StructuredGraph extends Graph {
+public class StructuredGraph extends Graph implements JavaMethodContex {
 
     /**
      * The different stages of the compilation of a {@link Graph} regarding the status of
@@ -97,7 +99,6 @@
         }
     }
 
-    public static final int INVOCATION_ENTRY_BCI = -1;
     public static final long INVALID_GRAPH_ID = -1;
 
     private static final AtomicLong uniqueGraphIds = new AtomicLong();
@@ -134,11 +135,11 @@
      * start} node.
      */
     public StructuredGraph(String name, ResolvedJavaMethod method, AllowAssumptions allowAssumptions) {
-        this(name, method, uniqueGraphIds.incrementAndGet(), INVOCATION_ENTRY_BCI, allowAssumptions);
+        this(name, method, uniqueGraphIds.incrementAndGet(), Compiler.INVOCATION_ENTRY_BCI, allowAssumptions);
     }
 
     public StructuredGraph(ResolvedJavaMethod method, AllowAssumptions allowAssumptions) {
-        this(null, method, uniqueGraphIds.incrementAndGet(), INVOCATION_ENTRY_BCI, allowAssumptions);
+        this(null, method, uniqueGraphIds.incrementAndGet(), Compiler.INVOCATION_ENTRY_BCI, allowAssumptions);
     }
 
     public StructuredGraph(ResolvedJavaMethod method, int entryBCI, AllowAssumptions allowAssumptions) {
@@ -208,7 +209,7 @@
     }
 
     public boolean isOSR() {
-        return entryBCI != INVOCATION_ENTRY_BCI;
+        return entryBCI != Compiler.INVOCATION_ENTRY_BCI;
     }
 
     public long graphId() {
@@ -604,4 +605,8 @@
     public boolean isTrivial() {
         return !(start.next() instanceof ReturnNode);
     }
+
+    public JavaMethod asJavaMethod() {
+        return method();
+    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +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.nodes.extended;
-
-import com.oracle.graal.compiler.common.type.*;
-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.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
- * [(base + x) + y] where base is a node and x and y are location nodes.
- */
-@NodeInfo(nameTemplate = "&+({p#locationIdentity/s})")
-public final class AddLocationNode extends LocationNode implements Canonicalizable.Binary<LocationNode> {
-
-    public static final NodeClass<AddLocationNode> TYPE = NodeClass.create(AddLocationNode.class);
-    @Input(InputType.Association) ValueNode x;
-    @Input(InputType.Association) ValueNode y;
-
-    public LocationNode getX() {
-        return (LocationNode) x;
-    }
-
-    public LocationNode getY() {
-        return (LocationNode) y;
-    }
-
-    public AddLocationNode(LocationNode x, LocationNode y) {
-        super(TYPE, StampFactory.forVoid());
-        assert x.getLocationIdentity().equals(y.getLocationIdentity());
-        this.x = x;
-        this.y = y;
-    }
-
-    @Override
-    public LocationIdentity getLocationIdentity() {
-        return getX().getLocationIdentity();
-    }
-
-    public LocationNode canonical(CanonicalizerTool tool, LocationNode forX, LocationNode forY) {
-        if (forX instanceof ConstantLocationNode) {
-            return canonical((ConstantLocationNode) forX, forY);
-        }
-        if (forY instanceof ConstantLocationNode) {
-            return canonical((ConstantLocationNode) forY, forX);
-        }
-        if (forX instanceof IndexedLocationNode && forY instanceof IndexedLocationNode) {
-            IndexedLocationNode xIdx = (IndexedLocationNode) forX;
-            IndexedLocationNode yIdx = (IndexedLocationNode) forY;
-            if (xIdx.getIndexScaling() == yIdx.getIndexScaling()) {
-                long displacement = xIdx.getDisplacement() + yIdx.getDisplacement();
-                ValueNode index = BinaryArithmeticNode.add(xIdx.getIndex(), yIdx.getIndex());
-                return new IndexedLocationNode(getLocationIdentity(), displacement, index, xIdx.getIndexScaling());
-            }
-        }
-        return this;
-    }
-
-    private LocationNode canonical(ConstantLocationNode constant, LocationNode other) {
-        if (other instanceof ConstantLocationNode) {
-            ConstantLocationNode otherConst = (ConstantLocationNode) other;
-            return new ConstantLocationNode(getLocationIdentity(), otherConst.getDisplacement() + constant.getDisplacement());
-        } else if (other instanceof IndexedLocationNode) {
-            IndexedLocationNode otherIdx = (IndexedLocationNode) other;
-            return new IndexedLocationNode(getLocationIdentity(), otherIdx.getDisplacement() + constant.getDisplacement(), otherIdx.getIndex(), otherIdx.getIndexScaling());
-        } else if (other instanceof AddLocationNode) {
-            AddLocationNode otherAdd = (AddLocationNode) other;
-            LocationNode newInner = otherAdd.canonical(constant, otherAdd.getX());
-            if (newInner != otherAdd) {
-                return new AddLocationNode(newInner, otherAdd.getY());
-            }
-        }
-        return this;
-    }
-
-    @Override
-    public Value generateAddress(NodeMappableLIRBuilder builder, LIRGeneratorTool gen, Value base) {
-        Value xAddr = getX().generateAddress(builder, gen, base);
-        return getY().generateAddress(builder, gen, xAddr);
-    }
-
-    @Override
-    public IntegerStamp getDisplacementStamp() {
-        return (IntegerStamp) IntegerStamp.OPS.getAdd().foldStamp(getX().getDisplacementStamp(), getY().getDisplacementStamp());
-    }
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +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.nodes.extended;
-
-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 {
-
-    public static final NodeClass<ComputeAddressNode> TYPE = NodeClass.create(ComputeAddressNode.class);
-    @Input ValueNode object;
-    @Input(InputType.Association) ValueNode location;
-
-    public ValueNode getObject() {
-        return object;
-    }
-
-    public LocationNode getLocation() {
-        return (LocationNode) location;
-    }
-
-    public ComputeAddressNode(ValueNode object, ValueNode location, Stamp stamp) {
-        super(TYPE, stamp);
-        this.object = object;
-        this.location = location;
-    }
-
-    @Override
-    public void generate(NodeLIRBuilderTool gen) {
-        Value addr = getLocation().generateAddress(gen, gen.getLIRGeneratorTool(), gen.operand(getObject()));
-        gen.setResult(this, gen.getLIRGeneratorTool().asAllocatable(addr));
-    }
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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.nodes.extended;
-
-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]
- * where base is a node and disp is a constant.
- */
-@NodeInfo(nameTemplate = "&({p#locationIdentity/s})")
-public final class ConstantLocationNode extends LocationNode {
-
-    public static final NodeClass<ConstantLocationNode> TYPE = NodeClass.create(ConstantLocationNode.class);
-    protected final LocationIdentity locationIdentity;
-    protected final long displacement;
-
-    public ConstantLocationNode(LocationIdentity identity, long displacement) {
-        super(TYPE, StampFactory.forVoid());
-        this.locationIdentity = identity;
-        this.displacement = displacement;
-    }
-
-    @Override
-    public LocationIdentity getLocationIdentity() {
-        return locationIdentity;
-    }
-
-    public long getDisplacement() {
-        return displacement;
-    }
-
-    @Override
-    public Value generateAddress(NodeMappableLIRBuilder builder, LIRGeneratorTool gen, Value base) {
-        return gen.emitAddress(base, getDisplacement(), Value.ILLEGAL, 0);
-    }
-
-    @Override
-    public IntegerStamp getDisplacementStamp() {
-        return StampFactory.forInteger(64, displacement, displacement);
-    }
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +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.nodes.extended;
-
-import com.oracle.graal.compiler.common.type.*;
-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.*;
-
-/**
- * Location node that has a displacement and a scaled index. Can represent locations in the form of
- * [base + index * scale + disp] where base and index are nodes and scale and disp are integer
- * constants.
- */
-@NodeInfo(nameTemplate = "&({p#locationIdentity/s})[{i#index}]")
-public final class IndexedLocationNode extends LocationNode implements Canonicalizable {
-    public static final NodeClass<IndexedLocationNode> TYPE = NodeClass.create(IndexedLocationNode.class);
-
-    protected final LocationIdentity locationIdentity;
-    protected final long displacement;
-    @Input ValueNode index;
-    protected final int indexScaling;
-
-    /**
-     * Gets the index or offset of this location.
-     */
-    public ValueNode getIndex() {
-        return index;
-    }
-
-    public long getDisplacement() {
-        return displacement;
-    }
-
-    /**
-     * @return Constant that is used to scale the index.
-     */
-    public int getIndexScaling() {
-        return indexScaling;
-    }
-
-    public IndexedLocationNode(LocationIdentity identity, long displacement, ValueNode index, int indexScaling) {
-        super(TYPE, StampFactory.forVoid());
-        assert index != null;
-        assert indexScaling != 0;
-        this.locationIdentity = identity;
-        this.index = index;
-        this.displacement = displacement;
-        this.indexScaling = indexScaling;
-    }
-
-    @Override
-    public LocationIdentity getLocationIdentity() {
-        return locationIdentity;
-    }
-
-    @Override
-    public Node canonical(CanonicalizerTool tool) {
-        if (index.isConstant()) {
-            return new ConstantLocationNode(getLocationIdentity(), index.asJavaConstant().asLong() * indexScaling + displacement);
-        }
-        return this;
-    }
-
-    @Override
-    public IntegerStamp getDisplacementStamp() {
-        assert indexScaling > 0 && CodeUtil.isPowerOf2(indexScaling);
-        int scale = CodeUtil.log2(indexScaling);
-        return (IntegerStamp) IntegerStamp.OPS.getAdd().foldStamp(StampFactory.forInteger(64, displacement, displacement),
-                        IntegerStamp.OPS.getSignExtend().foldStamp(32, 64, IntegerStamp.OPS.getShl().foldStamp(index.stamp(), StampFactory.forInteger(64, scale, scale))));
-    }
-
-    @Override
-    public Value generateAddress(NodeMappableLIRBuilder builder, LIRGeneratorTool gen, Value base) {
-        return gen.emitAddress(base, displacement, builder.operand(getIndex()), getIndexScaling());
-    }
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -26,8 +26,8 @@
 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.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.jvmci.meta.*;
 
@@ -42,8 +42,8 @@
     protected final Kind readKind;
     protected final boolean compressible;
 
-    public JavaReadNode(Kind readKind, ValueNode object, LocationNode location, BarrierType barrierType, boolean compressible) {
-        super(TYPE, object, location, StampFactory.forKind(readKind), barrierType);
+    public JavaReadNode(Kind readKind, AddressNode address, LocationIdentity location, BarrierType barrierType, boolean compressible) {
+        super(TYPE, address, location, StampFactory.forKind(readKind), barrierType);
         this.readKind = readKind;
         this.compressible = compressible;
     }
@@ -66,6 +66,6 @@
 
     @Override
     public Node canonical(CanonicalizerTool tool) {
-        return ReadNode.canonicalizeRead(this, location(), object(), tool);
+        return ReadNode.canonicalizeRead(this, getAddress(), getLocationIdentity(), tool);
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -26,6 +26,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.jvmci.meta.*;
 
@@ -40,8 +41,8 @@
     protected final Kind writeKind;
     protected final boolean compressible;
 
-    public JavaWriteNode(Kind writeKind, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean compressible, boolean initialization) {
-        super(TYPE, object, value, location, barrierType, initialization);
+    public JavaWriteNode(Kind writeKind, AddressNode address, LocationIdentity location, ValueNode value, BarrierType barrierType, boolean compressible, boolean initialization) {
+        super(TYPE, address, location, value, barrierType, initialization);
         this.writeKind = writeKind;
         this.compressible = compressible;
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -49,6 +49,15 @@
         return stampProvider.createHubStamp(((ObjectStamp) value.stamp()));
     }
 
+    public static ValueNode create(ValueNode value, StampProvider stampProvider, MetaAccessProvider metaAccess) {
+        Stamp stamp = hubStamp(stampProvider, value);
+        ValueNode synonym = findSynonym(value, stamp, null, metaAccess);
+        if (synonym != null) {
+            return synonym;
+        }
+        return new LoadHubNode(stamp, value, null);
+    }
+
     public LoadHubNode(@InjectedNodeParameter StampProvider stampProvider, ValueNode value) {
         this(stampProvider, value, null);
     }
@@ -74,25 +83,33 @@
     @Override
     public ValueNode canonical(CanonicalizerTool tool) {
         MetaAccessProvider metaAccess = tool.getMetaAccess();
-        if (metaAccess != null && getValue().stamp() instanceof ObjectStamp) {
-            ObjectStamp objectStamp = (ObjectStamp) getValue().stamp();
+        ValueNode curValue = getValue();
+        ValueNode newNode = findSynonym(curValue, stamp(), graph(), metaAccess);
+        if (newNode != null) {
+            return newNode;
+        }
+        return this;
+    }
 
+    private static ValueNode findSynonym(ValueNode curValue, Stamp stamp, StructuredGraph graph, MetaAccessProvider metaAccess) {
+        if (metaAccess != null && curValue.stamp() instanceof ObjectStamp) {
+            ObjectStamp objectStamp = (ObjectStamp) curValue.stamp();
             ResolvedJavaType exactType = null;
             if (objectStamp.isExactType()) {
                 exactType = objectStamp.type();
-            } else if (objectStamp.type() != null && graph() != null && graph().getAssumptions() != null) {
+            } else if (objectStamp.type() != null && graph != null && graph.getAssumptions() != null) {
                 AssumptionResult<ResolvedJavaType> leafConcreteSubtype = objectStamp.type().findLeafConcreteSubtype();
                 if (leafConcreteSubtype != null) {
                     exactType = leafConcreteSubtype.getResult();
-                    graph().getAssumptions().record(leafConcreteSubtype);
+                    graph.getAssumptions().record(leafConcreteSubtype);
                 }
             }
 
             if (exactType != null) {
-                return ConstantNode.forConstant(stamp(), exactType.getObjectHub(), metaAccess);
+                return ConstantNode.forConstant(stamp, exactType.getObjectHub(), metaAccess);
             }
         }
-        return this;
+        return null;
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +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.nodes.extended;
-
-import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.graph.Node.ValueNumberable;
-import com.oracle.graal.graph.*;
-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
- * locations have the form [base + location], where base is a node and location is defined by
- * subclasses of the {@link LocationNode}.
- */
-@NodeInfo(allowedUsageTypes = {InputType.Association})
-public abstract class LocationNode extends FloatingNode implements LIRLowerable, ValueNumberable {
-
-    public static final NodeClass<LocationNode> TYPE = NodeClass.create(LocationNode.class);
-
-    /**
-     * Marker interface for locations in snippets.
-     */
-    public interface Location {
-    }
-
-    protected LocationNode(NodeClass<? extends LocationNode> c, Stamp stamp) {
-        super(c, stamp);
-    }
-
-    /**
-     * Returns the identity of the accessed memory location.
-     */
-    public abstract LocationIdentity getLocationIdentity();
-
-    @Override
-    public final void generate(NodeLIRBuilderTool generator) {
-        // nothing to do...
-    }
-
-    public abstract Value generateAddress(NodeMappableLIRBuilder builder, LIRGeneratorTool gen, Value base);
-
-    /**
-     * @return the range of the displacement as a 64-bit integer stamp
-     */
-    public abstract IntegerStamp getDisplacementStamp();
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewObjectNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewObjectNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -31,6 +31,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 
 /**
@@ -62,20 +63,31 @@
                 if (((FixedValueAnchorNode) usage).usages().isNotEmpty()) {
                     return;
                 }
-            } else if (usage instanceof WriteNode) {
-                if (((WriteNode) usage).object() != this || usage.usages().isNotEmpty()) {
-                    // we would need to fix up the memory graph if the write has usages
+            } else if (usage instanceof OffsetAddressNode) {
+                if (((OffsetAddressNode) usage).getBase() != this) {
                     return;
                 }
+                for (Node access : usage.usages()) {
+                    if (access instanceof WriteNode) {
+                        if (access.usages().isNotEmpty()) {
+                            // we would need to fix up the memory graph if the write has usages
+                            return;
+                        }
+                    } else {
+                        return;
+                    }
+                }
             } else {
                 return;
             }
         }
         for (Node usage : usages().distinct().snapshot()) {
-            List<Node> snapshot = usage.inputs().snapshot();
-            graph().removeFixed((FixedWithNextNode) usage);
-            for (Node input : snapshot) {
-                tool.removeIfUnused(input);
+            if (usage instanceof OffsetAddressNode) {
+                for (Node access : usage.usages().snapshot()) {
+                    removeUsage(tool, (FixedWithNextNode) access);
+                }
+            } else {
+                removeUsage(tool, (FixedWithNextNode) usage);
             }
         }
         List<Node> snapshot = inputs().snapshot();
@@ -85,6 +97,14 @@
         }
     }
 
+    private void removeUsage(SimplifierTool tool, FixedWithNextNode usage) {
+        List<Node> snapshot = usage.inputs().snapshot();
+        graph().removeFixed(usage);
+        for (Node input : snapshot) {
+            tool.removeIfUnused(input);
+        }
+    }
+
     @Override
     public void lower(LoweringTool tool) {
         tool.getLowerer().lower(this, tool);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -28,8 +28,8 @@
 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.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.jvmci.meta.*;
 
@@ -40,28 +40,18 @@
 public final class AtomicReadAndAddNode extends AbstractMemoryCheckpoint implements LIRLowerable, MemoryCheckpoint.Single {
 
     public static final NodeClass<AtomicReadAndAddNode> TYPE = NodeClass.create(AtomicReadAndAddNode.class);
-    @Input ValueNode object;
-    @Input ValueNode offset;
+    @Input(InputType.Association) AddressNode address;
     @Input ValueNode delta;
 
     protected final LocationIdentity locationIdentity;
 
-    public AtomicReadAndAddNode(ValueNode object, ValueNode offset, ValueNode delta, LocationIdentity locationIdentity) {
+    public AtomicReadAndAddNode(AddressNode address, ValueNode delta, LocationIdentity locationIdentity) {
         super(TYPE, StampFactory.forKind(delta.getKind()));
-        this.object = object;
-        this.offset = offset;
+        this.address = address;
         this.delta = delta;
         this.locationIdentity = locationIdentity;
     }
 
-    public ValueNode object() {
-        return object;
-    }
-
-    public ValueNode offset() {
-        return offset;
-    }
-
     public ValueNode delta() {
         return delta;
     }
@@ -71,9 +61,7 @@
     }
 
     public void generate(NodeLIRBuilderTool gen) {
-        LocationNode location = graph().unique(new IndexedLocationNode(getLocationIdentity(), 0, offset, 1));
-        Value address = location.generateAddress(gen, gen.getLIRGeneratorTool(), gen.operand(object()));
-        Value result = gen.getLIRGeneratorTool().emitAtomicReadAndAdd(address, gen.operand(delta));
+        Value result = gen.getLIRGeneratorTool().emitAtomicReadAndAdd(gen.operand(address), gen.operand(delta));
         gen.setResult(this, result);
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -120,18 +120,21 @@
     public void lower(LoweringTool tool) {
         Stamp newStamp = StampFactory.declaredTrusted(type).improveWith(object().stamp());
         LogicNode condition;
+        LogicNode innerNode = null;
         ValueNode theValue = object;
         if (newStamp.isEmpty()) {
             // This is a check cast that will always fail
             condition = LogicConstantNode.contradiction(graph());
             newStamp = StampFactory.declaredTrusted(type);
         } else if (StampTool.isPointerNonNull(object)) {
-            condition = graph().addWithoutUnique(new InstanceOfNode(type, object, profile));
+            condition = graph().addWithoutUnique(InstanceOfNode.create(type, object, profile));
+            innerNode = condition;
         } else {
             if (profile != null && profile.getNullSeen() == TriState.FALSE) {
                 FixedGuardNode nullCheck = graph().add(new FixedGuardNode(graph().unique(new IsNullNode(object)), UnreachedCode, InvalidateReprofile, true));
                 PiNode nullGuarded = graph().unique(new PiNode(object, object().stamp().join(StampFactory.objectNonNull()), nullCheck));
-                InstanceOfNode typeTest = graph().addWithoutUnique(new InstanceOfNode(type, nullGuarded, profile));
+                LogicNode typeTest = graph().addWithoutUnique(InstanceOfNode.create(type, nullGuarded, profile));
+                innerNode = typeTest;
                 graph().addBeforeFixed(this, nullCheck);
                 condition = typeTest;
                 /*
@@ -145,15 +148,20 @@
             } else {
                 // TODO (ds) replace with probability of null-seen when available
                 double shortCircuitProbability = NOT_FREQUENT_PROBABILITY;
-                InstanceOfNode typeTest = graph().addWithoutUnique(new InstanceOfNode(type, object, profile));
+                LogicNode typeTest = graph().addOrUnique(InstanceOfNode.create(type, object, profile));
+                innerNode = typeTest;
                 condition = LogicNode.or(graph().unique(new IsNullNode(object)), typeTest, shortCircuitProbability);
             }
         }
         GuardingNode guard = tool.createGuard(next(), condition, forStoreCheck ? ArrayStoreException : ClassCastException, InvalidateReprofile, false);
         ValueAnchorNode valueAnchor = graph().add(new ValueAnchorNode((ValueNode) guard));
-        PiNode piNode = graph().unique(new PiNode(theValue, newStamp, valueAnchor));
+        PiNode piNode = graph().unique(new PiNode(theValue, newStamp, (ValueNode) guard));
         this.replaceAtUsages(piNode);
         graph().replaceFixedWithFixed(this, valueAnchor);
+
+        if (innerNode instanceof Lowerable) {
+            tool.getLowerer().lower(innerNode, tool);
+        }
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -69,7 +69,7 @@
                 if (t.isPrimitive()) {
                     return LogicConstantNode.contradiction();
                 } else {
-                    return new InstanceOfNode(t, forObject, null);
+                    return InstanceOfNode.create(t, forObject, null);
                 }
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -42,7 +42,7 @@
     protected final ResolvedJavaType type;
     protected JavaTypeProfile profile;
 
-    public InstanceOfNode(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile) {
+    private InstanceOfNode(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile) {
         this(TYPE, type, object, profile);
     }
 
@@ -55,7 +55,7 @@
 
     public static LogicNode create(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile) {
         ObjectStamp objectStamp = (ObjectStamp) object.stamp();
-        LogicNode constantValue = findSynonym(type, objectStamp.type(), objectStamp.nonNull(), objectStamp.isExactType());
+        LogicNode constantValue = findSynonym(object, type, objectStamp.type(), objectStamp.nonNull(), objectStamp.isExactType());
         if (constantValue != null) {
             return constantValue;
         } else {
@@ -100,7 +100,7 @@
     }
 
     private ValueNode checkInstanceOf(ValueNode forValue, ResolvedJavaType inputType, boolean nonNull, boolean exactType) {
-        ValueNode result = findSynonym(type(), inputType, nonNull, exactType);
+        ValueNode result = findSynonym(forValue, type(), inputType, nonNull, exactType);
         if (result != null) {
             return result;
         }
@@ -114,7 +114,7 @@
         return null;
     }
 
-    public static LogicNode findSynonym(ResolvedJavaType type, ResolvedJavaType inputType, boolean nonNull, boolean exactType) {
+    public static LogicNode findSynonym(ValueNode object, ResolvedJavaType type, ResolvedJavaType inputType, boolean nonNull, boolean exactType) {
         if (inputType == null) {
             return null;
         }
@@ -139,6 +139,10 @@
                 // really know if it might be true at run time...
             }
         }
+
+        if (type.isFinal() && nonNull) {
+            return TypeCheckNode.create(type, object);
+        }
         return null;
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -27,8 +27,8 @@
 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.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.jvmci.meta.*;
 
@@ -43,8 +43,8 @@
     @Input ValueNode newValue;
     @OptionalInput(InputType.State) FrameState stateAfter;
 
-    public LoweredAtomicReadAndWriteNode(ValueNode object, LocationNode location, ValueNode newValue, BarrierType barrierType) {
-        super(TYPE, object, location, newValue.stamp().unrestricted(), barrierType);
+    public LoweredAtomicReadAndWriteNode(AddressNode address, LocationIdentity location, ValueNode newValue, BarrierType barrierType) {
+        super(TYPE, address, location, newValue.stamp().unrestricted(), barrierType);
         this.newValue = newValue;
     }
 
@@ -62,13 +62,8 @@
         return true;
     }
 
-    public LocationIdentity getLocationIdentity() {
-        return location().getLocationIdentity();
-    }
-
     public void generate(NodeLIRBuilderTool gen) {
-        Value address = location().generateAddress(gen, gen.getLIRGeneratorTool(), gen.operand(object()));
-        Value result = gen.getLIRGeneratorTool().emitAtomicReadAndWrite(address, gen.operand(getNewValue()));
+        Value result = gen.getLIRGeneratorTool().emitAtomicReadAndWrite(gen.operand(getAddress()), gen.operand(getNewValue()));
         gen.setResult(this, result);
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -26,8 +26,8 @@
 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.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.jvmci.meta.*;
 
@@ -64,18 +64,13 @@
         return newValue;
     }
 
-    public LoweredCompareAndSwapNode(ValueNode object, LocationNode location, ValueNode expectedValue, ValueNode newValue, BarrierType barrierType) {
-        super(TYPE, object, location, StampFactory.forKind(Kind.Boolean.getStackKind()), barrierType);
+    public LoweredCompareAndSwapNode(AddressNode address, LocationIdentity location, ValueNode expectedValue, ValueNode newValue, BarrierType barrierType) {
+        super(TYPE, address, location, StampFactory.forKind(Kind.Boolean.getStackKind()), barrierType);
         assert expectedValue.getKind() == newValue.getKind();
         this.expectedValue = expectedValue;
         this.newValue = newValue;
     }
 
-    @Override
-    public LocationIdentity getLocationIdentity() {
-        return location().getLocationIdentity();
-    }
-
     public boolean canNullCheck() {
         return false;
     }
@@ -83,8 +78,7 @@
     @Override
     public void generate(NodeLIRBuilderTool gen) {
         assert getNewValue().stamp().isCompatible(getExpectedValue().stamp());
-        Value address = location().generateAddress(gen, gen.getLIRGeneratorTool(), gen.operand(object()));
-        Value result = gen.getLIRGeneratorTool().emitCompareAndSwap(address, gen.operand(getExpectedValue()), gen.operand(getNewValue()), JavaConstant.INT_1, JavaConstant.INT_0);
+        Value result = gen.getLIRGeneratorTool().emitCompareAndSwap(gen.operand(getAddress()), gen.operand(getExpectedValue()), gen.operand(getNewValue()), JavaConstant.INT_1, JavaConstant.INT_0);
         gen.setResult(this, result);
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -215,7 +215,7 @@
                  * an assumption but as we need an instanceof check anyway we can verify both
                  * properties by checking of the receiver is an instance of the single implementor.
                  */
-                LogicNode condition = graph().unique(new InstanceOfNode(singleImplementor, receiver, getProfile()));
+                LogicNode condition = graph().unique(InstanceOfNode.create(singleImplementor, receiver, getProfile()));
                 FixedGuardNode guard = graph().add(new FixedGuardNode(condition, DeoptimizationReason.OptimizedTypeCheckViolated, DeoptimizationAction.InvalidateRecompile, false));
                 graph().addBeforeFixed(invoke().asNode(), guard);
                 PiNode piNode = graph().unique(new PiNode(receiver, StampFactory.declaredNonNull(singleImplementor), guard));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RawMonitorEnterNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,73 @@
+/*
+ * 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.nodes.java;
+
+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.memory.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * The {@code MonitorEnterNode} represents the acquisition of a monitor. The object needs already be
+ * non-null and the hub is an additional parameter to the node.
+ */
+@NodeInfo
+public final class RawMonitorEnterNode extends AccessMonitorNode implements Virtualizable, Lowerable, IterableNodeType, MonitorEnter, MemoryCheckpoint.Single {
+
+    public static final NodeClass<RawMonitorEnterNode> TYPE = NodeClass.create(RawMonitorEnterNode.class);
+
+    @Input ValueNode hub;
+
+    public RawMonitorEnterNode(ValueNode object, ValueNode hub, MonitorIdNode monitorId) {
+        super(TYPE, object, monitorId);
+        assert ((ObjectStamp) object.stamp()).nonNull();
+        this.hub = hub;
+    }
+
+    @Override
+    public LocationIdentity getLocationIdentity() {
+        return LocationIdentity.any();
+    }
+
+    @Override
+    public void lower(LoweringTool tool) {
+        tool.getLowerer().lower(this, tool);
+    }
+
+    @Override
+    public void virtualize(VirtualizerTool tool) {
+        State state = tool.getObjectState(object());
+        if (state != null && state.getState() == EscapeState.Virtual && state.getVirtualObject().hasIdentity()) {
+            state.addLock(getMonitorId());
+            tool.delete();
+        }
+    }
+
+    public ValueNode getHub() {
+        return hub;
+    }
+}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/AbstractWriteNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/AbstractWriteNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -27,6 +27,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.jvmci.meta.*;
 
 @NodeInfo(allowedUsageTypes = {InputType.Memory})
@@ -66,18 +67,19 @@
         return initialization;
     }
 
-    protected AbstractWriteNode(NodeClass<? extends AbstractWriteNode> c, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType) {
-        this(c, object, value, location, barrierType, false);
+    protected AbstractWriteNode(NodeClass<? extends AbstractWriteNode> c, AddressNode address, LocationIdentity location, ValueNode value, BarrierType barrierType) {
+        this(c, address, location, value, barrierType, false);
     }
 
-    protected AbstractWriteNode(NodeClass<? extends AbstractWriteNode> c, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean initialization) {
-        super(c, object, location, StampFactory.forVoid(), barrierType);
+    protected AbstractWriteNode(NodeClass<? extends AbstractWriteNode> c, AddressNode address, LocationIdentity location, ValueNode value, BarrierType barrierType, boolean initialization) {
+        super(c, address, location, StampFactory.forVoid(), barrierType);
         this.value = value;
         this.initialization = initialization;
     }
 
-    protected AbstractWriteNode(NodeClass<? extends AbstractWriteNode> c, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, GuardingNode guard, boolean initialization) {
-        super(c, object, location, StampFactory.forVoid(), guard, barrierType, false, null);
+    protected AbstractWriteNode(NodeClass<? extends AbstractWriteNode> c, AddressNode address, LocationIdentity location, ValueNode value, BarrierType barrierType, GuardingNode guard,
+                    boolean initialization) {
+        super(c, address, location, StampFactory.forVoid(), guard, barrierType, false, null);
         this.value = value;
         this.initialization = initialization;
     }
@@ -87,11 +89,6 @@
         return (type == InputType.Guard && getNullCheck()) ? true : super.isAllowedUsageType(type);
     }
 
-    @Override
-    public LocationIdentity getLocationIdentity() {
-        return location().getLocationIdentity();
-    }
-
     public MemoryNode getLastLocationAccess() {
         return (MemoryNode) lastLocationAccess;
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/Access.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/Access.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,14 +22,15 @@
  */
 package com.oracle.graal.nodes.memory;
 
-import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.jvmci.meta.*;
 
 public interface Access extends GuardedNode, HeapAccess {
 
-    ValueNode object();
+    AddressNode getAddress();
 
-    LocationNode accessLocation();
+    LocationIdentity getLocationIdentity();
 
     boolean canNullCheck();
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FixedAccessNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FixedAccessNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -27,36 +27,36 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.jvmci.meta.*;
 
 /**
- * Accesses a value at an memory address specified by an {@linkplain #object object} and a
- * {@linkplain #accessLocation() location}. The access does not include a null check on the object.
+ * Accesses a value at an memory address specified by an {@linkplain #address address}. The access
+ * does not include a null check on the object.
  */
 @NodeInfo
 public abstract class FixedAccessNode extends DeoptimizingFixedWithNextNode implements Access {
     public static final NodeClass<FixedAccessNode> TYPE = NodeClass.create(FixedAccessNode.class);
 
     @OptionalInput(InputType.Guard) protected GuardingNode guard;
-    @Input protected ValueNode object;
-    @Input(InputType.Association) protected ValueNode location;
+
+    @Input(InputType.Association) AddressNode address;
+    protected final LocationIdentity location;
+
     protected boolean nullCheck;
     protected BarrierType barrierType;
 
-    public ValueNode object() {
-        return object;
+    public AddressNode getAddress() {
+        return address;
     }
 
-    protected void setObject(ValueNode x) {
-        updateUsages(object, x);
-        object = x;
+    public void setAddress(AddressNode address) {
+        updateUsages(this.address, address);
+        this.address = address;
     }
 
-    public LocationNode location() {
-        return (LocationNode) location;
-    }
-
-    public LocationNode accessLocation() {
-        return (LocationNode) location;
+    public LocationIdentity getLocationIdentity() {
+        return location;
     }
 
     public boolean getNullCheck() {
@@ -67,18 +67,18 @@
         this.nullCheck = check;
     }
 
-    protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, ValueNode object, ValueNode location, Stamp stamp) {
-        this(c, object, location, stamp, BarrierType.NONE);
+    protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp) {
+        this(c, address, location, stamp, BarrierType.NONE);
     }
 
-    protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) {
-        this(c, object, location, stamp, null, barrierType, false, null);
+    protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp, BarrierType barrierType) {
+        this(c, address, location, stamp, null, barrierType, false, null);
     }
 
-    protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck,
+    protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck,
                     FrameState stateBefore) {
         super(c, stamp, stateBefore);
-        this.object = object;
+        this.address = address;
         this.location = location;
         this.guard = guard;
         this.barrierType = barrierType;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatableAccessNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatableAccessNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -27,6 +27,8 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * An {@link FixedAccessNode} that can be converted to a {@link FloatingAccessNode}.
@@ -35,17 +37,17 @@
 public abstract class FloatableAccessNode extends FixedAccessNode {
     public static final NodeClass<FloatableAccessNode> TYPE = NodeClass.create(FloatableAccessNode.class);
 
-    protected FloatableAccessNode(NodeClass<? extends FloatableAccessNode> c, ValueNode object, ValueNode location, Stamp stamp) {
-        super(c, object, location, stamp);
+    protected FloatableAccessNode(NodeClass<? extends FloatableAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp) {
+        super(c, address, location, stamp);
     }
 
-    protected FloatableAccessNode(NodeClass<? extends FloatableAccessNode> c, ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
-        super(c, object, location, stamp, guard, barrierType, false, null);
+    protected FloatableAccessNode(NodeClass<? extends FloatableAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
+        super(c, address, location, stamp, guard, barrierType, false, null);
     }
 
-    protected FloatableAccessNode(NodeClass<? extends FloatableAccessNode> c, ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck,
-                    FrameState stateBefore) {
-        super(c, object, location, stamp, guard, barrierType, nullCheck, stateBefore);
+    protected FloatableAccessNode(NodeClass<? extends FloatableAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp, GuardingNode guard, BarrierType barrierType,
+                    boolean nullCheck, FrameState stateBefore) {
+        super(c, address, location, stamp, guard, barrierType, nullCheck, stateBefore);
     }
 
     public abstract FloatingAccessNode asFloatingNode(MemoryNode lastLocationAccess);
@@ -62,6 +64,6 @@
      * an attached write barrier with pre-semantics can not also float.
      */
     public boolean canFloat() {
-        return !forceFixed && location().getLocationIdentity().isSingle() && getBarrierType() == BarrierType.NONE;
+        return !forceFixed && getLocationIdentity().isSingle() && getBarrierType() == BarrierType.NONE;
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingAccessNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingAccessNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -27,50 +27,47 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public abstract class FloatingAccessNode extends FloatingGuardedNode implements Access, MemoryAccess {
     public static final NodeClass<FloatingAccessNode> TYPE = NodeClass.create(FloatingAccessNode.class);
 
-    @Input ValueNode object;
-    @Input(InputType.Association) LocationNode location;
+    @Input(InputType.Association) AddressNode address;
+    protected final LocationIdentity location;
+
     protected BarrierType barrierType;
 
-    public ValueNode object() {
-        return object;
-    }
-
-    public LocationNode location() {
-        return location;
-    }
-
-    public LocationNode accessLocation() {
-        return location;
-    }
-
-    public LocationIdentity getLocationIdentity() {
-        return location.getLocationIdentity();
-    }
-
-    protected FloatingAccessNode(NodeClass<? extends FloatingAccessNode> c, ValueNode object, LocationNode location, Stamp stamp) {
+    protected FloatingAccessNode(NodeClass<? extends FloatingAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp) {
         super(c, stamp);
-        this.object = object;
+        this.address = address;
         this.location = location;
     }
 
-    protected FloatingAccessNode(NodeClass<? extends FloatingAccessNode> c, ValueNode object, LocationNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
+    protected FloatingAccessNode(NodeClass<? extends FloatingAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
         super(c, stamp, guard);
-        this.object = object;
+        this.address = address;
         this.location = location;
         this.barrierType = barrierType;
     }
 
     @Override
+    public AddressNode getAddress() {
+        return address;
+    }
+
+    @Override
+    public LocationIdentity getLocationIdentity() {
+        return location;
+    }
+
+    @Override
     public BarrierType getBarrierType() {
         return barrierType;
     }
 
+    @Override
     public boolean canNullCheck() {
         return true;
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingReadNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingReadNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -28,6 +28,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.jvmci.meta.*;
 
@@ -41,16 +42,16 @@
 
     @OptionalInput(InputType.Memory) MemoryNode lastLocationAccess;
 
-    public FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp) {
-        this(object, location, lastLocationAccess, stamp, null, BarrierType.NONE);
+    public FloatingReadNode(AddressNode address, LocationIdentity location, MemoryNode lastLocationAccess, Stamp stamp) {
+        this(address, location, lastLocationAccess, stamp, null, BarrierType.NONE);
     }
 
-    public FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard) {
-        this(object, location, lastLocationAccess, stamp, guard, BarrierType.NONE);
+    public FloatingReadNode(AddressNode address, LocationIdentity location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard) {
+        this(address, location, lastLocationAccess, stamp, guard, BarrierType.NONE);
     }
 
-    public FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
-        super(TYPE, object, location, stamp, guard, barrierType);
+    public FloatingReadNode(AddressNode address, LocationIdentity location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
+        super(TYPE, address, location, stamp, guard, barrierType);
         this.lastLocationAccess = lastLocationAccess;
     }
 
@@ -65,22 +66,25 @@
 
     @Override
     public void generate(NodeLIRBuilderTool gen) {
-        Value address = location().generateAddress(gen, gen.getLIRGeneratorTool(), gen.operand(object()));
         LIRKind readKind = gen.getLIRGeneratorTool().getLIRKind(stamp());
-        gen.setResult(this, gen.getLIRGeneratorTool().emitLoad(readKind, address, null));
+        gen.setResult(this, gen.getLIRGeneratorTool().emitLoad(readKind, gen.operand(address), null));
     }
 
     @Override
     public Node canonical(CanonicalizerTool tool) {
-        if (object() instanceof PiNode && ((PiNode) object()).getGuard() == getGuard()) {
-            return new FloatingReadNode(((PiNode) object()).getOriginalNode(), location(), getLastLocationAccess(), stamp(), getGuard(), getBarrierType());
+        if (getAddress() instanceof OffsetAddressNode) {
+            OffsetAddressNode objAddress = (OffsetAddressNode) getAddress();
+            if (objAddress.getBase() instanceof PiNode && ((PiNode) objAddress.getBase()).getGuard() == getGuard()) {
+                OffsetAddressNode newAddress = new OffsetAddressNode(((PiNode) objAddress.getBase()).getOriginalNode(), objAddress.getOffset());
+                return new FloatingReadNode(newAddress, getLocationIdentity(), getLastLocationAccess(), stamp(), getGuard(), getBarrierType());
+            }
         }
-        return ReadNode.canonicalizeRead(this, location(), object(), tool);
+        return ReadNode.canonicalizeRead(this, getAddress(), getLocationIdentity(), tool);
     }
 
     @Override
     public FixedAccessNode asFixedNode() {
-        return graph().add(new ReadNode(object(), accessLocation(), stamp(), getGuard(), getBarrierType()));
+        return graph().add(new ReadNode(getAddress(), getLocationIdentity(), stamp(), getGuard(), getBarrierType()));
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/ReadNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/ReadNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -28,8 +28,8 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
 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.*;
@@ -38,36 +38,35 @@
  * Reads an {@linkplain FixedAccessNode accessed} value.
  */
 @NodeInfo
-public final class ReadNode extends FloatableAccessNode implements LIRLowerable, Canonicalizable, PiPushable, Virtualizable, GuardingNode {
+public final class ReadNode extends FloatableAccessNode implements LIRLowerable, Canonicalizable, Virtualizable, GuardingNode {
 
     public static final NodeClass<ReadNode> TYPE = NodeClass.create(ReadNode.class);
 
-    public ReadNode(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) {
-        super(TYPE, object, location, stamp, null, barrierType);
+    public ReadNode(AddressNode address, LocationIdentity location, Stamp stamp, BarrierType barrierType) {
+        super(TYPE, address, location, stamp, null, barrierType);
     }
 
-    public ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
-        super(TYPE, object, location, stamp, guard, barrierType);
+    public ReadNode(AddressNode address, LocationIdentity location, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
+        super(TYPE, address, location, stamp, guard, barrierType);
     }
 
-    public ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, FrameState stateBefore) {
-        super(TYPE, object, location, stamp, guard, barrierType, nullCheck, stateBefore);
+    public ReadNode(AddressNode address, LocationIdentity location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, FrameState stateBefore) {
+        super(TYPE, address, location, stamp, guard, barrierType, nullCheck, stateBefore);
     }
 
-    public ReadNode(ValueNode object, ValueNode location, ValueNode guard, BarrierType barrierType) {
+    public ReadNode(AddressNode address, LocationIdentity location, ValueNode guard, BarrierType barrierType) {
         /*
          * Used by node intrinsics. Really, you can trust me on that! Since the initial value for
          * location is a parameter, i.e., a ParameterNode, the constructor cannot use the declared
          * type LocationNode.
          */
-        super(TYPE, object, location, StampFactory.forNodeIntrinsic(), (GuardingNode) guard, barrierType);
+        super(TYPE, address, location, StampFactory.forNodeIntrinsic(), (GuardingNode) guard, barrierType);
     }
 
     @Override
     public void generate(NodeLIRBuilderTool gen) {
-        Value address = location().generateAddress(gen, gen.getLIRGeneratorTool(), gen.operand(object()));
         LIRKind readKind = gen.getLIRGeneratorTool().getLIRKind(stamp());
-        gen.setResult(this, gen.getLIRGeneratorTool().emitLoad(readKind, address, gen.state(this)));
+        gen.setResult(this, gen.getLIRGeneratorTool().emitLoad(readKind, gen.operand(address), gen.state(this)));
     }
 
     @Override
@@ -81,11 +80,15 @@
                 return null;
             }
         }
-        if (object() instanceof PiNode && ((PiNode) object()).getGuard() == getGuard()) {
-            return new ReadNode(((PiNode) object()).getOriginalNode(), location(), stamp(), getGuard(), getBarrierType(), getNullCheck(), stateBefore());
+        if (getAddress() instanceof OffsetAddressNode) {
+            OffsetAddressNode objAddress = (OffsetAddressNode) getAddress();
+            if (objAddress.getBase() instanceof PiNode && ((PiNode) objAddress.getBase()).getGuard() == getGuard()) {
+                OffsetAddressNode newAddress = new OffsetAddressNode(((PiNode) objAddress.getBase()).getOriginalNode(), objAddress.getOffset());
+                return new ReadNode(newAddress, getLocationIdentity(), stamp(), getGuard(), getBarrierType(), getNullCheck(), stateBefore());
+            }
         }
         if (!getNullCheck()) {
-            return canonicalizeRead(this, location(), object(), tool);
+            return canonicalizeRead(this, getAddress(), getLocationIdentity(), tool);
         } else {
             // if this read is a null check, then replacing it with the value is incorrect for
             // guard-type usages
@@ -95,7 +98,7 @@
 
     @Override
     public FloatingAccessNode asFloatingNode(MemoryNode lastLocationAccess) {
-        return graph().unique(new FloatingReadNode(object(), location(), lastLocationAccess, stamp(), getGuard(), getBarrierType()));
+        return graph().unique(new FloatingReadNode(getAddress(), getLocationIdentity(), lastLocationAccess, stamp(), getGuard(), getBarrierType()));
     }
 
     @Override
@@ -103,12 +106,14 @@
         return (getNullCheck() && type == InputType.Guard) ? true : super.isAllowedUsageType(type);
     }
 
-    public static ValueNode canonicalizeRead(ValueNode read, LocationNode location, ValueNode object, CanonicalizerTool tool) {
+    public static ValueNode canonicalizeRead(ValueNode read, AddressNode address, LocationIdentity locationIdentity, CanonicalizerTool tool) {
         MetaAccessProvider metaAccess = tool.getMetaAccess();
-        if (tool.canonicalizeReads()) {
-            if (metaAccess != null && object != null && object.isConstant() && !object.isNullConstant() && location instanceof ConstantLocationNode) {
-                long displacement = ((ConstantLocationNode) location).getDisplacement();
-                if ((location.getLocationIdentity().isImmutable())) {
+        if (tool.canonicalizeReads() && address instanceof OffsetAddressNode) {
+            OffsetAddressNode objAddress = (OffsetAddressNode) address;
+            ValueNode object = objAddress.getBase();
+            if (metaAccess != null && object.isConstant() && !object.isNullConstant() && objAddress.getOffset().isConstant()) {
+                long displacement = objAddress.getOffset().asJavaConstant().asLong();
+                if (locationIdentity.isImmutable()) {
                     Constant constant = read.stamp().readConstant(tool.getConstantReflection().getMemoryAccessProvider(), object.asConstant(), displacement);
                     if (constant != null) {
                         return ConstantNode.forConstant(read.stamp(), constant, metaAccess);
@@ -120,7 +125,7 @@
                     return ConstantNode.forConstant(read.stamp(), constant, metaAccess);
                 }
             }
-            if (location.getLocationIdentity().equals(LocationIdentity.ARRAY_LENGTH_LOCATION)) {
+            if (locationIdentity.equals(LocationIdentity.ARRAY_LENGTH_LOCATION)) {
                 ValueNode length = GraphUtil.arrayLength(object);
                 if (length != null) {
                     // TODO Does this need a PiCastNode to the positive range?
@@ -132,36 +137,6 @@
     }
 
     @Override
-    public boolean push(PiNode parent) {
-        if (!(location() instanceof ConstantLocationNode && parent.stamp() instanceof ObjectStamp && parent.object().stamp() instanceof ObjectStamp)) {
-            return false;
-        }
-
-        ObjectStamp piStamp = (ObjectStamp) parent.stamp();
-        ResolvedJavaType receiverType = piStamp.type();
-        if (receiverType == null) {
-            return false;
-        }
-        ConstantLocationNode constantLocationNode = (ConstantLocationNode) location();
-        ResolvedJavaField field = receiverType.findInstanceFieldWithOffset(constantLocationNode.getDisplacement(), constantLocationNode.getKind());
-        if (field == null) {
-            // field was not declared by receiverType
-            return false;
-        }
-
-        ObjectStamp valueStamp = (ObjectStamp) parent.object().stamp();
-        ResolvedJavaType valueType = StampTool.typeOrNull(valueStamp);
-        if (valueType != null && field.getDeclaringClass().isAssignableFrom(valueType)) {
-            if (piStamp.nonNull() == valueStamp.nonNull() && piStamp.alwaysNull() == valueStamp.alwaysNull()) {
-                replaceFirstInput(parent, parent.object());
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    @Override
     public void virtualize(VirtualizerTool tool) {
         throw JVMCIError.shouldNotReachHere("unexpected ReadNode before PEA");
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/WriteNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/WriteNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -27,7 +27,8 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.extended.LocationNode.Location;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.graal.nodes.memory.address.AddressNode.Address;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.jvmci.common.*;
 import com.oracle.jvmci.meta.*;
@@ -40,34 +41,42 @@
 
     public static final NodeClass<WriteNode> TYPE = NodeClass.create(WriteNode.class);
 
-    public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType) {
-        super(TYPE, object, value, location, barrierType);
+    private WriteNode(ValueNode address, LocationIdentity location, ValueNode value, BarrierType barrierType) {
+        this((AddressNode) address, location, value, barrierType);
     }
 
-    public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean initialization) {
-        super(TYPE, object, value, location, barrierType, initialization);
+    public WriteNode(AddressNode address, LocationIdentity location, ValueNode value, BarrierType barrierType) {
+        super(TYPE, address, location, value, barrierType);
     }
 
-    public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, GuardingNode guard, boolean initialization) {
-        super(TYPE, object, value, location, barrierType, guard, initialization);
+    public WriteNode(AddressNode address, LocationIdentity location, ValueNode value, BarrierType barrierType, boolean initialization) {
+        super(TYPE, address, location, value, barrierType, initialization);
+    }
+
+    public WriteNode(AddressNode address, LocationIdentity location, ValueNode value, BarrierType barrierType, GuardingNode guard, boolean initialization) {
+        super(TYPE, address, location, value, barrierType, guard, initialization);
     }
 
     @Override
     public void generate(NodeLIRBuilderTool gen) {
-        Value address = location().generateAddress(gen, gen.getLIRGeneratorTool(), gen.operand(object()));
         LIRKind writeKind = gen.getLIRGeneratorTool().getLIRKind(value().stamp());
-        gen.getLIRGeneratorTool().emitStore(writeKind, address, gen.operand(value()), gen.state(this));
+        gen.getLIRGeneratorTool().emitStore(writeKind, gen.operand(address), gen.operand(value()), gen.state(this));
     }
 
     @Override
     public void simplify(SimplifierTool tool) {
-        if (object() instanceof PiNode && ((PiNode) object()).getGuard() == getGuard()) {
-            setObject(((PiNode) object()).getOriginalNode());
+        if (getAddress() instanceof OffsetAddressNode) {
+            OffsetAddressNode objAddress = (OffsetAddressNode) getAddress();
+            if (objAddress.getBase() instanceof PiNode && ((PiNode) objAddress.getBase()).getGuard() == getGuard()) {
+                OffsetAddressNode newAddress = graph().unique(new OffsetAddressNode(((PiNode) objAddress.getBase()).getOriginalNode(), objAddress.getOffset()));
+                setAddress(newAddress);
+                tool.addToWorkList(newAddress);
+            }
         }
     }
 
     @NodeIntrinsic
-    public static native void writeMemory(Object object, Object value, Location location, @ConstantNodeParameter BarrierType barrierType);
+    public static native void writeMemory(Address address, @ConstantNodeParameter LocationIdentity location, Object value, @ConstantNodeParameter BarrierType barrierType);
 
     @Override
     public void virtualize(VirtualizerTool tool) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/address/AddressNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * 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.nodes.memory.address;
+
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.calc.*;
+
+/**
+ * Base class for nodes that deal with addressing calculation.
+ */
+@NodeInfo(allowedUsageTypes = InputType.Association)
+public abstract class AddressNode extends FloatingNode {
+    public static final NodeClass<AddressNode> TYPE = NodeClass.create(AddressNode.class);
+
+    protected AddressNode(NodeClass<? extends AddressNode> c) {
+        super(c, StampFactory.pointer());
+    }
+
+    public abstract static class Address extends StructuralInput.Association {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/address/OffsetAddressNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,115 @@
+/*
+ * 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.nodes.memory.address;
+
+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.calc.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Represents an address that is composed of a base and an offset. The base can be either a
+ * {@link Kind#Object}, a word-sized integer or another pointer. The offset must be a word-sized
+ * integer.
+ */
+@NodeInfo(allowedUsageTypes = InputType.Association)
+public class OffsetAddressNode extends AddressNode implements Canonicalizable, PiPushable {
+    public static final NodeClass<OffsetAddressNode> TYPE = NodeClass.create(OffsetAddressNode.class);
+
+    @Input ValueNode base;
+    @Input ValueNode offset;
+
+    public OffsetAddressNode(ValueNode base, ValueNode offset) {
+        super(TYPE);
+        this.base = base;
+        this.offset = offset;
+    }
+
+    public ValueNode getBase() {
+        return base;
+    }
+
+    public void setBase(ValueNode base) {
+        updateUsages(this.base, base);
+        this.base = base;
+    }
+
+    public ValueNode getOffset() {
+        return offset;
+    }
+
+    public void setOffset(ValueNode offset) {
+        updateUsages(this.offset, offset);
+        this.offset = offset;
+    }
+
+    public Node canonical(CanonicalizerTool tool) {
+        if (base instanceof RawAddressNode) {
+            // The RawAddressNode is redundant, just directly use its input as base.
+            return new OffsetAddressNode(((RawAddressNode) base).getAddress(), offset);
+        } else if (base instanceof OffsetAddressNode) {
+            // Rewrite (&base[offset1])[offset2] to base[offset1 + offset2].
+            OffsetAddressNode b = (OffsetAddressNode) base;
+            return new OffsetAddressNode(b.getBase(), BinaryArithmeticNode.add(b.getOffset(), this.getOffset()));
+        } else {
+            return this;
+        }
+    }
+
+    @Override
+    public boolean push(PiNode parent) {
+        if (!(offset.isConstant() && parent.stamp() instanceof ObjectStamp && parent.object().stamp() instanceof ObjectStamp)) {
+            return false;
+        }
+
+        ObjectStamp piStamp = (ObjectStamp) parent.stamp();
+        ResolvedJavaType receiverType = piStamp.type();
+        if (receiverType == null) {
+            return false;
+        }
+        ResolvedJavaField field = receiverType.findInstanceFieldWithOffset(offset.asJavaConstant().asLong(), Kind.Void);
+        if (field == null) {
+            // field was not declared by receiverType
+            return false;
+        }
+
+        ObjectStamp valueStamp = (ObjectStamp) parent.object().stamp();
+        ResolvedJavaType valueType = StampTool.typeOrNull(valueStamp);
+        if (valueType != null && field.getDeclaringClass().isAssignableFrom(valueType)) {
+            if (piStamp.nonNull() == valueStamp.nonNull() && piStamp.alwaysNull() == valueStamp.alwaysNull()) {
+                replaceFirstInput(parent, parent.object());
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    @NodeIntrinsic
+    public static native Address address(Object base, long offset);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/address/RawAddressNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,57 @@
+/*
+ * 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.nodes.memory.address;
+
+import com.oracle.graal.graph.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.*;
+
+/**
+ * Convert a word-sized integer to a raw address.
+ */
+@NodeInfo(allowedUsageTypes = InputType.Association)
+public class RawAddressNode extends AddressNode {
+    public static final NodeClass<RawAddressNode> TYPE = NodeClass.create(RawAddressNode.class);
+
+    @Input ValueNode address;
+
+    public RawAddressNode(ValueNode address) {
+        super(TYPE);
+        this.address = address;
+    }
+
+    public ValueNode getAddress() {
+        return address;
+    }
+
+    public void setAddress(ValueNode address) {
+        updateUsages(this.address, address);
+        this.address = address;
+    }
+
+    @NodeIntrinsic
+    public static native Address address(long address);
+
+    @NodeIntrinsic
+    public static native Address address(Object address);
+}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2011, 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,9 +22,10 @@
  */
 package com.oracle.graal.nodes.spi;
 
+import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.jvmci.meta.*;
 
 /**
@@ -35,12 +36,17 @@
     void lower(Node n, LoweringTool tool);
 
     /**
-     * Reconstructs the array index from a location node that was created as a lowering of an
+     * Reconstructs the array index from an address node that was created as a lowering of an
      * indexed access to an array.
      *
      * @param elementKind the {@link Kind} of the array elements
-     * @param location a location pointing to an element in an array
+     * @param address an {@link AddressNode} pointing to an element in an array
      * @return a node that gives the index of the element
      */
-    ValueNode reconstructArrayIndex(Kind elementKind, LocationNode location);
+    ValueNode reconstructArrayIndex(Kind elementKind, AddressNode address);
+
+    /**
+     * Gets the platform specific size of a type in bytes.
+     */
+    int getSizeInBytes(Stamp stamp);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/AddressLoweringPhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,63 @@
+/*
+ * 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.phases.common;
+
+import com.oracle.graal.graph.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.memory.address.*;
+import com.oracle.graal.phases.*;
+
+public class AddressLoweringPhase extends Phase {
+
+    public abstract static class AddressLowering {
+
+        public abstract AddressNode lower(ValueNode address);
+
+        public abstract AddressNode lower(ValueNode base, ValueNode offset);
+    }
+
+    private final AddressLowering lowering;
+
+    public AddressLoweringPhase(AddressLowering lowering) {
+        this.lowering = lowering;
+        assert lowering != null;
+    }
+
+    @Override
+    protected void run(StructuredGraph graph) {
+        for (Node node : graph.getNodes()) {
+            AddressNode lowered;
+            if (node instanceof RawAddressNode) {
+                RawAddressNode address = (RawAddressNode) node;
+                lowered = lowering.lower(address.getAddress());
+            } else if (node instanceof OffsetAddressNode) {
+                OffsetAddressNode address = (OffsetAddressNode) node;
+                lowered = lowering.lower(address.getBase(), address.getOffset());
+            } else {
+                continue;
+            }
+
+            node.replaceAndDelete(lowered);
+        }
+    }
+}
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -328,7 +328,7 @@
 
         private static void processFloatable(FloatableAccessNode accessNode, MemoryMapImpl state) {
             StructuredGraph graph = accessNode.graph();
-            LocationIdentity locationIdentity = accessNode.location().getLocationIdentity();
+            LocationIdentity locationIdentity = accessNode.getLocationIdentity();
             if (accessNode.canFloat()) {
                 assert accessNode.getNullCheck() == false;
                 MemoryNode lastLocationAccess = state.getLastLocationAccess(locationIdentity);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.phases.common;
 
-import com.oracle.jvmci.meta.JavaConstant;
-
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
@@ -35,8 +33,8 @@
 import com.oracle.graal.nodes.StructuredGraph.GuardsStage;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.cfg.*;
-import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.graph.*;
@@ -44,6 +42,7 @@
 import com.oracle.graal.phases.schedule.SchedulePhase.SchedulingStrategy;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This phase lowers {@link GuardNode GuardNodes} into corresponding control-flow structure and
@@ -82,16 +81,23 @@
             if (node instanceof StateSplit && ((StateSplit) node).stateAfter() != null) {
                 nullGuarded.clear();
             } else {
-                Iterator<Entry<ValueNode, ValueNode>> it = nullGuarded.entrySet().iterator();
-                while (it.hasNext()) {
-                    Entry<ValueNode, ValueNode> entry = it.next();
-                    ValueNode guard = entry.getValue();
-                    if (guard.usages().contains(node)) {
-                        it.remove();
-                    } else if (guard instanceof PiNode && guard != node) {
-                        PiNode piNode = (PiNode) guard;
-                        if (piNode.getGuard().asNode().usages().contains(node)) {
+                /*
+                 * The OffsetAddressNode itself never forces materialization of a null check, even
+                 * if its input is a PiNode. The null check will be folded into the first usage of
+                 * the OffsetAddressNode, so we need to keep it in the nullGuarded map.
+                 */
+                if (!(node instanceof OffsetAddressNode)) {
+                    Iterator<Entry<ValueNode, ValueNode>> it = nullGuarded.entrySet().iterator();
+                    while (it.hasNext()) {
+                        Entry<ValueNode, ValueNode> entry = it.next();
+                        ValueNode guard = entry.getValue();
+                        if (guard.usages().contains(node)) {
                             it.remove();
+                        } else if (guard instanceof PiNode && guard != node) {
+                            PiNode piNode = (PiNode) guard;
+                            if (piNode.getGuard().asNode().usages().contains(node)) {
+                                it.remove();
+                            }
                         }
                     }
                 }
@@ -108,23 +114,23 @@
         }
 
         private void processAccess(Access access) {
-            if (access.canNullCheck()) {
-                ValueNode object = access.object();
-                check(access, object);
+            if (access.canNullCheck() && access.getAddress() instanceof OffsetAddressNode) {
+                OffsetAddressNode address = (OffsetAddressNode) access.getAddress();
+                check(access, address);
             }
         }
 
-        private void check(Access access, ValueNode object) {
-            ValueNode guard = nullGuarded.get(object);
-            if (guard != null && isImplicitNullCheck(access.accessLocation())) {
-                if (object instanceof PiNode) {
-                    PiNode piNode = (PiNode) object;
-                    if (access.object() == object) {
-                        access.asNode().replaceFirstInput(object, piNode.getOriginalNode());
-                    }
-                    if (!(piNode.getGuard() instanceof GuardNode)) {
-                        return;
-                    }
+        private void check(Access access, OffsetAddressNode address) {
+            ValueNode base = address.getBase();
+            ValueNode guard = nullGuarded.get(base);
+            if (guard != null && isImplicitNullCheck(address.getOffset())) {
+                if (guard instanceof PiNode) {
+                    PiNode piNode = (PiNode) guard;
+                    assert guard == address.getBase();
+                    assert piNode.getGuard() instanceof GuardNode : piNode;
+                    address.setBase(piNode.getOriginalNode());
+                } else {
+                    assert guard instanceof GuardNode;
                 }
                 metricImplicitNullCheck.increment();
                 access.setGuard(null);
@@ -154,7 +160,7 @@
                 if (condition.hasNoUsages()) {
                     GraphUtil.killWithUnusedFloatingInputs(condition);
                 }
-                nullGuarded.remove(fixedAccess.object());
+                nullGuarded.remove(base);
             }
         }
 
@@ -166,9 +172,10 @@
             }
         }
 
-        private boolean isImplicitNullCheck(LocationNode location) {
-            if (location instanceof ConstantLocationNode) {
-                return ((ConstantLocationNode) location).getDisplacement() < implicitNullCheckLimit;
+        private boolean isImplicitNullCheck(ValueNode offset) {
+            JavaConstant c = offset.asJavaConstant();
+            if (c != null) {
+                return c.asLong() < implicitNullCheckLimit;
             } else {
                 return false;
             }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LockEliminationPhase.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LockEliminationPhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -33,9 +33,9 @@
     protected void run(StructuredGraph graph) {
         for (MonitorExitNode node : graph.getNodes(MonitorExitNode.TYPE)) {
             FixedNode next = node.next();
-            if (next instanceof MonitorEnterNode) {
-                MonitorEnterNode monitorEnterNode = (MonitorEnterNode) next;
-                if (monitorEnterNode.object() == node.object()) {
+            if (next instanceof MonitorEnterNode || next instanceof RawMonitorEnterNode) {
+                AccessMonitorNode monitorEnterNode = (AccessMonitorNode) next;
+                if (GraphUtil.unproxify(monitorEnterNode.object()) == GraphUtil.unproxify(node.object())) {
                     GraphUtil.removeFixedWithUnusedInputs(monitorEnterNode);
                     GraphUtil.removeFixedWithUnusedInputs(node);
                 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -256,6 +256,7 @@
         @Override
         public void run(StructuredGraph graph) {
             schedule.apply(graph, false);
+            schedule.getCFG().computePostdominators();
             Block startBlock = schedule.getCFG().getStartBlock();
             ProcessFrame rootFrame = new ProcessFrame(startBlock, graph.createNodeBitMap(), startBlock.getBeginNode(), null);
             LoweringPhase.processBlock(rootFrame);
@@ -283,7 +284,13 @@
 
             @Override
             public Frame<?> enterAlwaysReached(Block b) {
-                return new ProcessFrame(b, activeGuards, anchor, this);
+                AnchoringNode newAnchor = anchor;
+                if (parent != null && b.getLoop() != parent.block.getLoop() && !b.isLoopHeader()) {
+                    // We are exiting a loop => cannot reuse the anchor without inserting loop
+                    // proxies.
+                    newAnchor = b.getBeginNode();
+                }
+                return new ProcessFrame(b, activeGuards, newAnchor, this);
             }
 
             @Override
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Tue Jun 09 19:07:39 2015 -0700
@@ -768,9 +768,9 @@
             }
         } else if (n instanceof FloatingReadNode) {
             FloatingReadNode frn = (FloatingReadNode) n;
-            buf.format(" // from %s", frn.location().getLocationIdentity());
+            buf.format(" // from %s", frn.getLocationIdentity());
             buf.format(", lastAccess: %s", frn.getLastLocationAccess());
-            buf.format(", object: %s", frn.object());
+            buf.format(", address: %s", frn.getAddress());
         } else if (n instanceof GuardNode) {
             buf.format(", anchor: %s", ((GuardNode) n).getAnchor());
         }
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Tue Jun 09 19:07:39 2015 -0700
@@ -114,6 +114,9 @@
         return object instanceof Graph || object instanceof BciBlockMapping;
     }
 
+    private LIR lastLIR = null;
+    private Interval[] delayedIntervals = null;
+
     public void dumpSandboxed(Object object, String message) {
 
         if (!dumpFrontend && isFrontendObject(object)) {
@@ -166,7 +169,11 @@
         } else if (object instanceof LIR) {
             // Currently no node printing for lir
             cfgPrinter.printCFG(message, cfgPrinter.lir.codeEmittingOrder(), false);
-
+            lastLIR = (LIR) object;
+            if (delayedIntervals != null) {
+                cfgPrinter.printIntervals(message, delayedIntervals);
+                delayedIntervals = null;
+            }
         } else if (object instanceof SchedulePhase) {
             cfgPrinter.printSchedule(message, (SchedulePhase) object);
         } else if (object instanceof StructuredGraph) {
@@ -183,7 +190,14 @@
             Object[] tuple = (Object[]) object;
             cfgPrinter.printMachineCode(disassemble(codeCache, (CompilationResult) tuple[0], (InstalledCode) tuple[1]), message);
         } else if (object instanceof Interval[]) {
-            cfgPrinter.printIntervals(message, (Interval[]) object);
+            if (lastLIR == cfgPrinter.lir) {
+                cfgPrinter.printIntervals(message, (Interval[]) object);
+            } else {
+                if (delayedIntervals != null) {
+                    Debug.log("Some delayed intervals were dropped (%s)", (Object) delayedIntervals);
+                }
+                delayedIntervals = (Interval[]) object;
+            }
         } else if (object instanceof StackInterval[]) {
             cfgPrinter.printStackIntervals(message, (StackInterval[]) object);
         }
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Tue Jun 09 18:48:06 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.printer;
-
-import static com.oracle.graal.compiler.GraalDebugConfig.*;
-import static com.oracle.graal.compiler.common.GraalOptions.*;
-
-import java.io.*;
-import java.util.*;
-
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.compiler.*;
-import com.oracle.jvmci.debug.*;
-
-public class DebugEnvironment {
-
-    @SuppressWarnings("all")
-    private static boolean assertionsEnabled() {
-        boolean assertionsEnabled = false;
-        assert assertionsEnabled = true;
-        return assertionsEnabled;
-    }
-
-    public static GraalDebugConfig initialize(PrintStream log) {
-
-        // Ensure Graal runtime is initialized prior to Debug being initialized as the former
-        // may include processing command line options used by the latter.
-        Graal.getRuntime();
-
-        if (!Debug.isEnabled()) {
-            log.println("WARNING: Scope debugging needs to be enabled with -esa or -D" + Debug.Initialization.INITIALIZER_PROPERTY_NAME + "=true");
-            return null;
-        }
-        List<DebugDumpHandler> dumpHandlers = new ArrayList<>();
-        dumpHandlers.add(new GraphPrinterDumpHandler());
-        if (PrintCFG.getValue() || PrintBackendCFG.getValue()) {
-            if (PrintBinaryGraphs.getValue() && PrintCFG.getValue()) {
-                TTY.println("Complete C1Visualizer dumping slows down PrintBinaryGraphs: use -G:-PrintCFG to disable it");
-            }
-            dumpHandlers.add(new CFGPrinterObserver(PrintCFG.getValue()));
-        }
-        List<DebugVerifyHandler> verifyHandlers = new ArrayList<>();
-        String verifyFilter = Verify.getValue();
-        if (verifyFilter == null && assertionsEnabled()) {
-            verifyFilter = "";
-        }
-        if (verifyFilter != null) {
-            verifyHandlers.add(new NoDeadCodeVerifyHandler());
-        }
-        GraalDebugConfig debugConfig = new GraalDebugConfig(Log.getValue(), Meter.getValue(), TrackMemUse.getValue(), Time.getValue(), Dump.getValue(), verifyFilter, MethodFilter.getValue(), log,
-                        dumpHandlers, verifyHandlers);
-        Debug.setConfig(debugConfig);
-        return debugConfig;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraalDebugConfigCustomizer.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,64 @@
+/*
+ * 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.printer;
+
+import static com.oracle.graal.compiler.common.GraalOptions.*;
+
+import com.oracle.graal.graph.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.service.*;
+
+@ServiceProvider(DebugConfigCustomizer.class)
+public class GraalDebugConfigCustomizer implements DebugConfigCustomizer {
+    public void customize(DebugConfig config) {
+        config.dumpHandlers().add(new GraphPrinterDumpHandler());
+        config.dumpHandlers().add(new NodeDumper());
+        if (PrintCFG.getValue() || PrintBackendCFG.getValue()) {
+            if (PrintBinaryGraphs.getValue() && PrintCFG.getValue()) {
+                TTY.out.println("Complete C1Visualizer dumping slows down PrintBinaryGraphs: use -G:-PrintCFG to disable it");
+            }
+            config.dumpHandlers().add(new CFGPrinterObserver(PrintCFG.getValue()));
+        }
+        config.verifyHandlers().add(new NoDeadCodeVerifyHandler());
+    }
+
+    private static class NodeDumper implements DebugDumpHandler {
+
+        public void dump(Object object, String message) {
+            if (object instanceof Node) {
+                String location = GraphUtil.approxSourceLocation((Node) object);
+                String node = ((Node) object).toString(Verbosity.Debugger);
+                if (location != null) {
+                    Debug.log("Context obj %s (approx. location: %s)", node, location);
+                } else {
+                    Debug.log("Context obj %s", node);
+                }
+            }
+        }
+
+        public void close() {
+        }
+    }
+}
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Tue Jun 09 19:07:39 2015 -0700
@@ -24,8 +24,9 @@
 
 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.*;
+import static com.oracle.jvmci.debug.JVMCIDebugConfig.*;
 
 import java.io.*;
 import java.net.*;
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64GraphBuilderPlugins.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64GraphBuilderPlugins.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -38,6 +38,7 @@
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.replacements.*;
 
 public class AMD64GraphBuilderPlugins {
@@ -126,7 +127,8 @@
                     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, new AtomicReadAndAddNode(object, offset, delta, LocationIdentity.any()));
+                        AddressNode address = b.add(new OffsetAddressNode(object, offset));
+                        b.addPush(kind, new AtomicReadAndAddNode(address, delta, LocationIdentity.any()));
                         return true;
                     }
                 });
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -50,7 +50,7 @@
     protected void replaceProfile(StructuredGraph graph, JavaTypeProfile profile) {
         InstanceOfNode ion = graph.getNodes().filter(InstanceOfNode.class).first();
         if (ion != null) {
-            InstanceOfNode ionNew = graph.unique(new InstanceOfNode(ion.type(), ion.getValue(), profile));
+            LogicNode ionNew = graph.unique(InstanceOfNode.create(ion.type(), ion.getValue(), profile));
             graph.replaceFloating(ion, ionNew);
         }
     }
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java	Tue Jun 09 19:07:39 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
@@ -29,6 +29,7 @@
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
 import com.oracle.jvmci.code.*;
@@ -97,19 +98,18 @@
     private static void assertRead(StructuredGraph graph, Kind kind, boolean indexConvert, LocationIdentity locationIdentity) {
         JavaReadNode read = (JavaReadNode) graph.start().next();
         Assert.assertEquals(kind.getStackKind(), read.stamp().getStackKind());
-        Assert.assertEquals(graph.getParameter(0), read.object());
 
-        IndexedLocationNode location = (IndexedLocationNode) read.location();
-        Assert.assertEquals(locationIdentity, location.getLocationIdentity());
-        Assert.assertEquals(1, location.getIndexScaling());
+        OffsetAddressNode address = (OffsetAddressNode) read.getAddress();
+        Assert.assertEquals(graph.getParameter(0), address.getBase());
+        Assert.assertEquals(locationIdentity, read.getLocationIdentity());
 
         if (indexConvert) {
-            SignExtendNode convert = (SignExtendNode) location.getIndex();
+            SignExtendNode convert = (SignExtendNode) address.getOffset();
             Assert.assertEquals(convert.getInputBits(), 32);
             Assert.assertEquals(convert.getResultBits(), 64);
             Assert.assertEquals(graph.getParameter(1), convert.getValue());
         } else {
-            Assert.assertEquals(graph.getParameter(1), location.getIndex());
+            Assert.assertEquals(graph.getParameter(1), address.getOffset());
         }
 
         ReturnNode ret = (ReturnNode) read.next();
@@ -119,20 +119,20 @@
     private static void assertWrite(StructuredGraph graph, boolean indexConvert, LocationIdentity locationIdentity) {
         JavaWriteNode write = (JavaWriteNode) graph.start().next();
         Assert.assertEquals(graph.getParameter(2), write.value());
-        Assert.assertEquals(graph.getParameter(0), write.object());
+
+        OffsetAddressNode address = (OffsetAddressNode) write.getAddress();
+        Assert.assertEquals(graph.getParameter(0), address.getBase());
         Assert.assertEquals(BytecodeFrame.AFTER_BCI, write.stateAfter().bci);
 
-        IndexedLocationNode location = (IndexedLocationNode) write.location();
-        Assert.assertEquals(locationIdentity, location.getLocationIdentity());
-        Assert.assertEquals(1, location.getIndexScaling());
+        Assert.assertEquals(locationIdentity, write.getLocationIdentity());
 
         if (indexConvert) {
-            SignExtendNode convert = (SignExtendNode) location.getIndex();
+            SignExtendNode convert = (SignExtendNode) address.getOffset();
             Assert.assertEquals(convert.getInputBits(), 32);
             Assert.assertEquals(convert.getResultBits(), 64);
             Assert.assertEquals(graph.getParameter(1), convert.getValue());
         } else {
-            Assert.assertEquals(graph.getParameter(1), location.getIndex());
+            Assert.assertEquals(graph.getParameter(1), address.getOffset());
         }
 
         ReturnNode ret = (ReturnNode) write.next();
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PEGraphDecoderTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PEGraphDecoderTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -30,9 +30,9 @@
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
 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.address.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
@@ -99,8 +99,8 @@
         r.register2("readInt", Object.class, long.class, new InvocationPlugin() {
             @Override
             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));
+                AddressNode address = b.add(new OffsetAddressNode(obj, offset));
+                ReadNode read = b.addPush(Kind.Int, new ReadNode(address, LocationIdentity.any(), StampFactory.forKind(Kind.Int), BarrierType.NONE));
                 read.setGuard(AbstractBeginNode.prevBegin(read));
                 return true;
             }
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java	Tue Jun 09 19:07:39 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
@@ -29,6 +29,7 @@
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
@@ -106,21 +107,20 @@
         JavaReadNode read = (JavaReadNode) cast.next();
         Assert.assertEquals(kind.getStackKind(), read.stamp().getStackKind());
 
-        Assert.assertEquals(cast, read.object());
+        OffsetAddressNode address = (OffsetAddressNode) read.getAddress();
+        Assert.assertEquals(cast, address.getBase());
         Assert.assertEquals(graph.getParameter(0), cast.getInput());
         Assert.assertEquals(target.wordKind, cast.stamp().getStackKind());
 
-        IndexedLocationNode location = (IndexedLocationNode) read.location();
-        Assert.assertEquals(locationIdentity, location.getLocationIdentity());
-        Assert.assertEquals(1, location.getIndexScaling());
+        Assert.assertEquals(locationIdentity, read.getLocationIdentity());
 
         if (indexConvert) {
-            SignExtendNode convert = (SignExtendNode) location.getIndex();
+            SignExtendNode convert = (SignExtendNode) address.getOffset();
             Assert.assertEquals(convert.getInputBits(), 32);
             Assert.assertEquals(convert.getResultBits(), 64);
             Assert.assertEquals(graph.getParameter(1), convert.getValue());
         } else {
-            Assert.assertEquals(graph.getParameter(1), location.getIndex());
+            Assert.assertEquals(graph.getParameter(1), address.getOffset());
         }
 
         ReturnNode ret = (ReturnNode) read.next();
@@ -134,21 +134,20 @@
         Assert.assertEquals(graph.getParameter(2), write.value());
         Assert.assertEquals(BytecodeFrame.AFTER_BCI, write.stateAfter().bci);
 
-        Assert.assertEquals(cast, write.object());
+        OffsetAddressNode address = (OffsetAddressNode) write.getAddress();
+        Assert.assertEquals(cast, address.getBase());
         Assert.assertEquals(graph.getParameter(0), cast.getInput());
         Assert.assertEquals(target.wordKind, cast.stamp().getStackKind());
 
-        IndexedLocationNode location = (IndexedLocationNode) write.location();
-        Assert.assertEquals(locationIdentity, location.getLocationIdentity());
-        Assert.assertEquals(1, location.getIndexScaling());
+        Assert.assertEquals(locationIdentity, write.getLocationIdentity());
 
         if (indexConvert) {
-            SignExtendNode convert = (SignExtendNode) location.getIndex();
+            SignExtendNode convert = (SignExtendNode) address.getOffset();
             Assert.assertEquals(convert.getInputBits(), 32);
             Assert.assertEquals(convert.getResultBits(), 64);
             Assert.assertEquals(graph.getParameter(1), convert.getValue());
         } else {
-            Assert.assertEquals(graph.getParameter(1), location.getIndex());
+            Assert.assertEquals(graph.getParameter(1), address.getOffset());
         }
 
         ReturnNode ret = (ReturnNode) write.next();
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -31,7 +31,6 @@
 import java.util.*;
 
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.asm.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
@@ -41,6 +40,7 @@
 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.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
@@ -73,6 +73,7 @@
 
     @Override
     public void lower(Node n, LoweringTool tool) {
+        assert n instanceof Lowerable;
         StructuredGraph graph = (StructuredGraph) n.graph();
         if (n instanceof LoadFieldNode) {
             lowerLoadFieldNode((LoadFieldNode) n, tool);
@@ -86,6 +87,8 @@
             lowerArrayLengthNode((ArrayLengthNode) n, tool);
         } else if (n instanceof LoadHubNode) {
             lowerLoadHubNode((LoadHubNode) n);
+        } else if (n instanceof MonitorEnterNode) {
+            lowerMonitorEnterNode((MonitorEnterNode) n, tool, graph);
         } else if (n instanceof CompareAndSwapNode) {
             lowerCompareAndSwapNode((CompareAndSwapNode) n);
         } else if (n instanceof AtomicReadAndWriteNode) {
@@ -105,9 +108,7 @@
         } else if (n instanceof UnboxNode) {
             boxingSnippets.lower((UnboxNode) n, tool);
         } else if (n instanceof TypeCheckNode) {
-            if (graph.getGuardsStage().areDeoptsFixed()) {
-                lowerTypeCheckNode((TypeCheckNode) n, tool, graph);
-            }
+            lowerTypeCheckNode((TypeCheckNode) n, tool, graph);
         } else if (n instanceof VerifyHeapNode) {
             lowerVerifyHeap((VerifyHeapNode) n);
         } else {
@@ -126,16 +127,31 @@
         GraphUtil.removeFixedWithUnusedInputs(n);
     }
 
+    protected AddressNode createOffsetAddress(StructuredGraph graph, ValueNode object, long offset) {
+        ValueNode o = ConstantNode.forIntegerKind(target.wordKind, offset, graph);
+        return graph.unique(new OffsetAddressNode(object, o));
+    }
+
+    protected AddressNode createFieldAddress(StructuredGraph graph, ValueNode object, ResolvedJavaField field) {
+        int offset = fieldOffset(field);
+        if (offset >= 0) {
+            return createOffsetAddress(graph, object, offset);
+        } else {
+            return null;
+        }
+    }
+
     protected void lowerLoadFieldNode(LoadFieldNode loadField, LoweringTool tool) {
         assert loadField.getKind() != Kind.Illegal;
         StructuredGraph graph = loadField.graph();
         ResolvedJavaField field = loadField.field();
         ValueNode object = loadField.isStatic() ? staticFieldBase(graph, field) : loadField.object();
         Stamp loadStamp = loadStamp(loadField.stamp(), field.getKind());
-        ConstantLocationNode location = createFieldLocation(graph, field, false);
-        assert location != null : "Field that is loaded must not be eliminated: " + field.getDeclaringClass().toJavaName(true) + "." + field.getName();
 
-        ReadNode memoryRead = graph.add(new ReadNode(object, location, loadStamp, fieldLoadBarrierType(field)));
+        AddressNode address = createFieldAddress(graph, object, field);
+        assert address != null : "Field that is loaded must not be eliminated: " + field.getDeclaringClass().toJavaName(true) + "." + field.getName();
+
+        ReadNode memoryRead = graph.add(new ReadNode(address, field.getLocationIdentity(), loadStamp, fieldLoadBarrierType(field)));
         ValueNode readValue = implicitLoadConvert(graph, field.getKind(), memoryRead);
         loadField.replaceAtUsages(readValue);
         graph.replaceFixed(loadField, memoryRead);
@@ -155,10 +171,10 @@
         ResolvedJavaField field = storeField.field();
         ValueNode object = storeField.isStatic() ? staticFieldBase(graph, field) : storeField.object();
         ValueNode value = implicitStoreConvert(graph, storeField.field().getKind(), storeField.value());
-        ConstantLocationNode location = createFieldLocation(graph, field, false);
-        assert location != null;
+        AddressNode address = createFieldAddress(graph, object, field);
+        assert address != null;
 
-        WriteNode memoryWrite = graph.add(new WriteNode(object, value, location, fieldStoreBarrierType(storeField.field())));
+        WriteNode memoryWrite = graph.add(new WriteNode(address, field.getLocationIdentity(), value, fieldStoreBarrierType(storeField.field())));
         memoryWrite.setStateAfter(storeField.stateAfter());
         graph.replaceFixedWithFixed(storeField, memoryWrite);
         memoryWrite.setGuard(createNullCheck(object, memoryWrite, tool));
@@ -171,16 +187,42 @@
         }
     }
 
+    public AddressNode createArrayAddress(StructuredGraph graph, ValueNode array, Kind elementKind, ValueNode index) {
+        ValueNode wordIndex;
+        if (target.wordSize > 4) {
+            wordIndex = graph.unique(new SignExtendNode(index, target.wordSize * 8));
+        } else {
+            assert target.wordSize == 4 : "unsupported word size";
+            wordIndex = index;
+        }
+
+        int shift = CodeUtil.log2(arrayScalingFactor(elementKind));
+        ValueNode scaledIndex = graph.unique(new LeftShiftNode(wordIndex, ConstantNode.forInt(shift, graph)));
+
+        int base = arrayBaseOffset(elementKind);
+        ValueNode offset = graph.unique(new AddNode(scaledIndex, ConstantNode.forIntegerKind(target.wordKind, base, graph)));
+
+        return graph.unique(new OffsetAddressNode(array, offset));
+    }
+
     protected void lowerLoadIndexedNode(LoadIndexedNode loadIndexed, LoweringTool tool) {
         StructuredGraph graph = loadIndexed.graph();
         Kind elementKind = loadIndexed.elementKind();
-        LocationNode location = createArrayLocation(graph, elementKind, loadIndexed.index(), false);
         Stamp loadStamp = loadStamp(loadIndexed.stamp(), elementKind);
 
-        ReadNode memoryRead = graph.add(new ReadNode(loadIndexed.array(), location, loadStamp, BarrierType.NONE));
+        PiNode pi = getBoundsCheckedIndex(loadIndexed, tool);
+        ValueNode checkedIndex = pi;
+        if (checkedIndex == null) {
+            checkedIndex = loadIndexed.index();
+        }
+
+        AddressNode address = createArrayAddress(graph, loadIndexed.array(), elementKind, checkedIndex);
+        ReadNode memoryRead = graph.add(new ReadNode(address, NamedLocationIdentity.getArrayLocation(elementKind), loadStamp, BarrierType.NONE));
         ValueNode readValue = implicitLoadConvert(graph, elementKind, memoryRead);
 
-        memoryRead.setGuard(createBoundsCheck(loadIndexed, tool));
+        if (pi != null) {
+            memoryRead.setGuard(pi.getGuard());
+        }
 
         loadIndexed.replaceAtUsages(readValue);
         graph.replaceFixed(loadIndexed, memoryRead);
@@ -188,9 +230,19 @@
 
     protected void lowerStoreIndexedNode(StoreIndexedNode storeIndexed, LoweringTool tool) {
         StructuredGraph graph = storeIndexed.graph();
-        GuardingNode boundsCheck = createBoundsCheck(storeIndexed, tool);
+
+        PiNode pi = getBoundsCheckedIndex(storeIndexed, tool);
+        ValueNode checkedIndex;
+        GuardingNode boundsCheck;
+        if (pi == null) {
+            checkedIndex = storeIndexed.index();
+            boundsCheck = null;
+        } else {
+            checkedIndex = pi;
+            boundsCheck = pi.getGuard();
+        }
+
         Kind elementKind = storeIndexed.elementKind();
-        LocationNode location = createArrayLocation(graph, elementKind, storeIndexed.index(), false);
 
         ValueNode value = storeIndexed.value();
         ValueNode array = storeIndexed.array();
@@ -214,7 +266,9 @@
             }
         }
 
-        WriteNode memoryWrite = graph.add(new WriteNode(array, implicitStoreConvert(graph, elementKind, value), location, arrayStoreBarrierType(storeIndexed.elementKind())));
+        AddressNode address = createArrayAddress(graph, array, elementKind, checkedIndex);
+        WriteNode memoryWrite = graph.add(new WriteNode(address, NamedLocationIdentity.getArrayLocation(elementKind), implicitStoreConvert(graph, elementKind, value),
+                        arrayStoreBarrierType(storeIndexed.elementKind())));
         memoryWrite.setGuard(boundsCheck);
         memoryWrite.setStateAfter(storeIndexed.stateAfter());
         graph.replaceFixedWithFixed(storeIndexed, memoryWrite);
@@ -228,9 +282,9 @@
     protected void lowerArrayLengthNode(ArrayLengthNode arrayLengthNode, LoweringTool tool) {
         StructuredGraph graph = arrayLengthNode.graph();
         ValueNode array = arrayLengthNode.array();
-        ConstantLocationNode location = graph.unique(new ConstantLocationNode(ARRAY_LENGTH_LOCATION, arrayLengthOffset()));
 
-        ReadNode arrayLengthRead = graph.add(new ReadNode(array, location, StampFactory.positiveInt(), BarrierType.NONE));
+        AddressNode address = createOffsetAddress(graph, array, arrayLengthOffset());
+        ReadNode arrayLengthRead = graph.add(new ReadNode(address, ARRAY_LENGTH_LOCATION, StampFactory.positiveInt(), BarrierType.NONE));
         arrayLengthRead.setGuard(createNullCheck(array, arrayLengthNode, tool));
         graph.replaceFixedWithFixed(arrayLengthNode, arrayLengthRead);
     }
@@ -244,15 +298,28 @@
         graph.replaceFloating(loadHub, hub);
     }
 
+    protected void lowerMonitorEnterNode(MonitorEnterNode monitorEnter, LoweringTool tool, StructuredGraph graph) {
+        ValueNode object = monitorEnter.object();
+        GuardingNode nullCheck = createNullCheck(object, monitorEnter, tool);
+        if (nullCheck != null) {
+            object = graph.unique(new PiNode(object, ((ObjectStamp) object.stamp()).improveWith(StampFactory.objectNonNull()), (ValueNode) nullCheck));
+        }
+        ValueNode hub = graph.addOrUnique(LoadHubNode.create(object, tool.getStampProvider(), tool.getMetaAccess()));
+        RawMonitorEnterNode rawMonitorEnter = graph.add(new RawMonitorEnterNode(object, hub, monitorEnter.getMonitorId()));
+        rawMonitorEnter.setStateBefore(monitorEnter.stateBefore());
+        rawMonitorEnter.setStateAfter(monitorEnter.stateAfter());
+        graph.replaceFixedWithFixed(monitorEnter, rawMonitorEnter);
+    }
+
     protected void lowerCompareAndSwapNode(CompareAndSwapNode cas) {
         StructuredGraph graph = cas.graph();
         Kind valueKind = cas.getValueKind();
-        LocationNode location = createLocation(cas.offset(), cas.getLocationIdentity(), valueKind);
 
         ValueNode expectedValue = implicitStoreConvert(graph, valueKind, cas.expected());
         ValueNode newValue = implicitStoreConvert(graph, valueKind, cas.newValue());
 
-        LoweredCompareAndSwapNode atomicNode = graph.add(new LoweredCompareAndSwapNode(cas.object(), location, expectedValue, newValue, compareAndSwapBarrierType(cas)));
+        AddressNode address = graph.unique(new OffsetAddressNode(cas.object(), cas.offset()));
+        LoweredCompareAndSwapNode atomicNode = graph.add(new LoweredCompareAndSwapNode(address, cas.getLocationIdentity(), expectedValue, newValue, compareAndSwapBarrierType(cas)));
         atomicNode.setStateAfter(cas.stateAfter());
         graph.replaceFixedWithFixed(cas, atomicNode);
     }
@@ -260,11 +327,11 @@
     protected void lowerAtomicReadAndWriteNode(AtomicReadAndWriteNode n) {
         StructuredGraph graph = n.graph();
         Kind valueKind = n.getValueKind();
-        LocationNode location = graph.unique(new IndexedLocationNode(n.getLocationIdentity(), 0, n.offset(), 1));
 
         ValueNode newValue = implicitStoreConvert(graph, valueKind, n.newValue());
 
-        LoweredAtomicReadAndWriteNode memoryRead = graph.add(new LoweredAtomicReadAndWriteNode(n.object(), location, newValue, atomicReadAndWriteBarrierType(n)));
+        AddressNode address = graph.unique(new OffsetAddressNode(n.object(), n.offset()));
+        LoweredAtomicReadAndWriteNode memoryRead = graph.add(new LoweredAtomicReadAndWriteNode(address, n.getLocationIdentity(), newValue, atomicReadAndWriteBarrierType(n)));
         memoryRead.setStateAfter(n.stateAfter());
 
         ValueNode readValue = implicitLoadConvert(graph, valueKind, memoryRead);
@@ -287,20 +354,20 @@
         }
     }
 
+    protected AddressNode createUnsafeAddress(StructuredGraph graph, ValueNode object, ValueNode offset) {
+        if (object.isConstant() && object.asConstant().isDefaultForKind()) {
+            return graph.unique(new RawAddressNode(offset));
+        } else {
+            return graph.unique(new OffsetAddressNode(object, offset));
+        }
+    }
+
     protected ReadNode createUnsafeRead(StructuredGraph graph, UnsafeLoadNode load, GuardingNode guard) {
         boolean compressible = load.accessKind() == Kind.Object;
         Kind readKind = load.accessKind();
-        ValueNode[] base = null;
-        ValueNode object = load.object();
-        if (object.isConstant() && object.asConstant().isDefaultForKind()) {
-            base = new ValueNode[1];
-        }
-        LocationNode location = createLocation(load, base);
-        if (base != null && base[0] != null) {
-            object = base[0];
-        }
         Stamp loadStamp = loadStamp(load.stamp(), readKind, compressible);
-        ReadNode memoryRead = graph.add(new ReadNode(object, location, loadStamp, guard, BarrierType.NONE));
+        AddressNode address = createUnsafeAddress(graph, load.object(), load.offset());
+        ReadNode memoryRead = graph.add(new ReadNode(address, load.getLocationIdentity(), loadStamp, guard, BarrierType.NONE));
         if (guard == null) {
             // An unsafe read must not float otherwise it may float above
             // a test guaranteeing the read is safe.
@@ -313,19 +380,11 @@
 
     protected void lowerUnsafeStoreNode(UnsafeStoreNode store) {
         StructuredGraph graph = store.graph();
-        ValueNode object = store.object();
-        ValueNode[] base = null;
-        if (object.isConstant() && object.asConstant().isDefaultForKind()) {
-            base = new ValueNode[1];
-        }
-        LocationNode location = createLocation(store, base);
-        if (base != null && base[0] != null) {
-            object = base[0];
-        }
         boolean compressible = store.value().getKind() == Kind.Object;
         Kind valueKind = store.accessKind();
         ValueNode value = implicitStoreConvert(graph, valueKind, store.value(), compressible);
-        WriteNode write = graph.add(new WriteNode(object, value, location, unsafeStoreBarrierType(store)));
+        AddressNode address = createUnsafeAddress(graph, store.object(), store.offset());
+        WriteNode write = graph.add(new WriteNode(address, store.getLocationIdentity(), value, unsafeStoreBarrierType(store)));
         write.setStateAfter(store.stateAfter());
         graph.replaceFixedWithFixed(store, write);
     }
@@ -335,7 +394,7 @@
         Kind valueKind = read.getReadKind();
         Stamp loadStamp = loadStamp(read.stamp(), valueKind, read.isCompressible());
 
-        ReadNode memoryRead = graph.add(new ReadNode(read.object(), read.location(), loadStamp, read.getBarrierType()));
+        ReadNode memoryRead = graph.add(new ReadNode(read.getAddress(), read.getLocationIdentity(), loadStamp, read.getBarrierType()));
         GuardingNode guard = read.getGuard();
         ValueNode readValue = implicitLoadConvert(graph, valueKind, memoryRead, read.isCompressible());
         if (guard == null) {
@@ -354,7 +413,7 @@
         Kind valueKind = write.getWriteKind();
         ValueNode value = implicitStoreConvert(graph, valueKind, write.value(), write.isCompressible());
 
-        WriteNode memoryWrite = graph.add(new WriteNode(write.object(), value, write.location(), write.getBarrierType(), write.isInitialization()));
+        WriteNode memoryWrite = graph.add(new WriteNode(write.getAddress(), write.getLocationIdentity(), value, write.getBarrierType(), write.isInitialization()));
         memoryWrite.setStateAfter(write.stateAfter());
         graph.replaceFixedWithFixed(write, memoryWrite);
         memoryWrite.setGuard(write.getGuard());
@@ -395,21 +454,21 @@
                         // Truffle requires some leniency in terms of what can be put where:
                         assert valueKind.getStackKind() == entryKind.getStackKind() ||
                                         (valueKind == Kind.Long || valueKind == Kind.Double || (valueKind == Kind.Int && virtual instanceof VirtualArrayNode));
-                        ConstantLocationNode location = null;
+                        AddressNode address = null;
                         BarrierType barrierType = null;
                         if (virtual instanceof VirtualInstanceNode) {
                             ResolvedJavaField field = ((VirtualInstanceNode) virtual).field(i);
                             long offset = fieldOffset(field);
                             if (offset >= 0) {
-                                location = graph.unique(new ConstantLocationNode(initLocationIdentity(), offset));
+                                address = createOffsetAddress(graph, newObject, offset);
                                 barrierType = fieldInitializationBarrier(entryKind);
                             }
                         } else {
-                            location = graph.unique(new ConstantLocationNode(initLocationIdentity(), arrayBaseOffset(entryKind) + i * arrayScalingFactor(entryKind)));
+                            address = createOffsetAddress(graph, newObject, arrayBaseOffset(entryKind) + i * arrayScalingFactor(entryKind));
                             barrierType = arrayInitializationBarrier(entryKind);
                         }
-                        if (location != null) {
-                            WriteNode write = new WriteNode(newObject, implicitStoreConvert(graph, entryKind, value), location, barrierType);
+                        if (address != null) {
+                            WriteNode write = new WriteNode(address, initLocationIdentity(), implicitStoreConvert(graph, entryKind, value), barrierType);
                             graph.addAfterFixed(newObject, graph.add(write));
                         }
                     }
@@ -430,18 +489,18 @@
                         ValueNode allocValue = allocations[commit.getVirtualObjects().indexOf(value)];
                         if (!(allocValue.isConstant() && allocValue.asConstant().isDefaultForKind())) {
                             assert virtual.entryKind(i) == Kind.Object && allocValue.getKind() == Kind.Object;
-                            LocationNode location;
+                            AddressNode address;
                             BarrierType barrierType;
                             if (virtual instanceof VirtualInstanceNode) {
                                 VirtualInstanceNode virtualInstance = (VirtualInstanceNode) virtual;
-                                location = createFieldLocation(graph, virtualInstance.field(i), true);
+                                address = createFieldAddress(graph, newObject, virtualInstance.field(i));
                                 barrierType = BarrierType.IMPRECISE;
                             } else {
-                                location = createArrayLocation(graph, virtual.entryKind(i), ConstantNode.forInt(i, graph), true);
+                                address = createArrayAddress(graph, newObject, virtual.entryKind(i), ConstantNode.forInt(i, graph));
                                 barrierType = BarrierType.PRECISE;
                             }
-                            if (location != null) {
-                                WriteNode write = new WriteNode(newObject, implicitStoreConvert(graph, Kind.Object, allocValue), location, barrierType);
+                            if (address != null) {
+                                WriteNode write = new WriteNode(address, initLocationIdentity(), implicitStoreConvert(graph, Kind.Object, allocValue), barrierType);
                                 graph.addBeforeFixed(commit, graph.add(write));
                             }
                         }
@@ -605,115 +664,14 @@
 
     protected abstract ValueNode createReadArrayComponentHub(StructuredGraph graph, ValueNode arrayHub, FixedNode anchor);
 
-    protected ConstantLocationNode createFieldLocation(StructuredGraph graph, ResolvedJavaField field, boolean initialization) {
-        int offset = fieldOffset(field);
-        if (offset >= 0) {
-            LocationIdentity loc = initialization ? initLocationIdentity() : field.getLocationIdentity();
-            return graph.unique(new ConstantLocationNode(loc, offset));
-        } else {
-            return null;
-        }
-    }
-
-    protected LocationNode createLocation(UnsafeAccessNode access, ValueNode[] base) {
-        return createLocation(access.offset(), access.getLocationIdentity(), access.accessKind(), base);
-    }
-
-    protected LocationNode createLocation(ValueNode offsetNode, LocationIdentity locationIdentity, Kind accessKind) {
-        return createLocation(offsetNode, locationIdentity, accessKind, null);
-    }
-
-    /**
-     * Try to unpack the operations in offsetNode into a LocationNode, taking advantage of
-     * addressing modes if possible.
-     *
-     * @param offsetNode the computed offset into the base of the memory operation
-     * @param locationIdentity
-     * @param accessKind
-     * @param base if non-null try to find a value that can be used as the base of the memory
-     *            operation and return it as base[0]
-     * @return the newly created LocationNode
-     */
-    protected LocationNode createLocation(ValueNode offsetNode, LocationIdentity locationIdentity, Kind accessKind, ValueNode[] base) {
-        ValueNode offset = offsetNode;
-        if (offset.isConstant()) {
-            long offsetValue = offset.asJavaConstant().asLong();
-            return offset.graph().unique(new ConstantLocationNode(locationIdentity, offsetValue));
-        }
-
-        long displacement = 0;
-        int indexScaling = 1;
-        boolean signExtend = false;
-        if (offset instanceof SignExtendNode) {
-            SignExtendNode extend = (SignExtendNode) offset;
-            if (extend.getResultBits() == 64) {
-                signExtend = true;
-                offset = extend.getValue();
-            }
-        }
-        if (offset instanceof AddNode) {
-            AddNode integerAddNode = (AddNode) offset;
-            if (integerAddNode.getY() instanceof ConstantNode) {
-                displacement = integerAddNode.getY().asJavaConstant().asLong();
-                offset = integerAddNode.getX();
-            }
-        }
-        if (base != null && signExtend == false && offset instanceof AddNode) {
-            /*
-             * Try to decompose the operation into base plus offset so the base can go into a new
-             * node. Prefer the unshifted side of an add as the base.
-             */
-            AddNode integerAddNode = (AddNode) offset;
-            if (integerAddNode.getY() instanceof LeftShiftNode) {
-                base[0] = integerAddNode.getX();
-                offset = integerAddNode.getY();
-            } else {
-                base[0] = integerAddNode.getY();
-                offset = integerAddNode.getX();
-            }
-            if (offset instanceof AddNode) {
-                integerAddNode = (AddNode) offset;
-                if (integerAddNode.getY() instanceof ConstantNode) {
-                    displacement = integerAddNode.getY().asJavaConstant().asLong();
-                    offset = integerAddNode.getX();
-                }
-            }
-        }
-        if (offset instanceof LeftShiftNode) {
-            LeftShiftNode leftShiftNode = (LeftShiftNode) offset;
-            if (leftShiftNode.getY() instanceof ConstantNode) {
-                long shift = leftShiftNode.getY().asJavaConstant().asLong();
-                if (shift >= 1 && shift <= 3) {
-                    if (shift == 1) {
-                        indexScaling = 2;
-                    } else if (shift == 2) {
-                        indexScaling = 4;
-                    } else {
-                        indexScaling = 8;
-                    }
-                    offset = leftShiftNode.getX();
-                }
-            }
-        }
-        if (signExtend) {
-            // If we were using sign extended values before restore the sign extension.
-            offset = offset.graph().addOrUnique(new SignExtendNode(offset, 64));
-        }
-        return offset.graph().unique(new IndexedLocationNode(locationIdentity, displacement, offset, indexScaling));
-    }
-
-    public IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index, boolean initialization) {
-        LocationIdentity loc = initialization ? initLocationIdentity() : NamedLocationIdentity.getArrayLocation(elementKind);
-        return graph.unique(new IndexedLocationNode(loc, arrayBaseOffset(elementKind), index, arrayScalingFactor(elementKind)));
-    }
-
-    protected GuardingNode createBoundsCheck(AccessIndexedNode n, LoweringTool tool) {
+    protected PiNode getBoundsCheckedIndex(AccessIndexedNode n, LoweringTool tool) {
         StructuredGraph graph = n.graph();
         ValueNode array = n.array();
         ValueNode arrayLength = readArrayLength(array, tool.getConstantReflection());
         if (arrayLength == null) {
             Stamp stamp = StampFactory.positiveInt();
-            ReadNode readArrayLength = graph.add(new ReadNode(array, graph.unique(new ConstantLocationNode(ARRAY_LENGTH_LOCATION, arrayLengthOffset())), stamp, BarrierType.NONE));
+            AddressNode address = createOffsetAddress(graph, array, arrayLengthOffset());
+            ReadNode readArrayLength = graph.add(new ReadNode(address, ARRAY_LENGTH_LOCATION, stamp, BarrierType.NONE));
             graph.addBeforeFixed(n, readArrayLength);
             readArrayLength.setGuard(createNullCheck(array, readArrayLength, tool));
             arrayLength = readArrayLength;
@@ -730,7 +688,10 @@
             }
         }
 
-        return tool.createGuard(n, graph.unique(new IntegerBelowNode(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile);
+        GuardingNode guard = tool.createGuard(n, graph.unique(new IntegerBelowNode(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile);
+        IntegerStamp lengthStamp = (IntegerStamp) arrayLength.stamp();
+        IntegerStamp indexStamp = StampFactory.forInteger(32, 0, lengthStamp.upperBound());
+        return graph.unique(new PiNode(n.index(), indexStamp, guard.asNode()));
     }
 
     protected GuardingNode createNullCheck(ValueNode object, FixedNode before, LoweringTool tool) {
@@ -741,40 +702,26 @@
     }
 
     @Override
-    public ValueNode reconstructArrayIndex(Kind elementKind, LocationNode location) {
-        assert location.getLocationIdentity().equals(NamedLocationIdentity.getArrayLocation(elementKind));
+    public ValueNode reconstructArrayIndex(Kind elementKind, AddressNode address) {
+        StructuredGraph graph = address.graph();
+        ValueNode offset = ((OffsetAddressNode) address).getOffset();
 
-        long base;
-        ValueNode index;
-        int scale = arrayScalingFactor(elementKind);
+        int base = arrayBaseOffset(elementKind);
+        ValueNode scaledIndex = graph.unique(new SubNode(offset, ConstantNode.forIntegerStamp(offset.stamp(), base, graph)));
 
-        if (location instanceof ConstantLocationNode) {
-            base = ((ConstantLocationNode) location).getDisplacement();
-            index = null;
-        } else if (location instanceof IndexedLocationNode) {
-            IndexedLocationNode indexedLocation = (IndexedLocationNode) location;
-            assert indexedLocation.getIndexScaling() == scale;
-            base = indexedLocation.getDisplacement();
-            index = indexedLocation.getIndex();
+        int shift = CodeUtil.log2(arrayScalingFactor(elementKind));
+        ValueNode ret = graph.unique(new RightShiftNode(scaledIndex, ConstantNode.forInt(shift, graph)));
+        return IntegerConvertNode.convert(ret, StampFactory.forKind(Kind.Int), graph);
+    }
+
+    @Override
+    public int getSizeInBytes(Stamp stamp) {
+        if (stamp instanceof PrimitiveStamp) {
+            return ((PrimitiveStamp) stamp).getBits() / 8;
+        } else if (stamp instanceof AbstractPointerStamp) {
+            return target.wordSize;
         } else {
-            throw JVMCIError.shouldNotReachHere();
-        }
-
-        base -= arrayBaseOffset(elementKind);
-        assert base >= 0 && base % scale == 0;
-
-        base /= scale;
-        assert NumUtil.isInt(base);
-
-        StructuredGraph graph = location.graph();
-        if (index == null) {
-            return ConstantNode.forInt((int) base, graph);
-        } else {
-            if (base == 0) {
-                return index;
-            } else {
-                return BinaryArithmeticNode.add(graph, ConstantNode.forInt((int) base, graph), index);
-            }
+            throw JVMCIError.shouldNotReachHere("stamp " + stamp + " has no size");
         }
     }
 }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPlugin.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPlugin.java	Tue Jun 09 19:07:39 2015 -0700
@@ -28,7 +28,6 @@
 import java.util.*;
 
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.graphbuilderconf.*;
@@ -38,6 +37,7 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.word.*;
 import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 import com.oracle.jvmci.meta.*;
 
 /**
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1156,7 +1156,7 @@
                         MemoryNode replacement = map.getLastLocationAccess(location);
                         if (replacement == null) {
                             assert LocationIdentity.any().equals(location) || Arrays.stream(info.privateLocations).anyMatch(Predicate.isEqual(location)) : "Snippet " + info.method.format("%h.%n") +
-                                            " contains access to the non-private location " + location + ", but replacee doesn't access this location.";
+                                            " contains access to the non-private location " + location + ", but replacee doesn't access this location." + map.getLocations();
                         } else {
                             pos.set(usage, replacement.asNode());
                         }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java	Tue Jun 09 19:07:39 2015 -0700
@@ -36,6 +36,7 @@
 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.address.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.word.*;
 import com.oracle.graal.word.Word.Opcode;
@@ -205,21 +206,23 @@
             case READ_BARRIERED: {
                 assert args.length == 2 || args.length == 3;
                 Kind readKind = wordTypes.asKind(wordMethod.getSignature().getReturnType(wordMethod.getDeclaringClass()));
-                LocationNode location;
+                AddressNode address = makeAddress(b, args[0], args[1]);
+                LocationIdentity location;
                 if (args.length == 2) {
-                    location = makeLocation(b, args[1], any());
+                    location = any();
                 } else {
-                    location = makeLocation(b, args[1], args[2]);
+                    assert args[2].isConstant();
+                    location = snippetReflection.asObject(LocationIdentity.class, args[2].asJavaConstant());
                 }
-                b.push(returnKind, readOp(b, readKind, args[0], location, operation.opcode()));
+                b.push(returnKind, readOp(b, readKind, address, location, operation.opcode()));
                 break;
             }
             case READ_HEAP: {
                 assert args.length == 3;
                 Kind readKind = wordTypes.asKind(wordMethod.getSignature().getReturnType(wordMethod.getDeclaringClass()));
-                LocationNode location = makeLocation(b, args[1], any());
+                AddressNode address = makeAddress(b, args[0], args[1]);
                 BarrierType barrierType = snippetReflection.asObject(BarrierType.class, args[2].asJavaConstant());
-                b.push(returnKind, readOp(b, readKind, args[0], location, barrierType, true));
+                b.push(returnKind, readOp(b, readKind, address, any(), barrierType, true));
                 break;
             }
             case WRITE_POINTER:
@@ -228,13 +231,15 @@
             case INITIALIZE: {
                 assert args.length == 3 || args.length == 4;
                 Kind writeKind = wordTypes.asKind(wordMethod.getSignature().getParameterType(wordMethod.isStatic() ? 2 : 1, wordMethod.getDeclaringClass()));
-                LocationNode location;
+                AddressNode address = makeAddress(b, args[0], args[1]);
+                LocationIdentity location;
                 if (args.length == 3) {
-                    location = makeLocation(b, args[1], LocationIdentity.any());
+                    location = any();
                 } else {
-                    location = makeLocation(b, args[1], args[3]);
+                    assert args[3].isConstant();
+                    location = snippetReflection.asObject(LocationIdentity.class, args[3].asJavaConstant());
                 }
-                writeOp(b, writeKind, args[0], args[2], location, operation.opcode());
+                writeOp(b, writeKind, address, location, args[2], operation.opcode());
                 break;
             }
             case ZERO:
@@ -268,9 +273,10 @@
                 b.push(returnKind, objectToWord);
                 break;
 
-            case FROM_ARRAY:
-                assert args.length == 2;
-                b.addPush(returnKind, new ComputeAddressNode(args[0], args[1], StampFactory.forKind(wordKind)));
+            case FROM_ADDRESS:
+                assert args.length == 1;
+                WordCastNode addressToWord = b.add(WordCastNode.addressToWord(args[0], wordKind));
+                b.push(returnKind, addressToWord);
                 break;
 
             case TO_OBJECT:
@@ -328,41 +334,34 @@
         return materialize;
     }
 
-    protected ValueNode readOp(GraphBuilderContext b, Kind readKind, ValueNode base, LocationNode location, Opcode op) {
+    protected ValueNode readOp(GraphBuilderContext b, Kind readKind, AddressNode address, LocationIdentity location, Opcode op) {
         assert op == Opcode.READ_POINTER || op == Opcode.READ_OBJECT || op == Opcode.READ_BARRIERED;
         final BarrierType barrier = (op == Opcode.READ_BARRIERED ? BarrierType.PRECISE : BarrierType.NONE);
         final boolean compressible = (op == Opcode.READ_OBJECT || op == Opcode.READ_BARRIERED);
 
-        return readOp(b, readKind, base, location, barrier, compressible);
+        return readOp(b, readKind, address, location, barrier, compressible);
     }
 
-    public static ValueNode readOp(GraphBuilderContext b, Kind readKind, ValueNode base, LocationNode location, BarrierType barrierType, boolean compressible) {
+    public static ValueNode readOp(GraphBuilderContext b, Kind readKind, AddressNode address, LocationIdentity location, BarrierType barrierType, boolean compressible) {
         /*
          * A JavaReadNode lowered to a ReadNode that will not float. This means it cannot float
          * above an explicit zero check on its base address or any other test that ensures the read
          * is safe.
          */
-        JavaReadNode read = b.add(new JavaReadNode(readKind, base, location, barrierType, compressible));
+        JavaReadNode read = b.add(new JavaReadNode(readKind, address, location, barrierType, compressible));
         return read;
     }
 
-    protected void writeOp(GraphBuilderContext b, Kind writeKind, ValueNode base, ValueNode value, LocationNode location, Opcode op) {
+    protected void writeOp(GraphBuilderContext b, Kind writeKind, AddressNode address, LocationIdentity location, ValueNode value, Opcode op) {
         assert op == Opcode.WRITE_POINTER || op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED || op == Opcode.INITIALIZE;
         final BarrierType barrier = (op == Opcode.WRITE_BARRIERED ? BarrierType.PRECISE : BarrierType.NONE);
         final boolean compressible = (op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED);
         final boolean initialize = (op == Opcode.INITIALIZE);
-        b.add(new JavaWriteNode(writeKind, base, value, location, barrier, compressible, initialize));
+        b.add(new JavaWriteNode(writeKind, address, location, value, barrier, compressible, initialize));
     }
 
-    public LocationNode makeLocation(GraphBuilderContext b, ValueNode offset, LocationIdentity locationIdentity) {
-        return b.add(new IndexedLocationNode(locationIdentity, 0, fromSigned(b, offset), 1));
-    }
-
-    public LocationNode makeLocation(GraphBuilderContext b, ValueNode offset, ValueNode locationIdentity) {
-        if (locationIdentity.isConstant()) {
-            return makeLocation(b, offset, snippetReflection.asObject(LocationIdentity.class, locationIdentity.asJavaConstant()));
-        }
-        return b.add(new SnippetLocationNode(snippetReflection, locationIdentity, b.add(ConstantNode.forLong(0)), fromSigned(b, offset), b.add(ConstantNode.forInt(1))));
+    public AddressNode makeAddress(GraphBuilderContext b, ValueNode base, ValueNode offset) {
+        return b.add(new OffsetAddressNode(base, fromSigned(b, offset)));
     }
 
     public ValueNode fromUnsigned(GraphBuilderContext b, ValueNode value) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -26,8 +26,10 @@
 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.extended.*;
 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.jvmci.meta.*;
 
@@ -66,8 +68,9 @@
 
     @Override
     public void lower(LoweringTool tool) {
-        IndexedLocationNode location = graph().unique(new IndexedLocationNode(locationIdentity, displacement, offset, 1));
-        JavaWriteNode write = graph().add(new JavaWriteNode(storeKind, object, value, location, BarrierType.NONE, storeKind == Kind.Object, false));
+        ValueNode off = graph().unique(new AddNode(offset, ConstantNode.forIntegerStamp(offset.stamp(), displacement, graph())));
+        AddressNode address = graph().unique(new OffsetAddressNode(object, off));
+        JavaWriteNode write = graph().add(new JavaWriteNode(storeKind, address, locationIdentity, value, BarrierType.NONE, storeKind == Kind.Object, false));
         graph().replaceFixedWithFixed(this, write);
 
         tool.getLowerer().lower(write, tool);
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,27 +22,17 @@
  */
 package com.oracle.graal.truffle.hotspot;
 
-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.*;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
+import static com.oracle.jvmci.code.CodeUtil.*;
 
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.stream.*;
 
-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.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
@@ -57,14 +47,17 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
-import com.oracle.graal.printer.*;
 import com.oracle.graal.runtime.*;
 import com.oracle.graal.truffle.*;
 import com.oracle.graal.truffle.hotspot.nfi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.compiler.*;
 import com.oracle.jvmci.debug.*;
 import com.oracle.jvmci.debug.Debug.Scope;
 import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 import com.oracle.jvmci.service.*;
 import com.oracle.nfi.api.*;
 import com.oracle.truffle.api.*;
@@ -96,9 +89,9 @@
 
         // Create compilation queue.
         CompilerThreadFactory factory = new CompilerThreadFactory("TruffleCompilerThread", new CompilerThreadFactory.DebugConfigAccess() {
-            public GraalDebugConfig getDebugConfig() {
+            public JVMCIDebugConfig getDebugConfig() {
                 if (Debug.isEnabled()) {
-                    GraalDebugConfig debugConfig = DebugEnvironment.initialize(TTY.out().out());
+                    JVMCIDebugConfig debugConfig = DebugEnvironment.initialize(TTY.out().out());
                     debugConfig.dumpHandlers().add(new TruffleTreeDumpHandler());
                     return debugConfig;
                 } else {
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntimeAccess.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntimeAccess.java	Tue Jun 09 19:07:39 2015 -0700
@@ -26,7 +26,7 @@
 import com.oracle.truffle.api.*;
 
 @ServiceProvider(TruffleRuntimeAccess.class)
-public class HotSpotTruffleRuntimeAccess implements TruffleRuntimeAccess {
+public class HotSpotTruffleRuntimeAccess implements TruffleRuntimeAccess, Service {
     public TruffleRuntime getRuntime() {
         return HotSpotTruffleRuntime.makeInstance();
     }
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/NativeCallStubGraphBuilder.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/NativeCallStubGraphBuilder.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 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
@@ -22,13 +22,6 @@
  */
 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.*;
@@ -39,9 +32,12 @@
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.graal.word.nodes.*;
 import com.oracle.jvmci.common.*;
 import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Utility creating a graph for a stub used to call a native function.
@@ -122,15 +118,13 @@
             if (kind == Kind.Object) {
                 // array value
                 Kind arrayElementKind = getElementKind(type);
-                LocationIdentity locationIdentity = NamedLocationIdentity.getArrayLocation(arrayElementKind);
                 HotSpotJVMCIRuntimeProvider jvmciRuntime = runtime().getJVMCIRuntime();
                 int displacement = jvmciRuntime.getArrayBaseOffset(arrayElementKind);
-                ConstantNode index = ConstantNode.forInt(0, g);
-                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));
-                args.add(arrayAddress);
+                AddressNode arrayAddress = g.unique(new OffsetAddressNode(boxedElement, ConstantNode.forLong(displacement, g)));
+                WordCastNode cast = g.add(WordCastNode.addressToWord(arrayAddress, providers.getWordTypes().getWordKind()));
+                last.setNext(cast);
+                last = cast;
+                args.add(cast);
             } else {
                 // boxed primitive value
                 try {
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/ConditionAnchoringTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/ConditionAnchoringTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -126,7 +126,7 @@
         DominatorConditionalEliminationPhase conditionalElimination = new DominatorConditionalEliminationPhase(false);
         conditionalElimination.apply(graph);
 
-        floatingReads = graph.getNodes().filter(FloatingReadNode.class).filter(n -> ((FloatingReadNode) n).location().getLocationIdentity() instanceof ObjectLocationIdentity);
+        floatingReads = graph.getNodes().filter(FloatingReadNode.class).filter(n -> ((FloatingReadNode) n).getLocationIdentity() instanceof ObjectLocationIdentity);
         conditionAnchors = graph.getNodes().filter(ConditionAnchorNode.class);
         assertThat(floatingReads, hasCount(1));
         assertThat(conditionAnchors, isEmpty());
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -30,7 +30,6 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.phases.common.*;
 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;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,19 +22,11 @@
  */
 package com.oracle.graal.truffle;
 
-import com.oracle.jvmci.code.CallingConvention;
-import com.oracle.jvmci.code.CodeCacheProvider;
-import com.oracle.jvmci.code.InstalledCode;
-import com.oracle.jvmci.code.CompilationResult;
-import com.oracle.jvmci.meta.*;
-
+import static com.oracle.graal.compiler.GraalCompiler.*;
 import static com.oracle.jvmci.code.CodeUtil.*;
-import static com.oracle.graal.compiler.GraalCompiler.*;
 
 import java.util.*;
 
-import com.oracle.jvmci.code.CallingConvention.Type;
-import com.oracle.jvmci.meta.Assumptions.Assumption;
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
@@ -45,10 +37,13 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
-import com.oracle.graal.printer.*;
 import com.oracle.graal.truffle.nodes.*;
+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.meta.Assumptions.Assumption;
+import com.oracle.jvmci.meta.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.nodes.*;
 
@@ -169,6 +164,7 @@
 
         if (graph.isInlinedMethodRecordingEnabled()) {
             result.setMethods(graph.method(), graph.getInlinedMethods());
+            result.setBytecodeSize(graph.getBytecodeSize());
         } else {
             assert result.getMethods() == null;
         }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java	Tue Jun 09 19:07:39 2015 -0700
@@ -34,7 +34,7 @@
  * Enables a Truffle compilable to masquerade as a {@link JavaMethod} for use as a context value in
  * {@linkplain Debug#scope(Object) debug scopes}.
  */
-public class TruffleDebugJavaMethod implements JavaMethod {
+public class TruffleDebugJavaMethod implements JavaMethod, JavaMethodContex {
     private final RootCallTarget compilable;
 
     private static final JavaType declaringClass = new JavaType() {
@@ -122,4 +122,8 @@
     public String toString() {
         return format("Truffle<%n(%p)>");
     }
+
+    public JavaMethod asJavaMethod() {
+        return this;
+    }
 }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationFailureListener.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationFailureListener.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,12 +22,13 @@
  */
 package com.oracle.graal.truffle.debug;
 
-import com.oracle.jvmci.code.BailoutException;
+import static com.oracle.jvmci.compiler.Compiler.*;
+
 import java.util.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.*;
+import com.oracle.jvmci.code.*;
 
 public final class TraceCompilationFailureListener extends AbstractDebugCompilationListener {
 
@@ -40,7 +41,7 @@
 
     @Override
     public void notifyCompilationFailed(OptimizedCallTarget target, StructuredGraph graph, Throwable t) {
-        if (isPermanentBailout(t) || GraalOptions.PrintBailout.getValue()) {
+        if (isPermanentBailout(t) || PrintBailout.getValue()) {
             Map<String, Object> properties = new LinkedHashMap<>();
             properties.put("Reason", t.toString());
             log(0, "opt fail", target.toString(), properties);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Tue Jun 09 19:07:39 2015 -0700
@@ -61,7 +61,7 @@
 public class TruffleGraphBuilderPlugins {
     public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins, boolean canDelayIntrinsification, SnippetReflectionProvider snippetReflection) {
 
-        registerOptimizedAssumptionPlugins(plugins, canDelayIntrinsification, snippetReflection);
+        registerOptimizedAssumptionPlugins(plugins, snippetReflection);
         registerExactMathPlugins(plugins);
         registerCompilerDirectivesPlugins(plugins);
         registerCompilerAssertsPlugins(plugins, canDelayIntrinsification);
@@ -76,7 +76,7 @@
 
     }
 
-    public static void registerOptimizedAssumptionPlugins(InvocationPlugins plugins, boolean canDelayIntrinsification, SnippetReflectionProvider snippetReflection) {
+    public static void registerOptimizedAssumptionPlugins(InvocationPlugins plugins, SnippetReflectionProvider snippetReflection) {
         Registration r = new Registration(plugins, OptimizedAssumption.class);
         InvocationPlugin plugin = new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
@@ -99,10 +99,8 @@
                         }
                     }
                     return true;
-                } else if (canDelayIntrinsification) {
+                } else {
                     return false;
-                } else {
-                    throw b.bailout("assumption could not be reduced to a constant");
                 }
             }
         };
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationBlockState.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationBlockState.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, 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
@@ -27,7 +27,6 @@
 
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.extended.*;
 
 public class ReadEliminationBlockState extends EffectsBlockState<ReadEliminationBlockState> {
 
@@ -111,20 +110,38 @@
         }
     }
 
-    static class ReadCacheEntry extends CacheEntry<LocationNode> {
+    static class ReadCacheEntry extends CacheEntry<ValueNode> {
+
+        private final LocationIdentity location;
 
-        public ReadCacheEntry(ValueNode object, LocationNode identity) {
-            super(object, identity);
+        public ReadCacheEntry(ValueNode object, ValueNode offset, LocationIdentity location) {
+            super(object, offset);
+            this.location = location;
         }
 
         @Override
-        public CacheEntry<LocationNode> duplicateWithObject(ValueNode newObject) {
-            return new ReadCacheEntry(newObject, identity);
+        public CacheEntry<ValueNode> duplicateWithObject(ValueNode newObject) {
+            return new ReadCacheEntry(newObject, identity, location);
         }
 
         @Override
         public boolean conflicts(LocationIdentity other) {
-            return identity.getLocationIdentity().equals(other);
+            return location.equals(other);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (!(obj instanceof ReadCacheEntry)) {
+                return false;
+            }
+
+            ReadCacheEntry other = (ReadCacheEntry) obj;
+            return this.location.equals(other.location) && super.equals(other);
+        }
+
+        @Override
+        public int hashCode() {
+            return location.hashCode() * 23 + super.hashCode();
         }
     }
 
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationClosure.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationClosure.java	Tue Jun 09 19:07:39 2015 -0700
@@ -36,6 +36,7 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.graal.nodes.memory.address.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.virtual.phases.ea.ReadEliminationBlockState.CacheEntry;
 import com.oracle.graal.virtual.phases.ea.ReadEliminationBlockState.LoadCacheEntry;
@@ -86,40 +87,41 @@
             }
         } else if (node instanceof ReadNode) {
             ReadNode read = (ReadNode) node;
-            if (read.location() instanceof ConstantLocationNode) {
-                ValueNode object = GraphUtil.unproxify(read.object());
-                ReadCacheEntry identifier = new ReadCacheEntry(object, read.location());
-                ValueNode cachedValue = state.getCacheEntry(identifier);
-                if (cachedValue != null && read.stamp().isCompatible(cachedValue.stamp())) {
-                    // Anchor guard if it is not fixed and different from cachedValue's guard
-                    if (read.getGuard() != null && !(read.getGuard() instanceof FixedNode)) {
-                        if (!(cachedValue instanceof GuardedNode) || ((GuardedNode) cachedValue).getGuard() != read.getGuard()) {
-                            effects.addFixedNodeBefore(new ValueAnchorNode((ValueNode) read.getGuard()), read);
+            if (read.getAddress() instanceof OffsetAddressNode) {
+                OffsetAddressNode address = (OffsetAddressNode) read.getAddress();
+                if (address.getOffset().isConstant()) {
+                    ValueNode object = GraphUtil.unproxify(address.getBase());
+                    ReadCacheEntry identifier = new ReadCacheEntry(object, address.getOffset(), read.getLocationIdentity());
+                    ValueNode cachedValue = state.getCacheEntry(identifier);
+                    if (cachedValue != null && read.stamp().isCompatible(cachedValue.stamp())) {
+                        // Anchor guard if it is not fixed and different from cachedValue's guard
+                        if (read.getGuard() != null && !(read.getGuard() instanceof FixedNode)) {
+                            if (!(cachedValue instanceof GuardedNode) || ((GuardedNode) cachedValue).getGuard() != read.getGuard()) {
+                                effects.addFixedNodeBefore(new ValueAnchorNode((ValueNode) read.getGuard()), read);
+                            }
                         }
                     }
-                    effects.replaceAtUsages(read, cachedValue);
-                    addScalarAlias(read, cachedValue);
-                    deleted = true;
-                } else {
-                    state.addCacheEntry(identifier, read);
                 }
             }
         } else if (node instanceof WriteNode) {
             WriteNode write = (WriteNode) node;
-            if (write.location() instanceof ConstantLocationNode) {
-                ValueNode object = GraphUtil.unproxify(write.object());
-                ReadCacheEntry identifier = new ReadCacheEntry(object, write.location());
-                ValueNode cachedValue = state.getCacheEntry(identifier);
+            if (write.getAddress() instanceof OffsetAddressNode) {
+                OffsetAddressNode address = (OffsetAddressNode) write.getAddress();
+                if (address.getOffset().isConstant()) {
+                    ValueNode object = GraphUtil.unproxify(address.getBase());
+                    ReadCacheEntry identifier = new ReadCacheEntry(object, address.getOffset(), write.getLocationIdentity());
+                    ValueNode cachedValue = state.getCacheEntry(identifier);
 
-                ValueNode value = getScalarAlias(write.value());
-                if (GraphUtil.unproxify(value) == GraphUtil.unproxify(cachedValue)) {
-                    effects.deleteNode(write);
-                    deleted = true;
+                    ValueNode value = getScalarAlias(write.value());
+                    if (GraphUtil.unproxify(value) == GraphUtil.unproxify(cachedValue)) {
+                        effects.deleteNode(write);
+                        deleted = true;
+                    }
+                    processIdentity(state, write.getLocationIdentity());
+                    state.addCacheEntry(identifier, value);
+                } else {
+                    processIdentity(state, write.getLocationIdentity());
                 }
-                processIdentity(state, write.location().getLocationIdentity());
-                state.addCacheEntry(identifier, value);
-            } else {
-                processIdentity(state, write.location().getLocationIdentity());
             }
         } else if (node instanceof UnsafeAccessNode) {
             if (node instanceof UnsafeLoadNode) {
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/BarrieredAccess.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/BarrieredAccess.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 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
@@ -22,10 +22,9 @@
  */
 package com.oracle.graal.word;
 
-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;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Medium-level memory access for Objects. Similarly to the readXxx and writeXxx methods defined for
@@ -44,7 +43,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -59,7 +58,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -74,7 +73,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -89,7 +88,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -104,7 +103,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -119,7 +118,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -134,7 +133,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -149,7 +148,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -164,7 +163,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -175,7 +174,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -186,7 +185,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -197,7 +196,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -208,7 +207,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -219,7 +218,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -230,7 +229,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -241,7 +240,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -252,7 +251,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -263,7 +262,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_BARRIERED)
@@ -278,7 +277,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -293,7 +292,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -308,7 +307,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -323,7 +322,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -338,7 +337,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -353,7 +352,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -368,7 +367,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -383,7 +382,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -398,7 +397,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -409,7 +408,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -420,7 +419,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -431,7 +430,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -442,7 +441,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -453,7 +452,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -464,7 +463,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -475,7 +474,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -486,7 +485,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
@@ -497,7 +496,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_BARRIERED)
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/ObjectAccess.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/ObjectAccess.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 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,10 +22,9 @@
  */
 package com.oracle.graal.word;
 
-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;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Low-level memory access for Objects. Similarly to the readXxx and writeXxx methods defined for
@@ -44,7 +43,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -59,7 +58,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -74,7 +73,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -89,7 +88,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -104,7 +103,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -119,7 +118,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -134,7 +133,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -149,7 +148,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -164,7 +163,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -175,7 +174,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -186,7 +185,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -197,7 +196,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -208,7 +207,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -219,7 +218,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -230,7 +229,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -241,7 +240,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -252,7 +251,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -263,7 +262,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     @Operation(opcode = Opcode.READ_OBJECT)
@@ -278,7 +277,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -293,7 +292,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -308,7 +307,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -323,7 +322,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -338,7 +337,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -353,7 +352,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -368,7 +367,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -383,7 +382,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -398,7 +397,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -409,7 +408,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -420,7 +419,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -431,7 +430,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -442,7 +441,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -453,7 +452,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -464,7 +463,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -475,7 +474,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -486,7 +485,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
@@ -497,7 +496,7 @@
      *
      * @param object the base object for the memory access
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     @Operation(opcode = Opcode.WRITE_OBJECT)
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,9 +22,8 @@
  */
 package com.oracle.graal.word;
 
-import com.oracle.jvmci.meta.LocationIdentity;
-import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Lowest-level memory access of native C memory. These methods access the raw memory without any
@@ -55,7 +54,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     byte readByte(WordBase offset, LocationIdentity locationIdentity);
@@ -69,7 +68,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     char readChar(WordBase offset, LocationIdentity locationIdentity);
@@ -83,7 +82,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     short readShort(WordBase offset, LocationIdentity locationIdentity);
@@ -97,7 +96,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     int readInt(WordBase offset, LocationIdentity locationIdentity);
@@ -111,7 +110,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     long readLong(WordBase offset, LocationIdentity locationIdentity);
@@ -125,7 +124,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     float readFloat(WordBase offset, LocationIdentity locationIdentity);
@@ -139,7 +138,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     double readDouble(WordBase offset, LocationIdentity locationIdentity);
@@ -153,7 +152,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     Word readWord(WordBase offset, LocationIdentity locationIdentity);
@@ -167,7 +166,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     Object readObject(WordBase offset, LocationIdentity locationIdentity);
@@ -177,7 +176,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     byte readByte(int offset, LocationIdentity locationIdentity);
@@ -187,7 +186,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     char readChar(int offset, LocationIdentity locationIdentity);
@@ -197,7 +196,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     short readShort(int offset, LocationIdentity locationIdentity);
@@ -207,7 +206,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     int readInt(int offset, LocationIdentity locationIdentity);
@@ -217,7 +216,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     long readLong(int offset, LocationIdentity locationIdentity);
@@ -227,7 +226,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     float readFloat(int offset, LocationIdentity locationIdentity);
@@ -237,7 +236,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     double readDouble(int offset, LocationIdentity locationIdentity);
@@ -247,7 +246,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     Word readWord(int offset, LocationIdentity locationIdentity);
@@ -257,7 +256,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the read (see {@link LocationNode})
+     * @param locationIdentity the identity of the read
      * @return the result of the memory access
      */
     Object readObject(int offset, LocationIdentity locationIdentity);
@@ -271,7 +270,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeByte(WordBase offset, byte val, LocationIdentity locationIdentity);
@@ -285,7 +284,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeChar(WordBase offset, char val, LocationIdentity locationIdentity);
@@ -299,7 +298,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeShort(WordBase offset, short val, LocationIdentity locationIdentity);
@@ -313,7 +312,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeInt(WordBase offset, int val, LocationIdentity locationIdentity);
@@ -327,7 +326,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeLong(WordBase offset, long val, LocationIdentity locationIdentity);
@@ -341,7 +340,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeFloat(WordBase offset, float val, LocationIdentity locationIdentity);
@@ -355,7 +354,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeDouble(WordBase offset, double val, LocationIdentity locationIdentity);
@@ -369,7 +368,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeWord(WordBase offset, WordBase val, LocationIdentity locationIdentity);
@@ -383,7 +382,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void initializeLong(WordBase offset, long val, LocationIdentity locationIdentity);
@@ -397,7 +396,7 @@
      * knows that the highest-order bit of the unsigned value is never used).
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeObject(WordBase offset, Object val, LocationIdentity locationIdentity);
@@ -407,7 +406,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeByte(int offset, byte val, LocationIdentity locationIdentity);
@@ -417,7 +416,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeChar(int offset, char val, LocationIdentity locationIdentity);
@@ -427,7 +426,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeShort(int offset, short val, LocationIdentity locationIdentity);
@@ -437,7 +436,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeInt(int offset, int val, LocationIdentity locationIdentity);
@@ -447,7 +446,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeLong(int offset, long val, LocationIdentity locationIdentity);
@@ -457,7 +456,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeFloat(int offset, float val, LocationIdentity locationIdentity);
@@ -467,7 +466,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeDouble(int offset, double val, LocationIdentity locationIdentity);
@@ -477,7 +476,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeWord(int offset, WordBase val, LocationIdentity locationIdentity);
@@ -487,7 +486,7 @@
      * are in bytes. The memory must be uninitialized or zero prior to this operation.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void initializeLong(int offset, long val, LocationIdentity locationIdentity);
@@ -497,7 +496,7 @@
      * bytes.
      *
      * @param offset the signed offset for the memory access
-     * @param locationIdentity the identity of the write (see {@link LocationNode})
+     * @param locationIdentity the identity of the write
      * @param val the value to be written to memory
      */
     void writeObject(int offset, Object val, LocationIdentity locationIdentity);
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.word;
 
-import com.oracle.jvmci.code.UnsignedMath;
-import com.oracle.jvmci.meta.LocationIdentity;
 import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.lang.annotation.*;
@@ -32,7 +30,10 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
+import com.oracle.graal.nodes.memory.address.AddressNode.Address;
+import com.oracle.jvmci.code.*;
 import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 public abstract class Word implements Signed, Unsigned, Pointer {
 
@@ -73,7 +74,7 @@
          FROM_SIGNED,
          FROM_OBJECT,
          FROM_WORDBASE,
-         FROM_ARRAY,
+         FROM_ADDRESS,
          TO_OBJECT,
          TO_RAW_VALUE,
     }
@@ -177,8 +178,8 @@
     @Operation(opcode = Opcode.FROM_OBJECT)
     public static native Pointer fromObject(Object val);
 
-    @Operation(opcode = Opcode.FROM_ARRAY)
-    public static native Pointer fromArray(Object oop, Object location);
+    @Operation(opcode = Opcode.FROM_ADDRESS)
+    public static native Pointer fromAddress(Address address);
 
     @Override
     @Operation(opcode = Opcode.TO_OBJECT)
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +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.
- */
-package com.oracle.graal.word.nodes;
-
-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.type.*;
-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.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
- * location identity and kind) as a snippet constant. Can represent locations in the form of [base +
- * index * scale + disp]. When the location is created, all elements (base, index, scale, disp) are
- * nodes. Both scale and disp must eventually canonicalize to {@link ConstantNode constants} so that
- * this node can be canonicalized to a {@link IndexedLocationNode} or {@link ConstantLocationNode}.
- */
-@NodeInfo
-public final class SnippetLocationNode extends LocationNode implements Canonicalizable {
-    public static final NodeClass<SnippetLocationNode> TYPE = NodeClass.create(SnippetLocationNode.class);
-
-    protected final SnippetReflectionProvider snippetReflection;
-
-    @Input(InputType.Association) ValueNode locationIdentity;
-    @Input ValueNode displacement;
-    @Input ValueNode index;
-    @Input ValueNode indexScaling;
-
-    public SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode displacement) {
-        this(snippetReflection, locationIdentity, displacement, null, null);
-    }
-
-    public SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode displacement, ValueNode index, ValueNode indexScaling) {
-        super(TYPE, StampFactory.object());
-        this.snippetReflection = snippetReflection;
-        this.locationIdentity = locationIdentity;
-        this.displacement = displacement;
-        this.index = index;
-        this.indexScaling = indexScaling;
-    }
-
-    @Override
-    public LocationIdentity getLocationIdentity() {
-        if (locationIdentity.isConstant()) {
-            LocationIdentity identity = snippetReflection.asObject(LocationIdentity.class, locationIdentity.asJavaConstant());
-            return identity;
-        }
-        // We do not know our actual location identity yet, so be conservative.
-        return any();
-    }
-
-    @Override
-    public Node canonical(CanonicalizerTool tool) {
-        if (locationIdentity.isConstant() && displacement.isConstant() && (indexScaling == null || indexScaling.isConstant())) {
-            LocationIdentity constLocation = snippetReflection.asObject(LocationIdentity.class, locationIdentity.asJavaConstant());
-            long constDisplacement = displacement.asJavaConstant().asLong();
-            int constIndexScaling = indexScaling == null ? 0 : indexScaling.asJavaConstant().asInt();
-
-            if (index == null || constIndexScaling == 0) {
-                return graph().unique(new ConstantLocationNode(constLocation, constDisplacement));
-            } else if (index.isConstant()) {
-                return graph().unique(new ConstantLocationNode(constLocation, index.asJavaConstant().asLong() * constIndexScaling + constDisplacement));
-            } else {
-                return graph().unique(new IndexedLocationNode(constLocation, constDisplacement, index, constIndexScaling));
-            }
-        }
-        return this;
-    }
-
-    @Override
-    public Value generateAddress(NodeMappableLIRBuilder builder, LIRGeneratorTool gen, Value base) {
-        throw new JVMCIError("locationIdentity must be a constant so that this node can be canonicalized: " + locationIdentity);
-    }
-
-    @Override
-    public IntegerStamp getDisplacementStamp() {
-        throw JVMCIError.shouldNotReachHere();
-    }
-
-    @NodeIntrinsic
-    public static native Location constantLocation(LocationIdentity identity, long displacement);
-
-    @NodeIntrinsic
-    public static native Location indexedLocation(LocationIdentity identity, long displacement, int index, int indexScaling);
-}
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -56,6 +56,11 @@
         return new WordCastNode(StampFactory.forKind(wordKind), input);
     }
 
+    public static WordCastNode addressToWord(ValueNode input, Kind wordKind) {
+        assert input.stamp() instanceof AbstractPointerStamp;
+        return new WordCastNode(StampFactory.forKind(wordKind), input);
+    }
+
     public WordCastNode(Stamp stamp, ValueNode input) {
         super(TYPE, stamp);
         this.input = input;
--- a/graal/com.oracle.jvmci.amd64/src/com/oracle/jvmci/amd64/AMD64.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +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.jvmci.amd64;
-
-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.jvmci.code.Register.RegisterCategory;
-
-/**
- * Represents the AMD64 architecture.
- */
-public class AMD64 extends Architecture {
-
-    public static final RegisterCategory CPU = new RegisterCategory("CPU");
-
-    // @formatter:off
-
-    // General purpose CPU registers
-    public static final Register rax = new Register(0, 0, "rax", CPU);
-    public static final Register rcx = new Register(1, 1, "rcx", CPU);
-    public static final Register rdx = new Register(2, 2, "rdx", CPU);
-    public static final Register rbx = new Register(3, 3, "rbx", CPU);
-    public static final Register rsp = new Register(4, 4, "rsp", CPU);
-    public static final Register rbp = new Register(5, 5, "rbp", CPU);
-    public static final Register rsi = new Register(6, 6, "rsi", CPU);
-    public static final Register rdi = new Register(7, 7, "rdi", CPU);
-
-    public static final Register r8  = new Register(8,  8,  "r8", CPU);
-    public static final Register r9  = new Register(9,  9,  "r9", CPU);
-    public static final Register r10 = new Register(10, 10, "r10", CPU);
-    public static final Register r11 = new Register(11, 11, "r11", CPU);
-    public static final Register r12 = new Register(12, 12, "r12", CPU);
-    public static final Register r13 = new Register(13, 13, "r13", CPU);
-    public static final Register r14 = new Register(14, 14, "r14", CPU);
-    public static final Register r15 = new Register(15, 15, "r15", CPU);
-
-    public static final Register[] cpuRegisters = {
-        rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
-        r8, r9, r10, r11, r12, r13, r14, r15
-    };
-
-    private static final int XMM_REFERENCE_MAP_SHIFT = 2;
-
-    public static final RegisterCategory XMM = new RegisterCategory("XMM", cpuRegisters.length, XMM_REFERENCE_MAP_SHIFT);
-
-    // XMM registers
-    public static final Register xmm0 = new Register(16, 0, "xmm0", XMM);
-    public static final Register xmm1 = new Register(17, 1, "xmm1", XMM);
-    public static final Register xmm2 = new Register(18, 2, "xmm2", XMM);
-    public static final Register xmm3 = new Register(19, 3, "xmm3", XMM);
-    public static final Register xmm4 = new Register(20, 4, "xmm4", XMM);
-    public static final Register xmm5 = new Register(21, 5, "xmm5", XMM);
-    public static final Register xmm6 = new Register(22, 6, "xmm6", XMM);
-    public static final Register xmm7 = new Register(23, 7, "xmm7", XMM);
-
-    public static final Register xmm8 =  new Register(24,  8, "xmm8",  XMM);
-    public static final Register xmm9 =  new Register(25,  9, "xmm9",  XMM);
-    public static final Register xmm10 = new Register(26, 10, "xmm10", XMM);
-    public static final Register xmm11 = new Register(27, 11, "xmm11", XMM);
-    public static final Register xmm12 = new Register(28, 12, "xmm12", XMM);
-    public static final Register xmm13 = new Register(29, 13, "xmm13", XMM);
-    public static final Register xmm14 = new Register(30, 14, "xmm14", XMM);
-    public static final Register xmm15 = new Register(31, 15, "xmm15", XMM);
-
-    public static final Register[] xmmRegisters = {
-        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
-        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
-    };
-
-    public static final Register[] cpuxmmRegisters = {
-        rax,  rcx,  rdx,   rbx,   rsp,   rbp,   rsi,   rdi,
-        r8,   r9,   r10,   r11,   r12,   r13,   r14,   r15,
-        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
-        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
-    };
-
-    /**
-     * Register used to construct an instruction-relative address.
-     */
-    public static final Register rip = new Register(32, -1, "rip", SPECIAL);
-
-    public static final Register[] allRegisters = {
-        rax,  rcx,  rdx,   rbx,   rsp,   rbp,   rsi,   rdi,
-        r8,   r9,   r10,   r11,   r12,   r13,   r14,   r15,
-        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
-        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,
-        rip
-    };
-
-    // @formatter:on
-
-    /**
-     * Basic set of CPU features mirroring what is returned from the cpuid instruction.
-     */
-    public static enum CPUFeature {
-        SSE,
-        SSE2,
-        SSE3,
-        SSE4a,
-        SSE4_1,
-        SSE4_2,
-        SSSE3,
-        POPCNT,
-        LZCNT,
-        AVX,
-        AVX2,
-        ERMS,
-        AMD_3DNOW_PREFETCH,
-        AES,
-        BMI1
-    }
-
-    private final EnumSet<CPUFeature> features;
-
-    /**
-     * Set of flags to control code emission.
-     */
-    public static enum Flag {
-        UseCountLeadingZerosInstruction,
-        UseCountTrailingZerosInstruction
-    }
-
-    private final EnumSet<Flag> flags;
-
-    public AMD64(EnumSet<CPUFeature> features, EnumSet<Flag> flags) {
-        super("AMD64", 8, ByteOrder.LITTLE_ENDIAN, true, allRegisters, LOAD_STORE | STORE_STORE, 1, cpuRegisters.length + (xmmRegisters.length << XMM_REFERENCE_MAP_SHIFT), 8);
-        this.features = features;
-        this.flags = flags;
-        assert features.contains(CPUFeature.SSE2) : "minimum config for x64";
-    }
-
-    public EnumSet<CPUFeature> getFeatures() {
-        return features;
-    }
-
-    public EnumSet<Flag> getFlags() {
-        return flags;
-    }
-
-    @Override
-    public boolean canStoreValue(RegisterCategory category, PlatformKind platformKind) {
-        if (!(platformKind instanceof Kind)) {
-            return false;
-        }
-
-        Kind kind = (Kind) platformKind;
-        if (category.equals(CPU)) {
-            switch (kind) {
-                case Boolean:
-                case Byte:
-                case Char:
-                case Short:
-                case Int:
-                case Long:
-                case Object:
-                    return true;
-            }
-        } else if (category.equals(XMM)) {
-            switch (kind) {
-                case Float:
-                case Double:
-                    return true;
-            }
-        }
-
-        return false;
-    }
-
-    @Override
-    public PlatformKind getLargestStorableKind(RegisterCategory category) {
-        if (category.equals(CPU)) {
-            return Kind.Long;
-        } else if (category.equals(XMM)) {
-            return Kind.Double;
-        } else {
-            return Kind.Illegal;
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.code/overview.html	Tue Jun 09 18:48:06 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.jvmci.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.jvmci.code/src/com/oracle/jvmci/code/AbstractAddress.java	Tue Jun 09 18:48:06 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.jvmci.code;
-
-/**
- * Abstract base class that represents a platform specific address.
- */
-public abstract class AbstractAddress {
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/Architecture.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ArithmeticOperation.java	Tue Jun 09 18:48:06 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.jvmci.code;
-
-/**
- * An {@code ArithmeticOperation} is an operation that does primitive value arithmetic without side
- * effect.
- */
-public interface ArithmeticOperation {
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BailoutException.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BytecodeFrame.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BytecodePosition.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +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.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());
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CalleeSaveLayout.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CallingConvention.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeCacheProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +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.jvmci.code;
-
-import com.oracle.jvmci.code.CompilationResult.Call;
-import com.oracle.jvmci.code.CompilationResult.DataPatch;
-import com.oracle.jvmci.code.CompilationResult.Mark;
-import com.oracle.jvmci.code.DataSection.Data;
-import com.oracle.jvmci.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);
-
-    /**
-     * Gets a name for a {@link Mark} mark.
-     */
-    default String getMarkName(Mark mark) {
-        return String.valueOf(mark.id);
-    }
-
-    /**
-     * Gets a name for the {@linkplain Call#target target} of a {@link Call}.
-     */
-    default String getTargetName(Call call) {
-        return String.valueOf(call.target);
-    }
-
-    /**
-     * 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.jvmci.code/src/com/oracle/jvmci/code/CodeUtil.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,474 +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.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) {
-            sb.append(refMap.toString());
-        }
-        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.jvmci.code/src/com/oracle/jvmci/code/CompilationResult.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,939 +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.jvmci.code;
-
-import static com.oracle.jvmci.meta.MetaUtil.*;
-import static java.util.Collections.*;
-
-import java.util.*;
-
-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) {
-                sb.append(refMap.toString());
-                sb.append(']');
-            }
-            RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
-            if (calleeSaveInfo != null) {
-                sb.append(" callee-save-info[");
-                String sep = "";
-                for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
-                    sb.append(sep).append(e.getKey()).append("->").append(e.getValue());
-                    sep = ", ";
-                }
-                sb.append(']');
-            }
-            BytecodePosition codePos = info.getBytecodePosition();
-            if (codePos != null) {
-                MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI());
-                if (info.hasFrame()) {
-                    sb.append(" #locals=").append(info.frame().numLocals).append(" #expr=").append(info.frame().numStack);
-                    if (info.frame().numLocks > 0) {
-                        sb.append(" #locks=").append(info.frame().numLocks);
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * @return the list of infopoints, sorted by {@link Site#pcOffset}
-     */
-    public List<Infopoint> getInfopoints() {
-        if (infopoints.isEmpty()) {
-            return emptyList();
-        }
-        return unmodifiableList(infopoints);
-    }
-
-    /**
-     * @return the list of data references
-     */
-    public List<DataPatch> getDataPatches() {
-        if (dataPatches.isEmpty()) {
-            return emptyList();
-        }
-        return unmodifiableList(dataPatches);
-    }
-
-    /**
-     * @return the list of exception handlers
-     */
-    public List<ExceptionHandler> getExceptionHandlers() {
-        if (exceptionHandlers.isEmpty()) {
-            return emptyList();
-        }
-        return unmodifiableList(exceptionHandlers);
-    }
-
-    /**
-     * @return the list of marks
-     */
-    public List<Mark> getMarks() {
-        if (marks.isEmpty()) {
-            return emptyList();
-        }
-        return unmodifiableList(marks);
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void reset() {
-        infopoints.clear();
-        dataPatches.clear();
-        exceptionHandlers.clear();
-        marks.clear();
-        if (annotations != null) {
-            annotations.clear();
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/DataSection.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/DebugInfo.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ForeignCallLinkage.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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.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();
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ForeignCallsProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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.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);
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InfopointReason.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InstalledCode.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InvalidInstalledCodeException.java	Tue Jun 09 18:48:06 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.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;
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/MemoryBarriers.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ReferenceMap.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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.jvmci.code;
-
-import com.oracle.jvmci.meta.*;
-
-public abstract class ReferenceMap {
-
-    /**
-     * Empty out the reference map.
-     */
-    public abstract void reset();
-
-    /**
-     * Add {@code value} to the current set of reference values.
-     *
-     * @param v
-     */
-    public abstract void addLiveValue(Value v);
-
-    /**
-     * Perform any final encoding needed before use.
-     */
-    public abstract void finish();
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/Register.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterAttributes.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterConfig.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +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.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();
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterSaveLayout.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterValue.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/SourceStackTrace.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackLockValue.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackSlot.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackSlotValue.java	Tue Jun 09 18:48:06 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.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);
-    }
-
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/TargetDescription.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +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.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);
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/TypeCheckHints.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/UnsignedMath.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ValueUtil.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/VirtualObject.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/VirtualStackSlot.java	Tue Jun 09 18:48:06 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.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;
-    }
-
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/package-info.java	Tue Jun 09 18:48:06 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.jvmci.code.CodeCacheProvider} interface.
- * The method {@link com.oracle.jvmci.code.CodeCacheProvider#addMethod(com.oracle.jvmci.meta.ResolvedJavaMethod, CompilationResult, com.oracle.jvmci.meta.SpeculationLog, InstalledCode)}
- * can be used to install code for a given method.
- */
-package com.oracle.jvmci.code;
-
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/InspectedFrame.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/InspectedFrameVisitor.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/StackIntrospection.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.common/src/com/oracle/jvmci/common/JVMCIError.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +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.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));
-    }
-}
--- a/graal/com.oracle.jvmci.common/src/com/oracle/jvmci/common/UnsafeAccess.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.debug.test/src/com/oracle/jvmci/debug/test/DebugHistogramTest.java	Tue Jun 09 18:48:06 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.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]);
-    }
-}
--- a/graal/com.oracle.jvmci.debug.test/src/com/oracle/jvmci/debug/test/DebugTimerTest.java	Tue Jun 09 18:48:06 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.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);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.debug/overview.html	Tue Jun 09 18:48:06 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.jvmci.debug</code> project.
-
-</body>
-</html>
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/AnsiColor.java	Tue Jun 09 18:48:06 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.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() {
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Debug.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1551 +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.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.*;
-import com.oracle.jvmci.service.*;
-
-/**
- * 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 {
-
-    static {
-        for (DebugInitializationPropertyProvider p : Services.load(DebugInitializationPropertyProvider.class)) {
-            p.apply();
-        }
-    }
-
-    /**
-     * 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;
-        }
-    };
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugCloseable.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugConfig.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugConfigScope.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugDumpHandler.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugDumpScope.java	Tue Jun 09 18:48:06 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.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 + "]";
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugHistogram.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugInitializationPropertyProvider.java	Tue Jun 09 18:48:06 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.jvmci.debug;
-
-import com.oracle.jvmci.service.*;
-
-/**
- * Sets one or more system properties used during initialization of the {@link Debug} class.
- */
-public interface DebugInitializationPropertyProvider extends Service {
-    void apply();
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugMemUseTracker.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugMetric.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugTimer.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugVerifyHandler.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DelegatingDebugConfig.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Fingerprint.java	Tue Jun 09 18:48:06 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.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++;
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Indent.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/LogStream.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TTY.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TopLevelDebugConfig.java	Tue Jun 09 18:48:06 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.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 {
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/AccumulatedDebugValue.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/CloseableCounterImpl.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramAsciiPrinter.java	Tue Jun 09 18:48:06 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.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));
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramImpl.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramRPrinter.java	Tue Jun 09 18:48:06 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.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(");");
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugScope.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugValue.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugValueMap.java	Tue Jun 09 18:48:06 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.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);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/KeyRegistry.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/MemUseTrackerImpl.java	Tue Jun 09 18:48:06 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.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);
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/MetricImpl.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/TimerImpl.java	Tue Jun 09 18:48:06 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.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();
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot.amd64/src/com/oracle/jvmci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +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.jvmci.hotspot.amd64;
-
-import static com.oracle.jvmci.hotspot.InitTimer.*;
-
-import java.util.*;
-
-import com.oracle.jvmci.amd64.*;
-import com.oracle.jvmci.code.*;
-import com.oracle.jvmci.hotspot.*;
-import com.oracle.jvmci.meta.*;
-import com.oracle.jvmci.runtime.*;
-import com.oracle.jvmci.service.*;
-
-@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 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";
-    }
-
-    @Override
-    public String toString() {
-        return getJVMCIRuntimeName() + ":" + 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.jvmci.hotspot.amd64/src/com/oracle/jvmci/hotspot/amd64/AMD64HotSpotRegisterConfig.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +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.jvmci.hotspot.amd64;
-
-import com.oracle.jvmci.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.jvmci.amd64.AMD64.*;
-
-import java.util.*;
-
-import com.oracle.jvmci.code.CallingConvention.Type;
-import com.oracle.jvmci.common.*;
-import com.oracle.jvmci.hotspot.*;
-
-public class AMD64HotSpotRegisterConfig implements RegisterConfig {
-
-    private final Architecture architecture;
-
-    private final Register[] allocatable;
-
-    private final int maxFrameSize;
-
-    /**
-     * The caller saved registers always include all parameter registers.
-     */
-    private final Register[] callerSaved;
-
-    private final boolean allAllocatableAreCallerSaved;
-
-    private final RegisterAttributes[] attributesMap;
-
-    public int getMaximumFrameSize() {
-        return maxFrameSize;
-    }
-
-    @Override
-    public Register[] getAllocatableRegisters() {
-        return allocatable.clone();
-    }
-
-    public Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers) {
-        ArrayList<Register> list = new ArrayList<>();
-        for (Register reg : registers) {
-            if (architecture.canStoreValue(reg.getRegisterCategory(), kind)) {
-                list.add(reg);
-            }
-        }
-
-        Register[] ret = list.toArray(new Register[list.size()]);
-        return ret;
-    }
-
-    @Override
-    public RegisterAttributes[] getAttributesMap() {
-        return attributesMap.clone();
-    }
-
-    private final Register[] javaGeneralParameterRegisters;
-    private final Register[] nativeGeneralParameterRegisters;
-    private final Register[] xmmParameterRegisters = {xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7};
-
-    /*
-     * Some ABIs (e.g. Windows) require a so-called "home space", that is a save area on the stack
-     * to store the argument registers
-     */
-    private final boolean needsNativeStackHomeSpace;
-
-    private final CalleeSaveLayout csl;
-
-    private static Register[] initAllocatable(boolean reserveForHeapBase) {
-        Register[] registers = null;
-        // @formatter:off
-        if (reserveForHeapBase) {
-            registers = new Register[] {
-                        rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9,  r10, r11, /*r12,*/ r13, r14, /*r15, */
-                        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
-                        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
-                      };
-        } else {
-            registers = new Register[] {
-                        rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9,  r10, r11, r12, r13, r14, /*r15, */
-                        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
-                        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
-                      };
-        }
-       // @formatter:on
-        return registers;
-    }
-
-    public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config) {
-        this(architecture, config, initAllocatable(config.useCompressedOops));
-        assert callerSaved.length >= allocatable.length;
-    }
-
-    public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config, Register[] allocatable) {
-        this.architecture = architecture;
-        this.maxFrameSize = config.maxFrameSize;
-
-        if (config.windowsOs) {
-            javaGeneralParameterRegisters = new Register[]{rdx, r8, r9, rdi, rsi, rcx};
-            nativeGeneralParameterRegisters = new Register[]{rcx, rdx, r8, r9};
-            this.needsNativeStackHomeSpace = true;
-        } else {
-            javaGeneralParameterRegisters = new Register[]{rsi, rdx, rcx, r8, r9, rdi};
-            nativeGeneralParameterRegisters = new Register[]{rdi, rsi, rdx, rcx, r8, r9};
-            this.needsNativeStackHomeSpace = false;
-        }
-
-        csl = null;
-        this.allocatable = allocatable.clone();
-        Set<Register> callerSaveSet = new HashSet<>();
-        Collections.addAll(callerSaveSet, allocatable);
-        Collections.addAll(callerSaveSet, xmmParameterRegisters);
-        Collections.addAll(callerSaveSet, javaGeneralParameterRegisters);
-        Collections.addAll(callerSaveSet, nativeGeneralParameterRegisters);
-        callerSaved = callerSaveSet.toArray(new Register[callerSaveSet.size()]);
-
-        allAllocatableAreCallerSaved = true;
-        attributesMap = RegisterAttributes.createMap(this, AMD64.allRegisters);
-    }
-
-    @Override
-    public Register[] getCallerSaveRegisters() {
-        return callerSaved;
-    }
-
-    @Override
-    public boolean areAllAllocatableRegistersCallerSaved() {
-        return allAllocatableAreCallerSaved;
-    }
-
-    @Override
-    public Register getRegisterForRole(int index) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly) {
-        if (type == Type.NativeCall) {
-            return callingConvention(nativeGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
-        }
-        // On x64, parameter locations are the same whether viewed
-        // from the caller or callee perspective
-        return callingConvention(javaGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
-    }
-
-    public Register[] getCallingConventionRegisters(Type type, Kind kind) {
-        if (architecture.canStoreValue(XMM, kind)) {
-            return xmmParameterRegisters;
-        }
-        assert architecture.canStoreValue(CPU, kind);
-        return type == Type.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters;
-    }
-
-    private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, Type type, TargetDescription target, boolean stackOnly) {
-        AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
-
-        int currentGeneral = 0;
-        int currentXMM = 0;
-        int currentStackOffset = type == Type.NativeCall && needsNativeStackHomeSpace ? generalParameterRegisters.length * target.wordSize : 0;
-
-        for (int i = 0; i < parameterTypes.length; i++) {
-            final Kind kind = parameterTypes[i].getKind();
-
-            switch (kind) {
-                case Byte:
-                case Boolean:
-                case Short:
-                case Char:
-                case Int:
-                case Long:
-                case Object:
-                    if (!stackOnly && currentGeneral < generalParameterRegisters.length) {
-                        Register register = generalParameterRegisters[currentGeneral++];
-                        locations[i] = register.asValue(target.getLIRKind(kind));
-                    }
-                    break;
-                case Float:
-                case Double:
-                    if (!stackOnly && currentXMM < xmmParameterRegisters.length) {
-                        Register register = xmmParameterRegisters[currentXMM++];
-                        locations[i] = register.asValue(target.getLIRKind(kind));
-                    }
-                    break;
-                default:
-                    throw JVMCIError.shouldNotReachHere();
-            }
-
-            if (locations[i] == null) {
-                locations[i] = StackSlot.get(target.getLIRKind(kind.getStackKind()), currentStackOffset, !type.out);
-                currentStackOffset += Math.max(target.getSizeInBytes(kind), target.wordSize);
-            }
-        }
-
-        Kind returnKind = returnType == null ? Kind.Void : returnType.getKind();
-        AllocatableValue returnLocation = returnKind == Kind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(target.getLIRKind(returnKind.getStackKind()));
-        return new CallingConvention(currentStackOffset, returnLocation, locations);
-    }
-
-    @Override
-    public Register getReturnRegister(Kind kind) {
-        switch (kind) {
-            case Boolean:
-            case Byte:
-            case Char:
-            case Short:
-            case Int:
-            case Long:
-            case Object:
-                return rax;
-            case Float:
-            case Double:
-                return xmm0;
-            case Void:
-            case Illegal:
-                return null;
-            default:
-                throw new UnsupportedOperationException("no return register for type " + kind);
-        }
-    }
-
-    @Override
-    public Register getFrameRegister() {
-        return rsp;
-    }
-
-    public CalleeSaveLayout getCalleeSaveLayout() {
-        return csl;
-    }
-
-    @Override
-    public String toString() {
-        return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave:  " + Arrays.toString(getCallerSaveRegisters()) + "%n");
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot.jfr/src/com/oracle/jvmci/hotspot/jfr/events/JFREventProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +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.jvmci.hotspot.jfr.events;
-
-import java.net.*;
-
-import com.oracle.jrockit.jfr.*;
-import com.oracle.jvmci.hotspot.*;
-import com.oracle.jvmci.hotspot.events.*;
-import com.oracle.jvmci.hotspot.events.EmptyEventProvider.EmptyCompilerFailureEvent;
-import com.oracle.jvmci.hotspot.events.EmptyEventProvider.EmptyCompilationEvent;
-import com.oracle.jvmci.service.*;
-
-/**
- * A JFR implementation for {@link EventProvider}. This implementation is used when Flight Recorder
- * is turned on.
- */
-@ServiceProvider(EventProvider.class)
-public final class JFREventProvider implements EventProvider {
-
-    private final boolean enabled;
-
-    @SuppressWarnings("deprecation")
-    public JFREventProvider() {
-        enabled = HotSpotJVMCIRuntime.runtime().getConfig().flightRecorder;
-        if (enabled) {
-            try {
-                /*
-                 * The "HotSpot JVM" producer is a native producer and we cannot use it. So we
-                 * create our own. This has the downside that Mission Control is confused and
-                 * doesn't show Graal's events in the "Code" tab. There are plans to revise the JFR
-                 * code for JDK 9.
-                 */
-                Producer producer = new Producer("HotSpot JVM", "Oracle Hotspot JVM", "http://www.oracle.com/hotspot/jvm/");
-                producer.register();
-                // Register event classes with Producer.
-                for (Class<?> c : JFREventProvider.class.getDeclaredClasses()) {
-                    if (c.isAnnotationPresent(EventDefinition.class)) {
-                        assert com.oracle.jrockit.jfr.InstantEvent.class.isAssignableFrom(c) : c;
-                        registerEvent(producer, c);
-                    }
-                }
-            } catch (URISyntaxException e) {
-                throw new InternalError(e);
-            }
-        }
-    }
-
-    /**
-     * Register an event class with the {@link Producer}.
-     *
-     * @param c event class
-     * @return the {@link EventToken event token}
-     */
-    @SuppressWarnings({"deprecation", "javadoc", "unchecked"})
-    private static EventToken registerEvent(Producer producer, Class<?> c) {
-        try {
-            return producer.addEvent((Class<? extends com.oracle.jrockit.jfr.InstantEvent>) c);
-        } catch (InvalidEventDefinitionException | InvalidValueException e) {
-            throw new InternalError(e);
-        }
-    }
-
-    public CompilationEvent newCompilationEvent() {
-        if (enabled) {
-            return new JFRCompilationEvent();
-        }
-        return new EmptyCompilationEvent();
-    }
-
-    /**
-     * A JFR compilation event.
-     *
-     * <p>
-     * See: event {@code Compilation} in {@code src/share/vm/trace/trace.xml}
-     */
-    @SuppressWarnings("deprecation")
-    @EventDefinition(name = "Compilation", path = "vm/compiler/compilation")
-    public static class JFRCompilationEvent extends com.oracle.jrockit.jfr.DurationEvent implements CompilationEvent {
-
-        /*
-         * FIXME method should be a Method* but we can't express that in Java.
-         */
-        @ValueDefinition(name = "Java Method") public String method;
-        @ValueDefinition(name = "Compilation ID", relationKey = "COMP_ID") public int compileId;
-        @ValueDefinition(name = "Compilation Level") public short compileLevel;
-        @ValueDefinition(name = "Succeeded") public boolean succeeded;
-        @ValueDefinition(name = "On Stack Replacement") public boolean isOsr;
-        @ValueDefinition(name = "Compiled Code Size", contentType = ContentType.Bytes) public int codeSize;
-        @ValueDefinition(name = "Inlined Code Size", contentType = ContentType.Bytes) public int inlinedBytes;
-
-        public void setMethod(String method) {
-            this.method = method;
-        }
-
-        public void setCompileId(int id) {
-            this.compileId = id;
-        }
-
-        public void setCompileLevel(int compileLevel) {
-            this.compileLevel = (short) compileLevel;
-        }
-
-        public void setSucceeded(boolean succeeded) {
-            this.succeeded = succeeded;
-        }
-
-        public void setIsOsr(boolean isOsr) {
-            this.isOsr = isOsr;
-        }
-
-        public void setCodeSize(int codeSize) {
-            this.codeSize = codeSize;
-        }
-
-        public void setInlinedBytes(int inlinedBytes) {
-            this.inlinedBytes = inlinedBytes;
-        }
-    }
-
-    public CompilerFailureEvent newCompilerFailureEvent() {
-        if (enabled) {
-            return new JFRCompilerFailureEvent();
-        }
-        return new EmptyCompilerFailureEvent();
-    }
-
-    /**
-     * A JFR compiler failure event.
-     *
-     * <p>
-     * See: event {@code CompilerFailure} in {@code src/share/vm/trace/trace.xml}
-     */
-    @SuppressWarnings("deprecation")
-    @EventDefinition(name = "Compilation Failure", path = "vm/compiler/failure")
-    public static class JFRCompilerFailureEvent extends com.oracle.jrockit.jfr.InstantEvent implements CompilerFailureEvent {
-
-        @ValueDefinition(name = "Compilation ID", relationKey = "COMP_ID") public int compileId;
-        @ValueDefinition(name = "Message", description = "The failure message") public String failure;
-
-        public void setCompileId(int id) {
-            this.compileId = id;
-        }
-
-        public void setMessage(String message) {
-            this.failure = message;
-        }
-    }
-
-}
--- a/graal/com.oracle.jvmci.hotspot.sparc/src/com/oracle/jvmci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +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.jvmci.hotspot.sparc;
-
-import static com.oracle.jvmci.hotspot.InitTimer.*;
-
-import java.util.*;
-
-import com.oracle.jvmci.code.*;
-import com.oracle.jvmci.hotspot.*;
-import com.oracle.jvmci.runtime.*;
-import com.oracle.jvmci.service.*;
-import com.oracle.jvmci.sparc.*;
-import com.oracle.jvmci.sparc.SPARC.CPUFeature;
-
-@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 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";
-    }
-
-    @Override
-    public String toString() {
-        return getJVMCIRuntimeName() + ":" + 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.jvmci.hotspot.sparc/src/com/oracle/jvmci/hotspot/sparc/SPARCHotSpotRegisterConfig.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +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.jvmci.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 com.oracle.jvmci.sparc.*;
-
-import static com.oracle.jvmci.sparc.SPARC.*;
-
-import java.util.*;
-
-import com.oracle.jvmci.code.CallingConvention.Type;
-import com.oracle.jvmci.common.*;
-import com.oracle.jvmci.hotspot.*;
-
-public class SPARCHotSpotRegisterConfig implements RegisterConfig {
-
-    private final Architecture architecture;
-
-    private final Register[] allocatable;
-
-    private final RegisterAttributes[] attributesMap;
-
-    @Override
-    public Register[] getAllocatableRegisters() {
-        return allocatable.clone();
-    }
-
-    public Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers) {
-        ArrayList<Register> list = new ArrayList<>();
-        for (Register reg : registers) {
-            if (architecture.canStoreValue(reg.getRegisterCategory(), kind)) {
-                // Special treatment for double precision
-                // TODO: This is wasteful it uses only half of the registers as float.
-                if (kind == Kind.Double) {
-                    if (reg.name.startsWith("d")) {
-                        list.add(reg);
-                    }
-                } else if (kind == Kind.Float) {
-                    if (reg.name.startsWith("f")) {
-                        list.add(reg);
-                    }
-                } else {
-                    list.add(reg);
-                }
-            }
-        }
-
-        Register[] ret = list.toArray(new Register[list.size()]);
-        return ret;
-    }
-
-    @Override
-    public RegisterAttributes[] getAttributesMap() {
-        return attributesMap.clone();
-    }
-
-    private final Register[] cpuCallerParameterRegisters = {o0, o1, o2, o3, o4, o5};
-    private final Register[] cpuCalleeParameterRegisters = {i0, i1, i2, i3, i4, i5};
-
-    private final Register[] fpuParameterRegisters = {f0, f1, f2, f3, f4, f5, f6, f7};
-    private final Register[] fpuDoubleParameterRegisters = {d0, null, d2, null, d4, null, d6, null};
-    // @formatter:off
-    private final Register[] callerSaveRegisters =
-                   {g1, g2, g3, g4, g5, g6, g7,
-                    o0, o1, o2, o3, o4, o5, o7,
-                    f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
-                    f8,  f9,  f10, f11, f12, f13, f14, f15,
-                    f16, f17, f18, f19, f20, f21, f22, f23,
-                    f24, f25, f26, f27, f28, f29, f30, f31,
-                    d32, d34, d36, d38, d40, d42, d44, d46,
-                    d48, d50, d52, d54, d56, d58, d60, d62};
-    // @formatter:on
-
-    /**
-     * Registers saved by the callee. This lists all L and I registers which are saved in the
-     * register window.
-     */
-    private final Register[] calleeSaveRegisters = {l0, l1, l2, l3, l4, l5, l6, l7, i0, i1, i2, i3, i4, i5, i6, i7};
-
-    private final CalleeSaveLayout csl;
-
-    private static Register[] initAllocatable(boolean reserveForHeapBase) {
-        Register[] registers = null;
-        if (reserveForHeapBase) {
-            // @formatter:off
-            registers = new Register[]{
-                        // TODO this is not complete
-                        // o7 cannot be used as register because it is always overwritten on call
-                        // and the current register handler would ignore this fact if the called
-                        // method still does not modify registers, in fact o7 is modified by the Call instruction
-                        // There would be some extra handlin necessary to be able to handle the o7 properly for local usage
-                        o0, o1, o2, o3, o4, o5, /*o6, o7,*/
-                        l0, l1, l2, l3, l4, l5, l6, l7,
-                        i0, i1, i2, i3, i4, i5, /*i6,*/ /*i7,*/
-                        //f0, f1, f2, f3, f4, f5, f6, f7,
-                        f8,  f9,  f10, f11, f12, f13, f14, f15,
-                        f16, f17, f18, f19, f20, f21, f22, f23,
-                        f24, f25, f26, f27, f28, f29, f30, f31,
-                        d32, d34, d36, d38, d40, d42, d44, d46,
-                        d48, d50, d52, d54, d56, d58, d60, d62
-            };
-            // @formatter:on
-        } else {
-            // @formatter:off
-            registers = new Register[]{
-                        // TODO this is not complete
-                        o0, o1, o2, o3, o4, o5, /*o6, o7,*/
-                        l0, l1, l2, l3, l4, l5, l6, l7,
-                        i0, i1, i2, i3, i4, i5, /*i6,*/ /*i7,*/
-//                        f0, f1, f2, f3, f4, f5, f6, f7
-                        f8,  f9,  f10, f11, f12, f13, f14, f15,
-                        f16, f17, f18, f19, f20, f21, f22, f23,
-                        f24, f25, f26, f27, f28, f29, f30, f31,
-                        d32, d34, d36, d38, d40, d42, d44, d46,
-                        d48, d50, d52, d54, d56, d58, d60, d62
-            };
-            // @formatter:on
-        }
-
-        return registers;
-    }
-
-    public SPARCHotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config) {
-        this(target, initAllocatable(config.useCompressedOops));
-    }
-
-    public SPARCHotSpotRegisterConfig(TargetDescription target, Register[] allocatable) {
-        this.architecture = target.arch;
-
-        csl = new CalleeSaveLayout(target, -1, -1, target.arch.getWordSize(), calleeSaveRegisters);
-        this.allocatable = allocatable.clone();
-        attributesMap = RegisterAttributes.createMap(this, SPARC.allRegisters);
-    }
-
-    @Override
-    public Register[] getCallerSaveRegisters() {
-        return callerSaveRegisters;
-    }
-
-    @Override
-    public boolean areAllAllocatableRegistersCallerSaved() {
-        return false;
-    }
-
-    @Override
-    public Register getRegisterForRole(int index) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly) {
-        if (type == Type.JavaCall || type == Type.NativeCall) {
-            return callingConvention(cpuCallerParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
-        }
-        if (type == Type.JavaCallee) {
-            return callingConvention(cpuCalleeParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
-        }
-        throw JVMCIError.shouldNotReachHere();
-    }
-
-    public Register[] getCallingConventionRegisters(Type type, Kind kind) {
-        if (architecture.canStoreValue(FPUs, kind) || architecture.canStoreValue(FPUd, kind)) {
-            return fpuParameterRegisters;
-        }
-        assert architecture.canStoreValue(CPU, kind);
-        return type == Type.JavaCallee ? cpuCalleeParameterRegisters : cpuCallerParameterRegisters;
-    }
-
-    private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, Type type, TargetDescription target, boolean stackOnly) {
-        AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
-
-        int currentGeneral = 0;
-        int currentFloating = 0;
-        int currentStackOffset = 0;
-
-        for (int i = 0; i < parameterTypes.length; i++) {
-            final Kind kind = parameterTypes[i].getKind();
-
-            switch (kind) {
-                case Byte:
-                case Boolean:
-                case Short:
-                case Char:
-                case Int:
-                case Long:
-                case Object:
-                    if (!stackOnly && currentGeneral < generalParameterRegisters.length) {
-                        Register register = generalParameterRegisters[currentGeneral++];
-                        locations[i] = register.asValue(target.getLIRKind(kind));
-                    }
-                    break;
-                case Double:
-                    if (!stackOnly && currentFloating < fpuParameterRegisters.length) {
-                        if (currentFloating % 2 != 0) {
-                            // Make register number even to be a double reg
-                            currentFloating++;
-                        }
-                        Register register = fpuDoubleParameterRegisters[currentFloating];
-                        currentFloating += 2; // Only every second is a double register
-                        locations[i] = register.asValue(target.getLIRKind(kind));
-                    }
-                    break;
-                case Float:
-                    if (!stackOnly && currentFloating < fpuParameterRegisters.length) {
-                        Register register = fpuParameterRegisters[currentFloating++];
-                        locations[i] = register.asValue(target.getLIRKind(kind));
-                    }
-                    break;
-                default:
-                    throw JVMCIError.shouldNotReachHere();
-            }
-
-            if (locations[i] == null) {
-                // Stack slot is always aligned to its size in bytes but minimum wordsize
-                int typeSize = SPARC.spillSlotSize(target, kind);
-                currentStackOffset = roundUp(currentStackOffset, typeSize);
-                locations[i] = StackSlot.get(target.getLIRKind(kind.getStackKind()), currentStackOffset, !type.out);
-                currentStackOffset += typeSize;
-            }
-        }
-
-        Kind returnKind = returnType == null ? Kind.Void : returnType.getKind();
-        AllocatableValue returnLocation = returnKind == Kind.Void ? Value.ILLEGAL : getReturnRegister(returnKind, type).asValue(target.getLIRKind(returnKind.getStackKind()));
-        return new CallingConvention(currentStackOffset, returnLocation, locations);
-    }
-
-    private static int roundUp(int number, int mod) {
-        return ((number + mod - 1) / mod) * mod;
-    }
-
-    @Override
-    public Register getReturnRegister(Kind kind) {
-        return getReturnRegister(kind, Type.JavaCallee);
-    }
-
-    private static Register getReturnRegister(Kind kind, Type type) {
-        switch (kind) {
-            case Boolean:
-            case Byte:
-            case Char:
-            case Short:
-            case Int:
-            case Long:
-            case Object:
-                return type == Type.JavaCallee ? i0 : o0;
-            case Float:
-                return f0;
-            case Double:
-                return d0;
-            case Void:
-            case Illegal:
-                return null;
-            default:
-                throw new UnsupportedOperationException("no return register for type " + kind);
-        }
-    }
-
-    @Override
-    public Register getFrameRegister() {
-        return sp;
-    }
-
-    public CalleeSaveLayout getCalleeSaveLayout() {
-        return csl;
-    }
-
-    @Override
-    public String toString() {
-        return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave:  " + Arrays.toString(getCallerSaveRegisters()) + "%n");
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVM.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,342 +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.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();
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVMImpl.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +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.jvmci.hotspot;
-
-import static com.oracle.jvmci.hotspot.InitTimer.*;
-
-import com.oracle.jvmci.code.*;
-import com.oracle.jvmci.meta.*;
-
-/**
- * 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();
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCodeCacheProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +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.
- */
-package com.oracle.jvmci.hotspot;
-
-import static com.oracle.jvmci.hotspot.HotSpotCompressedNullConstant.*;
-
-import java.lang.reflect.*;
-
-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.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 getMarkName(Mark mark) {
-        int markId = (int) mark.id;
-        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 CodeCacheProvider.super.getMarkName(mark);
-    }
-
-    /**
-     * Decodes a call target to a mnemonic if possible.
-     */
-    @Override
-    public 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 CodeCacheProvider.super.getTargetName(call);
-    }
-
-    @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();
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledCode.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledNmethod.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompressedNullConstant.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstant.java	Tue Jun 09 18:48:06 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.jvmci.hotspot;
-
-import com.oracle.jvmci.meta.*;
-
-/**
- * Marker interface for hotspot specific constants.
- */
-public interface HotSpotConstant extends Constant {
-
-    boolean isCompressed();
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantPool.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,653 +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.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() + ">";
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantReflectionProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,364 +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.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 the computed index or -1 if the offset isn't within the array
-     */
-    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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotForeignCallTarget.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotInstalledCode.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIBackendFactory.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +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.jvmci.hotspot;
-
-import com.oracle.jvmci.runtime.*;
-import com.oracle.jvmci.service.*;
-
-public interface HotSpotJVMCIBackendFactory extends Service {
-
-    JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host);
-
-    /**
-     * Gets the CPU architecture of this backend.
-     */
-    String getArchitecture();
-
-    String getJVMCIRuntimeName();
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +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.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.*;
-import com.oracle.jvmci.service.*;
-
-//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 final HotSpotVMEventListener vmEventListener;
-
-    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));
-        }
-
-        HotSpotVMEventListener listener = Services.loadSingle(HotSpotVMEventListener.class, false);
-        if (listener == null) {
-            listener = new HotSpotVMEventListener() {
-            };
-        }
-        vmEventListener = listener;
-    }
-
-    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"})
-    private void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long jvmciEnv, int id) {
-        vmEventListener.compileMetaspaceMethod(metaspaceMethod, entryBCI, jvmciEnv, id);
-    }
-
-    /**
-     * Called from the VM.
-     */
-    @SuppressWarnings({"unused"})
-    private void compileTheWorld() throws Throwable {
-        vmEventListener.notifyCompileTheWorld();
-    }
-
-    /**
-     * Shuts down the runtime.
-     *
-     * Called from the VM.
-     */
-    @SuppressWarnings({"unused"})
-    private void shutdown() throws Exception {
-        vmEventListener.notifyShutdown();
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +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.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);
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJavaType.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMemoryAccessProvider.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMemoryAccessProviderImpl.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaAccessProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,326 +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.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.*;
-
-// JaCoCo Exclude
-
-/**
- * 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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaspaceConstant.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaspaceConstantImpl.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethod.java	Tue Jun 09 18:48:06 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.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));
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodData.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,858 +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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodDataAccessor.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +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.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);
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodHandleAccessProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +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.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());
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodUnresolved.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotNmethod.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotObjectConstant.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotObjectConstantImpl.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,290 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotOptions.java	Tue Jun 09 18:48:06 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.jvmci.hotspot;
-
-import java.util.*;
-
-import com.oracle.jvmci.options.*;
-import com.oracle.jvmci.service.*;
-
-//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");
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotProfilingInfo.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotProxified.java	Tue Jun 09 18:48:06 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.jvmci.hotspot;
-
-/**
- * Marker interface for classes whose values are proxied during replay compilation capture.
- */
-public interface HotSpotProxified {
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotReferenceMap.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +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.jvmci.hotspot;
-
-import static com.oracle.jvmci.code.ValueUtil.*;
-
-import java.util.*;
-
-import com.oracle.jvmci.code.*;
-import com.oracle.jvmci.meta.*;
-
-public final class HotSpotReferenceMap extends ReferenceMap {
-
-    private Value[] objects;
-    private int[] bytesPerElement;
-    private int maxRegisterSize;
-    private ArrayList<Value> objectValues;
-
-    private final TargetDescription target;
-
-    public HotSpotReferenceMap(TargetDescription target) {
-        this.target = target;
-        this.objects = Value.NO_VALUES;
-    }
-
-    @Override
-    public void reset() {
-        objectValues = new ArrayList<>();
-        objects = Value.NO_VALUES;
-        bytesPerElement = null;
-        maxRegisterSize = 0;
-    }
-
-    @Override
-    public void addLiveValue(Value v) {
-        if (isConstant(v)) {
-            return;
-        }
-        LIRKind lirKind = v.getLIRKind();
-        if (!lirKind.isValue()) {
-            objectValues.add(v);
-        }
-        if (isRegister(v)) {
-            int size = target.getSizeInBytes(lirKind.getPlatformKind());
-            if (size > maxRegisterSize) {
-                maxRegisterSize = size;
-            }
-        }
-    }
-
-    @Override
-    public void finish() {
-        objects = objectValues.toArray(new Value[objectValues.size()]);
-        this.bytesPerElement = new int[objects.length];
-        for (int i = 0; i < objects.length; i++) {
-            bytesPerElement[i] = bytesPerElement(objects[i].getLIRKind());
-        }
-        objectValues = null;
-    }
-
-    private int bytesPerElement(LIRKind kind) {
-        PlatformKind platformKind = kind.getPlatformKind();
-        return target.getSizeInBytes(platformKind) / platformKind.getVectorLength();
-    }
-
-    @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 (Arrays.equals(objects, that.objects) && this.target.equals(that.target)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return Arrays.toString(objects);
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaField.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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.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();
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaFieldImpl.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,289 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethod.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +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.jvmci.hotspot;
-
-import java.lang.reflect.*;
-
-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);
-
-    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);
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,750 +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.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.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(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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaType.java	Tue Jun 09 18:48:06 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.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();
-    }
-
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedObjectType.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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.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);
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,902 +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.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());
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedPrimitiveType.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,280 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSignature.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSpeculationLog.java	Tue Jun 09 18:48:06 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.jvmci.hotspot;
-
-import com.oracle.jvmci.meta.*;
-
-public class HotSpotSpeculationLog extends SpeculationLog {
-
-    @Override
-    public JavaConstant speculate(Object reason) {
-        addSpeculation(reason);
-        return HotSpotObjectConstantImpl.forObject(reason);
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotStackFrameReference.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +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.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) + "]";
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotTargetDescription.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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.jvmci.hotspot;
-
-import com.oracle.jvmci.code.*;
-
-public class HotSpotTargetDescription extends TargetDescription {
-
-    public HotSpotTargetDescription(Architecture arch, boolean isMP, int stackAlignment, int implicitNullCheckLimit, boolean inlineObjects) {
-        super(arch, isMP, stackAlignment, implicitNullCheckLimit, inlineObjects);
-    }
-
-    @Override
-    public ReferenceMap createReferenceMap(boolean hasRegisters, int stackSlotCount) {
-        return new HotSpotReferenceMap(this);
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotUnresolvedField.java	Tue Jun 09 18:48:06 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.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>");
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotUnresolvedJavaType.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMConfig.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1663 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMConfigVerifier.java	Tue Jun 09 18:48:06 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.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;
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMEventListener.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +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.jvmci.hotspot;
-
-import com.oracle.jvmci.service.*;
-
-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.
-     *
-     * @param metaspaceMethod
-     * @param entryBCI
-     * @param jvmciEnv
-     * @param id
-     */
-    default void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long jvmciEnv, int id) {
-    }
-
-    /**
-     * Notifies this client that HotSpot is running in CompileTheWorld mode and the JVMCI compiler
-     * should now perform its version of CompileTheWorld.
-     */
-    default void notifyCompileTheWorld() throws Throwable {
-    }
-
-    /**
-     * Notifies this client that the VM is shutting down.
-     */
-    default void notifyShutdown() {
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVmSymbols.java	Tue Jun 09 18:48:06 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.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));
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/InitTimer.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +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.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;
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/PrintStreamOption.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/Stable.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package 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 {
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/events/EmptyEventProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +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.jvmci.hotspot.events;
-
-import com.oracle.jvmci.common.*;
-
-/**
- * An empty implementation for {@link EventProvider}. This implementation is used when no logging is
- * requested.
- */
-public final class EmptyEventProvider implements EventProvider {
-
-    public CompilationEvent newCompilationEvent() {
-        return new EmptyCompilationEvent();
-    }
-
-    public static class EmptyCompilationEvent implements CompilationEvent {
-        public void commit() {
-            throw JVMCIError.shouldNotReachHere();
-        }
-
-        public boolean shouldWrite() {
-            // Events of this class should never been written.
-            return false;
-        }
-
-        public void begin() {
-        }
-
-        public void end() {
-        }
-
-        public void setMethod(String method) {
-            throw JVMCIError.shouldNotReachHere();
-        }
-
-        public void setCompileId(int compileId) {
-            throw JVMCIError.shouldNotReachHere();
-        }
-
-        public void setCompileLevel(int compileLevel) {
-            throw JVMCIError.shouldNotReachHere();
-        }
-
-        public void setSucceeded(boolean succeeded) {
-            throw JVMCIError.shouldNotReachHere();
-        }
-
-        public void setIsOsr(boolean isOsr) {
-            throw JVMCIError.shouldNotReachHere();
-        }
-
-        public void setCodeSize(int codeSize) {
-            throw JVMCIError.shouldNotReachHere();
-        }
-
-        public void setInlinedBytes(int inlinedBytes) {
-            throw JVMCIError.shouldNotReachHere();
-        }
-    }
-
-    public CompilerFailureEvent newCompilerFailureEvent() {
-        return new EmptyCompilerFailureEvent();
-    }
-
-    public static class EmptyCompilerFailureEvent implements CompilerFailureEvent {
-        public void commit() {
-            throw JVMCIError.shouldNotReachHere();
-        }
-
-        public boolean shouldWrite() {
-            // Events of this class should never been written.
-            return false;
-        }
-
-        public void setCompileId(int compileId) {
-            throw JVMCIError.shouldNotReachHere();
-        }
-
-        public void setMessage(String message) {
-            throw JVMCIError.shouldNotReachHere();
-        }
-    }
-
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/events/EventProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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.jvmci.hotspot.events;
-
-import com.oracle.jvmci.service.*;
-
-/**
- * A provider that provides a specific implementation for events that can be logged in the compiler.
- */
-public interface EventProvider extends Service {
-
-    /**
-     * An instant event is an event that is not considered to have taken any time.
-     */
-    interface InstantEvent {
-        /**
-         * Commits the event.
-         */
-        void commit();
-
-        /**
-         * Determines if this particular event instance would be committed to the data stream right
-         * now if application called {@link #commit()}. This in turn depends on whether the event is
-         * enabled and possible other factors.
-         *
-         * @return if this event would be committed on a call to {@link #commit()}.
-         */
-        boolean shouldWrite();
-    }
-
-    /**
-     * Timed events describe an operation that somehow consumes time.
-     */
-    interface TimedEvent extends InstantEvent {
-        /**
-         * Starts the timing for this event.
-         */
-        void begin();
-
-        /**
-         * Ends the timing period for this event.
-         */
-        void end();
-    }
-
-    /**
-     * Creates a new {@link CompilationEvent}.
-     *
-     * @return a compilation event
-     */
-    CompilationEvent newCompilationEvent();
-
-    /**
-     * A compilation event.
-     */
-    interface CompilationEvent extends TimedEvent {
-        void setMethod(String method);
-
-        void setCompileId(int compileId);
-
-        void setCompileLevel(int compileLevel);
-
-        void setSucceeded(boolean succeeded);
-
-        void setIsOsr(boolean isOsr);
-
-        void setCodeSize(int codeSize);
-
-        void setInlinedBytes(int inlinedBytes);
-    }
-
-    /**
-     * Creates a new {@link CompilerFailureEvent}.
-     *
-     * @return a compiler failure event
-     */
-    CompilerFailureEvent newCompilerFailureEvent();
-
-    /**
-     * A compiler failure event.
-     */
-    interface CompilerFailureEvent extends InstantEvent {
-        void setCompileId(int compileId);
-
-        void setMessage(String message);
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/CountingProxy.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/Logger.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/LoggingProxy.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/ProxyUtil.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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.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);
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/package-info.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +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.
- */
-/**
- * Logging framework for the HotSpot CRI implementation.
- */
-package com.oracle.jvmci.hotspot.logging;
-
--- a/graal/com.oracle.jvmci.hotspotvmconfig.processor/src/META-INF/services/javax.annotation.processing.Processor	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.oracle.jvmci.hotspotvmconfig.processor.HotSpotVMConfigProcessor
--- a/graal/com.oracle.jvmci.hotspotvmconfig.processor/src/com/oracle/jvmci/hotspotvmconfig/processor/HotSpotVMConfigProcessor.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,430 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMConstant.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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.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 {};
-}
--- a/graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMField.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +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.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 {};
-}
--- a/graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMFlag.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +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.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;
-}
--- a/graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMType.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMValue.java	Tue Jun 09 18:48:06 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.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 {};
-
-}
--- a/graal/com.oracle.jvmci.meta/overview.html	Tue Jun 09 18:48:06 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.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>
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractJavaProfile.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractProfiledItem.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractValue.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +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.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.
-     */
-    public final boolean identityEquals(AbstractValue other) {
-        return this == other;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AllocatableValue.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Assumptions.java	Tue Jun 09 18:48:06 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.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 + "]";
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Constant.java	Tue Jun 09 18:48:06 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.jvmci.meta;
-
-/**
- * Represents a compile-time constant (boxed) value within the compiler.
- */
-public interface Constant {
-
-    boolean isDefaultForKind();
-
-    String toValueString();
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantPool.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantReflectionProvider.java	Tue Jun 09 18:48:06 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.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 be 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.jvmci.meta/src/com/oracle/jvmci/meta/DefaultProfilingInfo.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DeoptimizationAction.java	Tue Jun 09 18:48:06 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.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;
-    }
-
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DeoptimizationReason.java	Tue Jun 09 18:48:06 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.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,
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ExceptionHandler.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ForeignCallDescriptor.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/InvokeTarget.java	Tue Jun 09 18:48:06 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.jvmci.meta;
-
-/**
- * Represents the resolved target of an invocation.
- */
-public interface InvokeTarget {
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaConstant.java	Tue Jun 09 18:48:06 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.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());
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaField.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaMethod.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaMethodProfile.java	Tue Jun 09 18:48:06 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.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 + "}";
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaType.java	Tue Jun 09 18:48:06 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.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);
-    }
-
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaTypeProfile.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaValue.java	Tue Jun 09 18:48:06 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.jvmci.meta;
-
-/**
- * Interface for things that represent a Java value.
- */
-public interface JavaValue {
-
-    /**
-     * Returns the kind of this value.
-     */
-    Kind getKind();
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Kind.java	Tue Jun 09 18:48:06 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.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);
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/KindProvider.java	Tue Jun 09 18:48:06 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.jvmci.meta;
-
-/**
- * Interface for classes which can be associated with a Kind.
- */
-public interface KindProvider {
-
-    Kind getKind();
-
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LIRKind.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LineNumberTable.java	Tue Jun 09 18:48:06 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.jvmci.meta;
-
-public interface LineNumberTable {
-
-    int[] getLineNumberEntries();
-
-    int[] getBciEntries();
-
-    int getLineNumber(int bci);
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LineNumberTableImpl.java	Tue Jun 09 18:48:06 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.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];
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Local.java	Tue Jun 09 18:48:06 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.jvmci.meta;
-
-public interface Local {
-
-    int getStartBCI();
-
-    int getEndBCI();
-
-    int getSlot();
-
-    String getName();
-
-    JavaType getType();
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalImpl.java	Tue Jun 09 18:48:06 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.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 + ">";
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalVariableTable.java	Tue Jun 09 18:48:06 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.jvmci.meta;
-
-public interface LocalVariableTable {
-
-    Local[] getLocals();
-
-    Local[] getLocalsAt(int bci);
-
-    Local getLocal(int slot, int bci);
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalVariableTableImpl.java	Tue Jun 09 18:48:06 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.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()]);
-    }
-
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocationIdentity.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MemoryAccessProvider.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MetaAccessProvider.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MetaUtil.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodHandleAccessProvider.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodIdHolder.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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.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);
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodIdMap.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ModifiersProvider.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/NamedLocationIdentity.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/NullConstant.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/PlatformKind.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/PrimitiveConstant.java	Tue Jun 09 18:48:06 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.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) + "]";
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ProfilingInfo.java	Tue Jun 09 18:48:06 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.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());
-    }
-
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/RawConstant.java	Tue Jun 09 18:48:06 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.jvmci.meta;
-
-public class RawConstant extends PrimitiveConstant {
-
-    public RawConstant(long rawValue) {
-        super(Kind.Int, rawValue);
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaField.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaMethod.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,316 +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.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.
-     */
-    default ProfilingInfo getProfilingInfo() {
-        return getProfilingInfo(true, true);
-    }
-
-    /**
-     * Returns an object that provides access to the profiling information recorded for this method.
-     *
-     * @param includeNormal if true,
-     *            {@linkplain ProfilingInfo#getDeoptimizationCount(DeoptimizationReason)
-     *            deoptimization counts} will include deoptimization that happened during execution
-     *            of standard non-osr methods.
-     * @param includeOSR if true,
-     *            {@linkplain ProfilingInfo#getDeoptimizationCount(DeoptimizationReason)
-     *            deoptimization counts} will include deoptimization that happened during execution
-     *            of on-stack-replacement methods.
-     */
-    ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR);
-
-    /**
-     * 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>");
-    }
-
-    SpeculationLog getSpeculationLog();
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaType.java	Tue Jun 09 18:48:06 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.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();
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/SerializableConstant.java	Tue Jun 09 18:48:06 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.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);
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Signature.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/SpeculationLog.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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.jvmci.meta;
-
-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);
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/TriState.java	Tue Jun 09 18:48:06 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.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");
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/TrustedInterface.java	Tue Jun 09 18:48:06 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.jvmci.meta;
-
-/**
- * Interfaces extanding this interface should be trusted by the compiler. See
- * {@link ResolvedJavaType#isTrustedInterfaceType()}.
- *
- */
-public interface TrustedInterface {
-
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/VMConstant.java	Tue Jun 09 18:48:06 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.jvmci.meta;
-
-public interface VMConstant extends Constant {
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Value.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +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.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 {
-
-    Value[] NO_VALUES = new Value[0];
-
-    AllocatableValue ILLEGAL = new IllegalValue();
-
-    public final class IllegalValue extends AllocatableValue {
-        private IllegalValue() {
-            super(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 instanceof IllegalValue;
-        }
-    }
-
-    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.
-     */
-    default boolean identityEquals(Value other) {
-        return this == other;
-    }
-}
--- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/package-info.java	Tue Jun 09 18:48:06 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.jvmci.meta.MetaAccessProvider} interface.
- */
-package com.oracle.jvmci.meta;
-
--- a/graal/com.oracle.jvmci.options.processor/src/META-INF/services/javax.annotation.processing.Processor	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.oracle.jvmci.options.processor.OptionProcessor
--- a/graal/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/GraalJars.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/OptionProcessor.java	Tue Jun 09 18:48:06 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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/OptionsVerifier.java	Tue Jun 09 18:48:06 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.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;
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.options.test/src/com/oracle/jvmci/options/test/NestedBooleanOptionValueTest.java	Tue Jun 09 18:48:06 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.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());
-    }
-
-}
--- a/graal/com.oracle.jvmci.options.test/src/com/oracle/jvmci/options/test/TestOptionValue.java	Tue Jun 09 18:48:06 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.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));
-            }
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/DerivedOptionValue.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/NestedBooleanOptionValue.java	Tue Jun 09 18:48:06 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.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;
-    }
-
-}
--- a/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/Option.java	Tue Jun 09 18:48:06 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.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;
-}
--- a/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionDescriptor.java	Tue Jun 09 18:48:06 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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionType.java	Tue Jun 09 18:48:06 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.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
-}
--- a/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionUtils.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionValue.java	Tue Jun 09 18:48:06 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.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);
-                    }
-                }
-            });
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/Options.java	Tue Jun 09 18:48:06 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.jvmci.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.jvmci.options/src/com/oracle/jvmci/options/OptionsLoader.java	Tue Jun 09 18:48:06 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.jvmci.options;
-
-import java.util.*;
-
-import com.oracle.jvmci.service.*;
-
-/**
- * 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.jvmci.options/src/com/oracle/jvmci/options/StableOptionValue.java	Tue Jun 09 18:48:06 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.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);
-    }
-}
--- a/graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/ConstantTest.java	Tue Jun 09 18:48:06 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.jvmci.runtime.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);
-    }
-}
--- a/graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/FieldUniverse.java	Tue Jun 09 18:48:06 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.jvmci.runtime.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 static final Map<Field, ResolvedJavaField> fields = new HashMap<>();
-
-    {
-        for (Class<?> c : classes) {
-            for (Field f : c.getDeclaredFields()) {
-                ResolvedJavaField field = metaAccess.lookupJavaField(f);
-                fields.put(f, field);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/MethodUniverse.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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.jvmci.runtime.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 static final Map<Method, ResolvedJavaMethod> methods = new HashMap<>();
-    public static final Map<Constructor<?>, ResolvedJavaMethod> constructors = new HashMap<>();
-
-    {
-        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.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/NameAndSignature.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +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.jvmci.runtime.test;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.jvmci.meta.*;
-import com.oracle.jvmci.runtime.*;
-
-class NameAndSignature {
-
-    public static final MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().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.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +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.jvmci.runtime.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.*;
-
-import com.oracle.jvmci.meta.*;
-import com.oracle.jvmci.runtime.*;
-
-public class ResolvedJavaTypeResolveConcreteMethodTest {
-    public final MetaAccessProvider metaAccess;
-
-    public ResolvedJavaTypeResolveConcreteMethodTest() {
-        metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().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.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/ResolvedJavaTypeResolveMethodTest.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +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.jvmci.runtime.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.*;
-
-import com.oracle.jvmci.meta.*;
-import com.oracle.jvmci.runtime.*;
-
-public class ResolvedJavaTypeResolveMethodTest {
-    public final MetaAccessProvider metaAccess;
-
-    public ResolvedJavaTypeResolveMethodTest() {
-        metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().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.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestConstantReflectionProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +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.jvmci.runtime.test;
-
-import static org.junit.Assert.*;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-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 (ConstantValue c1 : constants()) {
-            for (ConstantValue c2 : constants()) {
-                // test symmetry
-                assertEquals(constantReflection.constantEquals(c1.value, c2.value), constantReflection.constantEquals(c2.value, c1.value));
-                if (c1.value.getKind() != Kind.Object && c2.value.getKind() != Kind.Object) {
-                    assertEquals(c1.value.equals(c2.value), constantReflection.constantEquals(c2.value, c1.value));
-                }
-            }
-        }
-    }
-
-    @Test
-    public void readArrayLengthTest() {
-        for (ConstantValue cv : constants()) {
-            JavaConstant c = cv.value;
-            Integer actual = constantReflection.readArrayLength(c);
-            if (c.getKind() != Kind.Object || c.isNull() || !cv.boxed.getClass().isArray()) {
-                assertNull(actual);
-            } else {
-                assertNotNull(actual);
-                int actualInt = actual;
-                assertEquals(Array.getLength(cv.boxed), actualInt);
-            }
-        }
-    }
-
-    static class PrimitiveConstants {
-        static final long LONG_CONST = 42;
-        static final int INT_CONST = 66;
-        static final byte BYTE_CONST = 123;
-        static final boolean BOOL_CONST = true;
-    }
-
-    static class BoxedConstants {
-        static final Long LONG_CONST = 42L;
-        static final Integer INT_CONST = 66;
-        static final Byte BYTE_CONST = 123;
-        static final Boolean BOOL_CONST = true;
-    }
-
-    @Test
-    public void boxTest() {
-        for (ConstantValue cv : constants()) {
-            JavaConstant c = cv.value;
-            JavaConstant boxed = constantReflection.boxPrimitive(c);
-            if (boxed != null && c.getKind().isPrimitive()) {
-                assertTrue(boxed.getKind().isObject());
-                assertFalse(boxed.isNull());
-            }
-        }
-
-        List<ConstantValue> primitiveConstants = readConstants(PrimitiveConstants.class);
-        List<ConstantValue> boxedConstants = readConstants(BoxedConstants.class);
-        for (int i = 0; i < primitiveConstants.size(); i++) {
-            ConstantValue prim = primitiveConstants.get(i);
-            ConstantValue box = boxedConstants.get(i);
-            assertEquals(box.value, constantReflection.boxPrimitive(prim.value));
-        }
-
-        assertNull(constantReflection.boxPrimitive(JavaConstant.NULL_POINTER));
-    }
-
-    @Test
-    public void unboxTest() {
-        for (ConstantValue cv : constants()) {
-            JavaConstant c = cv.value;
-            JavaConstant unboxed = c.isNull() ? null : constantReflection.unboxPrimitive(c);
-            if (unboxed != null) {
-                assertFalse(unboxed.getKind().isObject());
-            }
-        }
-        List<ConstantValue> primitiveConstants = readConstants(PrimitiveConstants.class);
-        List<ConstantValue> boxedConstants = readConstants(BoxedConstants.class);
-        for (int i = 0; i < primitiveConstants.size(); i++) {
-            ConstantValue prim = primitiveConstants.get(i);
-            ConstantValue box = boxedConstants.get(i);
-            assert prim.getSimpleName().equals(box.getSimpleName());
-            assertEquals(prim.value, constantReflection.unboxPrimitive(box.value));
-        }
-
-        assertNull(constantReflection.unboxPrimitive(JavaConstant.NULL_POINTER));
-    }
-}
--- a/graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestJavaField.java	Tue Jun 09 18:48:06 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.jvmci.runtime.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)));
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestJavaMethod.java	Tue Jun 09 18:48:06 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.jvmci.runtime.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()));
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestJavaType.java	Tue Jun 09 18:48:06 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.jvmci.runtime.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);
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestMetaAccessProvider.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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.jvmci.runtime.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 (ConstantValue cv : constants()) {
-            JavaConstant c = cv.value;
-            if (c.getKind() == Kind.Object && !c.isNull()) {
-                Object o = cv.boxed;
-                ResolvedJavaType type = metaAccess.lookupJavaType(c);
-                assertNotNull(type);
-                assertTrue(type.equals(metaAccess.lookupJavaType(o.getClass())));
-            } else {
-                assertEquals(metaAccess.lookupJavaType(c), null);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestResolvedJavaField.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +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.jvmci.runtime.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);
-        }
-    }
-
-    static class ReadConstantValueTestConstants {
-        String stringField = "field";
-        final String constantStringField = "constantField";
-
-        static final Object CONST1 = new ReadConstantValueTestConstants();
-        static final Object CONST2 = null;
-        static final Object CONST3 = new String();
-    }
-
-    @Test
-    public void readConstantValueTest() throws NoSuchFieldException {
-        ResolvedJavaField field = metaAccess.lookupJavaField(ReadConstantValueTestConstants.class.getDeclaredField("stringField"));
-        List<ConstantValue> receiverConstants = readConstants(ReadConstantValueTestConstants.class);
-        for (ConstantValue receiver : receiverConstants) {
-            JavaConstant value = constantReflection.readConstantFieldValue(field, receiver.value);
-            assertNull(value);
-        }
-
-        ResolvedJavaField constField = metaAccess.lookupJavaField(ReadConstantValueTestConstants.class.getDeclaredField("constantStringField"));
-        for (ConstantValue receiver : receiverConstants) {
-            JavaConstant value = constantReflection.readConstantFieldValue(constField, receiver.value);
-            if (value != null) {
-                Object expected = "constantField";
-                String actual = ((ReadConstantValueTestConstants) receiver.boxed).constantStringField;
-                assertTrue(actual + " != " + expected, actual == expected);
-            }
-        }
-    }
-
-    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.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestResolvedJavaMethod.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,381 +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.jvmci.runtime.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",
-        "getSpeculationLog",
-        "$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.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestResolvedJavaType.java	Tue Jun 09 18:48:06 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.jvmci.runtime.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.jvmci.common.*;
-import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
-import com.oracle.jvmci.meta.*;
-
-/**
- * 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 (ConstantValue cv : constants()) {
-            JavaConstant c = cv.value;
-            if (c.getKind() == Kind.Object && !c.isNull()) {
-                ResolvedJavaType cType = metaAccess.lookupJavaType(c);
-                for (ResolvedJavaType t : javaTypes) {
-                    if (t.isAssignableFrom(cType)) {
-                        assertTrue(t.isInstance(c));
-                    } else {
-                        assertFalse(t.isInstance(c));
-                    }
-                }
-            }
-        }
-    }
-
-    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 static 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.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TypeUniverse.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +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.jvmci.runtime.test;
-
-import static java.lang.reflect.Modifier.*;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.Queue;
-import java.util.stream.*;
-
-import org.junit.*;
-
-import sun.misc.*;
-
-import com.oracle.jvmci.meta.*;
-import com.oracle.jvmci.runtime.*;
-
-//JaCoCo Exclude
-
-/**
- * Context for type related tests.
- */
-public class TypeUniverse {
-
-    public static final Unsafe unsafe;
-    public static final double JAVA_VERSION = Double.valueOf(System.getProperty("java.specification.version"));
-
-    public static final MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
-    public static final ConstantReflectionProvider constantReflection = JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection();
-    public static final Collection<Class<?>> classes = new HashSet<>();
-    public static final Set<ResolvedJavaType> javaTypes;
-    public static final Map<Class<?>, Class<?>> arrayClasses = new HashMap<>();
-
-    private static List<ConstantValue> constants;
-
-    static {
-        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);
-        }
-
-        javaTypes = Collections.unmodifiableSet(classes.stream().map(c -> metaAccess.lookupJavaType(c)).collect(Collectors.toSet()));
-    }
-
-    static class ConstantsUniverse {
-        static final Object[] ARRAYS = classes.stream().map(c -> c != void.class && !c.isArray() ? Array.newInstance(c, 42) : null).filter(o -> o != null).collect(Collectors.toList()).toArray();
-        static final Object CONST1 = new ArrayList<>();
-        static final Object CONST2 = new ArrayList<>();
-        static final Object CONST3 = new IdentityHashMap<>();
-        static final Object CONST4 = new LinkedHashMap<>();
-        static final Object CONST5 = new TreeMap<>();
-        static final Object CONST6 = new ArrayDeque<>();
-        static final Object CONST7 = new LinkedList<>();
-        static final Object CONST8 = "a string";
-        static final Object CONST9 = 42;
-        static final Object CONST10 = String.class;
-        static final Object CONST11 = String[].class;
-    }
-
-    public static List<ConstantValue> constants() {
-        if (constants == null) {
-            List<ConstantValue> res = readConstants(JavaConstant.class);
-            res.addAll(readConstants(ConstantsUniverse.class));
-            constants = res;
-        }
-        return constants;
-    }
-
-    public static class ConstantValue {
-        public final String name;
-        public final JavaConstant value;
-        public final Object boxed;
-
-        public ConstantValue(String name, JavaConstant value, Object boxed) {
-            this.name = name;
-            this.value = value;
-            this.boxed = boxed;
-        }
-
-        @Override
-        public String toString() {
-            return name + "=" + value;
-        }
-
-        public String getSimpleName() {
-            return name.substring(name.lastIndexOf('.') + 1);
-        }
-    }
-
-    /**
-     * Reads the value of all {@code static final} fields from a given class into an array of
-     * {@link ConstantValue}s.
-     */
-    public static List<ConstantValue> readConstants(Class<?> fromClass) {
-        try {
-            List<ConstantValue> res = new ArrayList<>();
-            for (Field field : fromClass.getDeclaredFields()) {
-                if (isStatic(field.getModifiers()) && isFinal(field.getModifiers())) {
-                    JavaField javaField = metaAccess.lookupJavaField(field);
-                    Object boxed = field.get(null);
-                    if (boxed instanceof JavaConstant) {
-                        res.add(new ConstantValue(javaField.format("%H.%n"), (JavaConstant) boxed, boxed));
-                    } else {
-                        JavaConstant value = constantReflection.readConstantFieldValue(javaField, null);
-                        if (value != null) {
-                            res.add(new ConstantValue(javaField.format("%H.%n"), value, boxed));
-                            if (boxed instanceof Object[]) {
-                                Object[] arr = (Object[]) boxed;
-                                for (int i = 0; i < arr.length; i++) {
-                                    JavaConstant element = constantReflection.readArrayElement(value, i);
-                                    if (element != null) {
-                                        res.add(new ConstantValue(javaField.format("%H.%n[" + i + "]"), element, arr[i]));
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            return res;
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    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 static 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.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCI.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +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.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;
-    }
-}
--- a/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCIBackend.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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.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();
-    }
-}
--- a/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCIRuntime.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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.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);
-}
--- a/graal/com.oracle.jvmci.service.processor/src/META-INF/services/javax.annotation.processing.Processor	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.oracle.jvmci.service.processor.ServiceProviderProcessor
--- a/graal/com.oracle.jvmci.service.processor/src/com/oracle/jvmci/service/processor/ServiceProviderProcessor.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +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.jvmci.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.jvmci.service.*;
-
-@SupportedAnnotationTypes("com.oracle.jvmci.service.ServiceProvider")
-public class ServiceProviderProcessor extends AbstractProcessor {
-
-    private final Set<TypeElement> processed = new HashSet<>();
-    private TypeElement baseJVMCIServiceInterface;
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    private boolean verifyAnnotation(TypeMirror serviceInterface, TypeElement serviceProvider) {
-        if (!processingEnv.getTypeUtils().isSubtype(serviceInterface, baseJVMCIServiceInterface.asType())) {
-            String msg = String.format("Service interface class %s doesn't extend JVMCI service interface %s", serviceInterface, baseJVMCIServiceInterface);
-            processingEnv.getMessager().printMessage(Kind.ERROR, msg, serviceProvider);
-            return false;
-        }
-        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;
-        }
-
-        baseJVMCIServiceInterface = processingEnv.getElementUtils().getTypeElement("com.oracle.jvmci.service.Service");
-
-        for (Element element : roundEnv.getElementsAnnotatedWith(ServiceProvider.class)) {
-            assert element.getKind().isClass();
-            processElement((TypeElement) element);
-        }
-
-        return true;
-    }
-}
--- a/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/JVMCIClassLoaderFactory.java	Tue Jun 09 18:48:06 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.jvmci.service;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * Utility called from the VM to create and register a separate class loader for loading JVMCI
- * classes (i.e., those in found in lib/jvmci/*.jar).
- */
-class JVMCIClassLoaderFactory {
-
-    /**
-     * 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()]);
-    }
-}
--- a/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Service.java	Tue Jun 09 18:48:06 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.jvmci.service;
-
-/**
- * Denotes a service that may be efficiently loaded by {@link Services#load(Class)}.
- */
-public interface Service {
-}
--- a/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/ServiceProvider.java	Tue Jun 09 18:48:06 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.jvmci.service;
-
-import java.lang.annotation.*;
-
-@Retention(RetentionPolicy.CLASS)
-@Target(ElementType.TYPE)
-public @interface ServiceProvider {
-
-    Class<?> value();
-}
--- a/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +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.jvmci.service;
-
-import java.util.*;
-
-import sun.reflect.*;
-
-/**
- * A mechanism on top of the standard {@link ServiceLoader} that enables JVMCI enabled runtime to
- * efficiently load services marked by {@link Service}. This is important to avoid the performance
- * overhead of the standard service loader mechanism for services loaded in the runtime
- * initialization process.
- */
-public class Services {
-
-    /**
-     * Determines whether to suppress the {@link NoClassDefFoundError} raised if a service
-     * implementation class specified in a {@code <jre>/jvmci/services/*} file is missing.
-     */
-    private static final boolean SuppressNoClassDefFoundError = Boolean.getBoolean("jvmci.service.suppressNoClassDefFoundError");
-
-    private static final ClassValue<List<Service>> cache = new ClassValue<List<Service>>() {
-        @Override
-        protected List<Service> computeValue(Class<?> type) {
-            try {
-                return Arrays.asList(getServiceImpls(type));
-            } catch (NoClassDefFoundError e) {
-                if (SuppressNoClassDefFoundError) {
-                    return Collections.emptyList();
-                }
-                throw e;
-            }
-        }
-    };
-
-    /**
-     * Gets an {@link Iterable} of the implementations available for a given service.
-     *
-     * @throws SecurityException if a security manager is present and it denies
-     *             <tt>{@link RuntimePermission}("jvmciServices")</tt>
-     */
-    @SuppressWarnings("unchecked")
-    @CallerSensitive
-    public static <S> Iterable<S> load(Class<S> service) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            sm.checkPermission(new RuntimePermission("jvmciServices"));
-        }
-        if (Service.class.isAssignableFrom(service)) {
-            try {
-                return (Iterable<S>) cache.get(service);
-            } catch (UnsatisfiedLinkError e) {
-                // Fall back to standard ServiceLoader
-            }
-        }
-
-        // Need to use the ClassLoader of the caller
-        ClassLoader cl = Reflection.getCallerClass().getClassLoader();
-        return ServiceLoader.load(service, cl);
-    }
-
-    /**
-     * Gets the implementation for a given service for which at most one implementation must be
-     * available.
-     *
-     * @param service the service whose implementation is being requested
-     * @param required specifies if an {@link InternalError} should be thrown if no implementation
-     *            of {@code service} is available
-     * @throws SecurityException if a security manager is present and it denies
-     *             <tt>{@link RuntimePermission}("jvmciServices")</tt>
-     */
-    @SuppressWarnings("unchecked")
-    @CallerSensitive
-    public static <S> S loadSingle(Class<S> service, boolean required) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            sm.checkPermission(new RuntimePermission("jvmciServices"));
-        }
-        Iterable<S> impls;
-        if (Service.class.isAssignableFrom(service)) {
-            try {
-                impls = (Iterable<S>) cache.get(service);
-            } catch (UnsatisfiedLinkError e) {
-                // Fall back to standard ServiceLoader
-                impls = null;
-            }
-        } else {
-            impls = null;
-        }
-
-        if (impls == null) {
-            // Need to use the ClassLoader of the caller
-            ClassLoader cl = Reflection.getCallerClass().getClassLoader();
-            impls = ServiceLoader.load(service, cl);
-        }
-        S singleImpl = null;
-        for (S impl : impls) {
-            if (singleImpl != null) {
-                throw new InternalError(String.format("Multiple %s implementations found: %s, %s", service.getName(), singleImpl.getClass().getName(), impl.getClass().getName()));
-            }
-            singleImpl = impl;
-        }
-        if (singleImpl == null && required) {
-            String javaHome = System.getProperty("java.home");
-            String vmName = System.getProperty("java.vm.name");
-            Formatter errorMessage = new Formatter();
-            errorMessage.format("The VM does not expose required service %s.%n", service.getName());
-            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 singleImpl;
-    }
-
-    static {
-        Reflection.registerMethodsToFilter(Services.class, "getServiceImpls");
-        Reflection.registerFieldsToFilter(Services.class, "cache");
-    }
-
-    private static native <S> S[] getServiceImpls(Class<?> service);
-}
--- a/graal/com.oracle.jvmci.sparc/src/com/oracle/jvmci/sparc/SPARC.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,337 +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.jvmci.sparc;
-
-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.jvmci.code.Register.RegisterCategory;
-
-/**
- * Represents the SPARC architecture.
- */
-public class SPARC extends Architecture {
-
-    public static final RegisterCategory CPU = new RegisterCategory("CPU");
-
-    // General purpose registers
-    public static final Register r0 = new Register(0, 0, "g0", CPU);
-    public static final Register r1 = new Register(1, 1, "g1", CPU);
-    public static final Register r2 = new Register(2, 2, "g2", CPU);
-    public static final Register r3 = new Register(3, 3, "g3", CPU);
-    public static final Register r4 = new Register(4, 4, "g4", CPU);
-    public static final Register r5 = new Register(5, 5, "g5", CPU);
-    public static final Register r6 = new Register(6, 6, "g6", CPU);
-    public static final Register r7 = new Register(7, 7, "g7", CPU);
-
-    public static final Register r8 = new Register(8, 8, "o0", CPU);
-    public static final Register r9 = new Register(9, 9, "o1", CPU);
-    public static final Register r10 = new Register(10, 10, "o2", CPU);
-    public static final Register r11 = new Register(11, 11, "o3", CPU);
-    public static final Register r12 = new Register(12, 12, "o4", CPU);
-    public static final Register r13 = new Register(13, 13, "o5", CPU);
-    public static final Register r14 = new Register(14, 14, "o6", CPU);
-    public static final Register r15 = new Register(15, 15, "o7", CPU);
-
-    public static final Register r16 = new Register(16, 16, "l0", CPU);
-    public static final Register r17 = new Register(17, 17, "l1", CPU);
-    public static final Register r18 = new Register(18, 18, "l2", CPU);
-    public static final Register r19 = new Register(19, 19, "l3", CPU);
-    public static final Register r20 = new Register(20, 20, "l4", CPU);
-    public static final Register r21 = new Register(21, 21, "l5", CPU);
-    public static final Register r22 = new Register(22, 22, "l6", CPU);
-    public static final Register r23 = new Register(23, 23, "l7", CPU);
-
-    public static final Register r24 = new Register(24, 24, "i0", CPU);
-    public static final Register r25 = new Register(25, 25, "i1", CPU);
-    public static final Register r26 = new Register(26, 26, "i2", CPU);
-    public static final Register r27 = new Register(27, 27, "i3", CPU);
-    public static final Register r28 = new Register(28, 28, "i4", CPU);
-    public static final Register r29 = new Register(29, 29, "i5", CPU);
-    public static final Register r30 = new Register(30, 30, "i6", CPU);
-    public static final Register r31 = new Register(31, 31, "i7", CPU);
-
-    public static final Register g0 = r0;
-    public static final Register g1 = r1;
-    public static final Register g2 = r2;
-    public static final Register g3 = r3;
-    public static final Register g4 = r4;
-    public static final Register g5 = r5;
-    public static final Register g6 = r6;
-    public static final Register g7 = r7;
-
-    public static final Register o0 = r8;
-    public static final Register o1 = r9;
-    public static final Register o2 = r10;
-    public static final Register o3 = r11;
-    public static final Register o4 = r12;
-    public static final Register o5 = r13;
-    public static final Register o6 = r14;
-    public static final Register o7 = r15;
-
-    public static final Register l0 = r16;
-    public static final Register l1 = r17;
-    public static final Register l2 = r18;
-    public static final Register l3 = r19;
-    public static final Register l4 = r20;
-    public static final Register l5 = r21;
-    public static final Register l6 = r22;
-    public static final Register l7 = r23;
-
-    public static final Register i0 = r24;
-    public static final Register i1 = r25;
-    public static final Register i2 = r26;
-    public static final Register i3 = r27;
-    public static final Register i4 = r28;
-    public static final Register i5 = r29;
-    public static final Register i6 = r30;
-    public static final Register i7 = r31;
-
-    public static final Register sp = o6;
-    public static final Register fp = i6;
-
-    // @formatter:off
-    public static final Register[] cpuRegisters = {
-        r0,  r1,  r2,  r3,  r4,  r5,  r6,  r7,
-        r8,  r9,  r10, r11, r12, r13, r14, r15,
-        r16, r17, r18, r19, r20, r21, r22, r23,
-        r24, r25, r26, r27, r28, r29, r30, r31
-    };
-    // @formatter:on
-
-    public static final RegisterCategory FPUs = new RegisterCategory("FPUs", cpuRegisters.length);
-    public static final RegisterCategory FPUd = new RegisterCategory("FPUd", cpuRegisters.length + 32);
-
-    // Floating point registers
-    public static final Register f0 = new Register(32, 0, "f0", FPUs);
-    public static final Register f1 = new Register(33, 1, "f1", FPUs);
-    public static final Register f2 = new Register(34, 2, "f2", FPUs);
-    public static final Register f3 = new Register(35, 3, "f3", FPUs);
-    public static final Register f4 = new Register(36, 4, "f4", FPUs);
-    public static final Register f5 = new Register(37, 5, "f5", FPUs);
-    public static final Register f6 = new Register(38, 6, "f6", FPUs);
-    public static final Register f7 = new Register(39, 7, "f7", FPUs);
-
-    public static final Register f8 = new Register(40, 8, "f8", FPUs);
-    public static final Register f9 = new Register(41, 9, "f9", FPUs);
-    public static final Register f10 = new Register(42, 10, "f10", FPUs);
-    public static final Register f11 = new Register(43, 11, "f11", FPUs);
-    public static final Register f12 = new Register(44, 12, "f12", FPUs);
-    public static final Register f13 = new Register(45, 13, "f13", FPUs);
-    public static final Register f14 = new Register(46, 14, "f14", FPUs);
-    public static final Register f15 = new Register(47, 15, "f15", FPUs);
-
-    public static final Register f16 = new Register(48, 16, "f16", FPUs);
-    public static final Register f17 = new Register(49, 17, "f17", FPUs);
-    public static final Register f18 = new Register(50, 18, "f18", FPUs);
-    public static final Register f19 = new Register(51, 19, "f19", FPUs);
-    public static final Register f20 = new Register(52, 20, "f20", FPUs);
-    public static final Register f21 = new Register(53, 21, "f21", FPUs);
-    public static final Register f22 = new Register(54, 22, "f22", FPUs);
-    public static final Register f23 = new Register(55, 23, "f23", FPUs);
-
-    public static final Register f24 = new Register(56, 24, "f24", FPUs);
-    public static final Register f25 = new Register(57, 25, "f25", FPUs);
-    public static final Register f26 = new Register(58, 26, "f26", FPUs);
-    public static final Register f27 = new Register(59, 27, "f27", FPUs);
-    public static final Register f28 = new Register(60, 28, "f28", FPUs);
-    public static final Register f29 = new Register(61, 29, "f29", FPUs);
-    public static final Register f30 = new Register(62, 30, "f30", FPUs);
-    public static final Register f31 = new Register(63, 31, "f31", FPUs);
-
-    public static final Register d0 = new Register(32, getDoubleEncoding(0), "d0", FPUs);
-    public static final Register d2 = new Register(34, getDoubleEncoding(2), "d2", FPUs);
-    public static final Register d4 = new Register(36, getDoubleEncoding(4), "d4", FPUs);
-    public static final Register d6 = new Register(38, getDoubleEncoding(6), "d6", FPUs);
-    public static final Register d8 = new Register(40, getDoubleEncoding(8), "d8", FPUs);
-    public static final Register d10 = new Register(42, getDoubleEncoding(10), "d10", FPUs);
-    public static final Register d12 = new Register(44, getDoubleEncoding(12), "d12", FPUs);
-    public static final Register d14 = new Register(46, getDoubleEncoding(14), "d14", FPUs);
-
-    public static final Register d16 = new Register(48, getDoubleEncoding(16), "d16", FPUs);
-    public static final Register d18 = new Register(50, getDoubleEncoding(18), "d18", FPUs);
-    public static final Register d20 = new Register(52, getDoubleEncoding(20), "d20", FPUs);
-    public static final Register d22 = new Register(54, getDoubleEncoding(22), "d22", FPUs);
-    public static final Register d24 = new Register(56, getDoubleEncoding(24), "d24", FPUs);
-    public static final Register d26 = new Register(58, getDoubleEncoding(26), "d26", FPUs);
-    public static final Register d28 = new Register(60, getDoubleEncoding(28), "d28", FPUs);
-    public static final Register d30 = new Register(62, getDoubleEncoding(28), "d28", FPUs);
-
-    public static final Register d32 = new Register(64, getDoubleEncoding(32), "d32", FPUd);
-    public static final Register d34 = new Register(65, getDoubleEncoding(34), "d34", FPUd);
-    public static final Register d36 = new Register(66, getDoubleEncoding(36), "d36", FPUd);
-    public static final Register d38 = new Register(67, getDoubleEncoding(38), "d38", FPUd);
-    public static final Register d40 = new Register(68, getDoubleEncoding(40), "d40", FPUd);
-    public static final Register d42 = new Register(69, getDoubleEncoding(42), "d42", FPUd);
-    public static final Register d44 = new Register(70, getDoubleEncoding(44), "d44", FPUd);
-    public static final Register d46 = new Register(71, getDoubleEncoding(46), "d46", FPUd);
-
-    public static final Register d48 = new Register(72, getDoubleEncoding(48), "d48", FPUd);
-    public static final Register d50 = new Register(73, getDoubleEncoding(50), "d50", FPUd);
-    public static final Register d52 = new Register(74, getDoubleEncoding(52), "d52", FPUd);
-    public static final Register d54 = new Register(75, getDoubleEncoding(54), "d54", FPUd);
-    public static final Register d56 = new Register(76, getDoubleEncoding(56), "d56", FPUd);
-    public static final Register d58 = new Register(77, getDoubleEncoding(58), "d58", FPUd);
-    public static final Register d60 = new Register(78, getDoubleEncoding(60), "d60", FPUd);
-    public static final Register d62 = new Register(79, getDoubleEncoding(62), "d62", FPUd);
-
-    // @formatter:off
-    public static final Register[] fpuRegisters = {
-        f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
-        f8,  f9,  f10, f11, f12, f13, f14, f15,
-        f16, f17, f18, f19, f20, f21, f22, f23,
-        f24, f25, f26, f27, f28, f29, f30, f31,
-        d32, d34, d36, d38, d40, d42, d44, d46,
-        d48, d50, d52, d54, d56, d58, d60, d62
-    };
-    // @formatter:on
-
-    // @formatter:off
-    public static final Register[] allRegisters = {
-        // CPU
-        r0,  r1,  r2,  r3,  r4,  r5,  r6,  r7,
-        r8,  r9,  r10, r11, r12, r13, r14, r15,
-        r16, r17, r18, r19, r20, r21, r22, r23,
-        r24, r25, r26, r27, r28, r29, r30, r31,
-        // FPU
-        f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
-        f8,  f9,  f10, f11, f12, f13, f14, f15,
-        f16, f17, f18, f19, f20, f21, f22, f23,
-        f24, f25, f26, f27, f28, f29, f30, f31,
-        d32, d34, d36, d38, d40, d42, d44, d46,
-        d48, d50, d52, d54, d56, d58, d60, d62
-    };
-    // @formatter:on
-
-    /**
-     * Stack bias for stack and frame pointer loads.
-     */
-    public static final int STACK_BIAS = 0x7ff;
-    /**
-     * In fact there are 64 single floating point registers, 32 of them could be accessed. TODO:
-     * Improve handling of these float registers
-     */
-    public static final int FLOAT_REGISTER_COUNT = 64;
-
-    /**
-     * Alignment for valid memory access.
-     */
-    public static final int MEMORY_ACCESS_ALIGN = 4;
-
-    public final Set<CPUFeature> features;
-
-    public SPARC(Set<CPUFeature> features) {
-        super("SPARC", 8, ByteOrder.BIG_ENDIAN, false, allRegisters, LOAD_STORE | STORE_STORE, 1, r31.encoding + FLOAT_REGISTER_COUNT + 1, 8);
-        this.features = features;
-    }
-
-    @Override
-    public boolean canStoreValue(RegisterCategory category, PlatformKind lirKind) {
-        if (!(lirKind instanceof Kind)) {
-            return false;
-        }
-
-        Kind kind = (Kind) lirKind;
-        if (category.equals(CPU)) {
-            switch (kind) {
-                case Boolean:
-                case Byte:
-                case Char:
-                case Short:
-                case Int:
-                case Long:
-                case Object:
-                    return true;
-            }
-        } else if (category.equals(FPUs) && kind.equals(Kind.Float)) {
-            return true;
-        } else if (category.equals(FPUd) && kind.equals(Kind.Double)) {
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public PlatformKind getLargestStorableKind(RegisterCategory category) {
-        if (category.equals(CPU)) {
-            return Kind.Long;
-        } else if (category.equals(FPUs)) {
-            return Kind.Double;
-        } else {
-            return Kind.Illegal;
-        }
-    }
-
-    public static int spillSlotSize(TargetDescription td, PlatformKind kind) {
-        return Math.max(td.getSizeInBytes(kind), MEMORY_ACCESS_ALIGN);
-    }
-
-    public static int getDoubleEncoding(int reg) {
-        assert reg < 64 && ((reg & 1) == 0);
-        // ignore v8 assertion for now
-        return (reg & 0x1e) | ((reg & 0x20) >> 5);
-    }
-
-    public static boolean isCPURegister(Register r) {
-        return r.getRegisterCategory().equals(CPU);
-    }
-
-    public static boolean isCPURegister(Register... regs) {
-        for (Register reg : regs) {
-            if (!isCPURegister(reg)) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    public static boolean isSingleFloatRegister(Register r) {
-        return r.name.startsWith("f");
-    }
-
-    public static boolean isDoubleFloatRegister(Register r) {
-        return r.name.startsWith("d");
-    }
-
-    public Set<CPUFeature> getFeatures() {
-        return features;
-    }
-
-    public boolean hasFeature(CPUFeature feature) {
-        return features.contains(feature);
-    }
-
-    public enum CPUFeature {
-        VIS1,
-        VIS2,
-        VIS3,
-        CBCOND
-    }
-}
--- a/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/UnsupportedSpecializationException.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/UnsupportedSpecializationException.java	Tue Jun 09 19:07:39 2015 -0700
@@ -26,6 +26,7 @@
 
 import java.util.*;
 
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.nodes.*;
 
 /**
@@ -40,8 +41,8 @@
     private final Node[] suppliedNodes;
     private final Object[] suppliedValues;
 
+    @TruffleBoundary
     public UnsupportedSpecializationException(Node node, Node[] suppliedNodes, Object... suppliedValues) {
-        super("Unexpected values provided for " + node + ": " + Arrays.toString(suppliedValues));
         Objects.requireNonNull(suppliedNodes, "The suppliedNodes parameter must not be null.");
         if (suppliedNodes.length != suppliedValues.length) {
             throw new IllegalArgumentException("The length of suppliedNodes must match the length of suppliedValues.");
@@ -51,6 +52,11 @@
         this.suppliedValues = suppliedValues;
     }
 
+    @Override
+    public String getMessage() {
+        return String.format("Unexpected values provided for %s: %s", node, Arrays.toString(suppliedValues));
+    }
+
     /**
      * Returns the {@link Node} that caused the this {@link UnsupportedSpecializationException}.
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/META-INF/services/com.oracle.truffle.api.impl.SymbolInvoker	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,1 @@
+com.oracle.truffle.api.interop.impl.SymbolInvokerImpl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/Execute.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,67 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+final class Execute extends KnownMessage {
+    public static final int HASH1 = 423430;
+    public static final int HASH2 = 423429;
+
+    private final int arity;
+    private final boolean invoke;
+
+    public static Execute create(boolean invoke, int arity) {
+        return new Execute(invoke, arity);
+    }
+
+    private Execute(boolean invoke, int arity) {
+        this.invoke = invoke;
+        this.arity = arity;
+    }
+
+    public int getArity() {
+        return arity;
+    }
+
+    @Override
+    public boolean equals(Object message) {
+        if (!(message instanceof Execute)) {
+            return false;
+        }
+        Execute m1 = this;
+        Execute m2 = (Execute) message;
+        return m1.invoke == m2.invoke;
+    }
+
+    @Override
+    public int hashCode() {
+        return invoke ? HASH1 : HASH2;
+    }
+
+    @Override
+    public String toString() {
+        return invoke ? "msgInvoke" : "msgExecute";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/ForeignAccess.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,288 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+import com.oracle.truffle.api.CallTarget;
+import com.oracle.truffle.api.frame.Frame;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.impl.ReadOnlyArrayList;
+import com.oracle.truffle.api.nodes.Node;
+import java.util.List;
+
+/**
+ * Encapsulates types of access to {@link TruffleObject}. If you want to expose your own objects to
+ * foreign language implementations, you need to implement {@link TruffleObject} and its
+ * {@link TruffleObject#getForeignAccess()} method. To create instance of <code>ForeignAccess</code>
+ * , use one of the factory methods available in this class.
+ */
+public final class ForeignAccess {
+    private final Factory factory;
+
+    private ForeignAccess(Factory faf) {
+        this.factory = faf;
+    }
+
+    /**
+     * Creates new instance of {@link ForeignAccess} that delegates to provided factory.
+     *
+     * @param baseClass the super class of all {@link TruffleObject}s handled by this factory (if
+     *            <code>null</code> than the second interface also needs to implement
+     *            {@link Factory})
+     * @param factory the factory that handles access requests to {@link Message}s known as of
+     *            version 1.0
+     * @return new instance wrapping <code>factory</code>
+     */
+    public static ForeignAccess create(final Class<? extends TruffleObject> baseClass, final Factory10 factory) {
+        if (baseClass == null) {
+            Factory f = (Factory) factory;
+            assert f != null;
+        }
+        class DelegatingFactory implements Factory {
+            @Override
+            public boolean canHandle(TruffleObject obj) {
+                if (baseClass == null) {
+                    return ((Factory) factory).canHandle(obj);
+                }
+                return baseClass.isInstance(obj);
+            }
+
+            @Override
+            public CallTarget accessMessage(Message msg) {
+                if (msg instanceof KnownMessage) {
+                    switch (msg.hashCode()) {
+                        case Execute.HASH1:
+                            return factory.accessInvoke(((Execute) msg).getArity());
+                        case Execute.HASH2:
+                            return factory.accessExecute(((Execute) msg).getArity());
+                        case GetSize.HASH:
+                            return factory.accessGetSize();
+                        case HasSize.HASH:
+                            return factory.accessHasSize();
+                        case IsBoxed.HASH:
+                            return factory.accessIsBoxed();
+                        case IsExecutable.HASH:
+                            return factory.accessIsExecutable();
+                        case IsNull.HASH:
+                            return factory.accessIsNull();
+                        case Read.HASH:
+                            return factory.accessRead();
+                        case Unbox.HASH:
+                            return factory.accessUnbox();
+                        case Write.HASH:
+                            return factory.accessWrite();
+                    }
+                }
+                return factory.accessMessage(msg);
+            }
+        }
+        return new ForeignAccess(new DelegatingFactory());
+    }
+
+    /**
+     * Creates new instance of {@link ForeignAccess} that delegates to provided factory.
+     *
+     * @param factory the factory that handles various access requests {@link Message}s.
+     * @return new instance wrapping <code>factory</code>
+     */
+    public static ForeignAccess create(Factory factory) {
+        return new ForeignAccess(factory);
+    }
+
+    /**
+     * Executes {@link Message#createNode() foreign node}.
+     * 
+     * @param foreignNode the createNode created by {@link Message#createNode()}
+     * @param frame the call frame
+     * @param receiver foreign object to receive the message passed to {@link Message#createNode()}
+     *            method
+     * @param arguments parameters for the receiver
+     * @return return value, if any
+     * @throws ClassCastException if the createNode has not been created by
+     *             {@link Message#createNode()} method.
+     */
+    public static Object execute(Node foreignNode, VirtualFrame frame, TruffleObject receiver, Object... arguments) {
+        ForeignObjectAccessHeadNode fn = (ForeignObjectAccessHeadNode) foreignNode;
+        return fn.executeForeign(frame, receiver, arguments);
+    }
+
+    /**
+     * Read only access to foreign call arguments inside of a frame.
+     *
+     * @param frame the frame that was called via
+     *            {@link #execute(com.oracle.truffle.api.nodes.Node, com.oracle.truffle.api.frame.VirtualFrame, com.oracle.truffle.api.interop.TruffleObject, java.lang.Object...) }
+     * @return read-only list of parameters passed to the frame
+     */
+    public static List<Object> getArguments(Frame frame) {
+        final Object[] arr = frame.getArguments();
+        return ReadOnlyArrayList.asList(arr, 1, arr.length);
+    }
+
+    /**
+     * The foreign receiver in the frame.
+     *
+     * @param frame the frame that was called via
+     *            {@link #execute(com.oracle.truffle.api.nodes.Node, com.oracle.truffle.api.frame.VirtualFrame, com.oracle.truffle.api.interop.TruffleObject, java.lang.Object...) }
+     * @return the receiver used when invoking the frame
+     */
+    public static TruffleObject getReceiver(Frame frame) {
+        return (TruffleObject) frame.getArguments()[ForeignAccessArguments.RECEIVER_INDEX];
+    }
+
+    CallTarget access(Message message) {
+        return factory.accessMessage(message);
+    }
+
+    boolean canHandle(TruffleObject receiver) {
+        return factory.canHandle(receiver);
+    }
+
+    /**
+     * Interface of a factory that produces AST snippets that can access a foreign
+     * {@code TruffleObject}. A Truffle language implementation accesses a {@code TruffleObject} via
+     * a {@code Message}. The {@code TruffleObject} instance provides a {@link ForeignAccess}
+     * instance (built via {@link #create(com.oracle.truffle.api.interop.ForeignAccess.Factory)})
+     * that provides an AST snippet for a given {@link Message}. Rather than using this generic
+     * {@code Factory}, consider implementing {@link Factory10} interface that captures the set of
+     * messages each language should implement as of Truffle version 1.0.
+     */
+    public interface Factory {
+
+        /**
+         * * Checks whether provided {@link TruffleObject} can be accessed using AST snippets
+         * produced by this {@link Factory}.
+         *
+         * @param obj the object to check
+         * @return true, if the object can be processed
+         */
+        boolean canHandle(TruffleObject obj);
+
+        /**
+         * Provides an AST snippet to access a {@code TruffleObject}.
+         *
+         * @param tree the {@code Message} that represents the access to a {@code TruffleObject}.
+         * @return the AST snippet for accessing the {@code TruffleObject}, wrapped as a
+         *         {@code CallTarget}.
+         */
+        CallTarget accessMessage(Message tree);
+    }
+
+    /**
+     * Specialized {@link Factory factory} that handles {@link Message messages} known as of release
+     * 1.0 of Truffle API.
+     *
+     */
+    public interface Factory10 {
+        /**
+         * Handles {@link Message#IS_NULL} message.
+         *
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessIsNull();
+
+        /**
+         * Handles {@link Message#IS_EXECUTABLE} message.
+         * 
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessIsExecutable();
+
+        /**
+         * Handles {@link Message#IS_BOXED} message.
+         * 
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessIsBoxed();
+
+        /**
+         * Handles {@link Message#HAS_SIZE} message.
+         * 
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessHasSize();
+
+        /**
+         * Handles {@link Message#GET_SIZE} message.
+         * 
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessGetSize();
+
+        /**
+         * Handles {@link Message#UNBOX} message.
+         * 
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessUnbox();
+
+        /**
+         * Handles {@link Message#READ} message.
+         * 
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessRead();
+
+        /**
+         * Handles {@link Message#WRITE} message.
+         * 
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessWrite();
+
+        /**
+         * Handles {@link Message#createExecute(int)} messages.
+         * 
+         * @param argumentsLength number of parameters the messages has been created for
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessExecute(int argumentsLength);
+
+        /**
+         * Handles {@link Message#createInvoke(int)} messages.
+         * 
+         * @param argumentsLength number of parameters the messages has been created for
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessInvoke(int argumentsLength);
+
+        /**
+         * Handles request for access to a message not known in version 1.0.
+         *
+         * @param unknown the message
+         * @return call target to handle the message or <code>null</code> if this message is not
+         *         supported
+         */
+        CallTarget accessMessage(Message unknown);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/ForeignAccessArguments.java	Tue Jun 09 19:07:39 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+final class ForeignAccessArguments {
+    static final Object[] EMPTY_ARGUMENTS_ARRAY = new Object[0];
+    static final int RECEIVER_INDEX = 0;
+    static final int RUNTIME_ARGUMENT_COUNT = 1;
+
+    static Object[] create(Object receiver, Object... arguments) {
+        if (arguments.length == 0) {
+            return new Object[]{receiver};
+        }
+        Object[] objectArguments = new Object[RUNTIME_ARGUMENT_COUNT + arguments.length];
+        objectArguments[RECEIVER_INDEX] = receiver;
+        arraycopy(arguments, 0, objectArguments, RUNTIME_ARGUMENT_COUNT, arguments.length);
+        return objectArguments;
+    }
+
+    private static void arraycopy(Object[] src, int srcPos, Object[] dest, int destPos, int length) {
+        for (int i = 0; i < length; i++) {
+            dest[destPos + i] = src[srcPos + i];
+        }
+    }
+
+}
--- a/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/ForeignAccessFactory.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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.  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.
- */
-package com.oracle.truffle.api.interop;
-
-import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.interop.messages.*;
-
-/**
- * Interface of a factory that produces AST snippets that can access a foreign {@code TruffleObject}
- * . A Truffle language implementation accesses a {@code TruffleObject} via a {@code Message}. The
- * {@code TruffleObject} instance provides a {@code ForeignAccessFactory} instance that provides an
- * AST snippet for a given {@code Message}.
- */
-public interface ForeignAccessFactory {
-
-    /**
-     * Provides a {@code InteropPredicate} that tests whether a {@code TruffleObject} can be
-     * accessed using AST snippets, produced by this {@code ForeignAccessFactory}.
-     *
-     * @return the {@code InteropPredicate} that tests if a {@code TruffleObject} can be accessed by
-     *         AST snipptes, produces by this {@code ForeignAccessFactory}.
-     */
-    InteropPredicate getLanguageCheck();
-
-    /**
-     * Provides an AST snippet to access a {@code TruffleObject}.
-     *
-     * @param tree the {@code Message} that represents the access to a {@code TruffleObject}.
-     * @return the AST snippet for accessing the {@code TruffleObject}, wrapped as a
-     *         {@code CallTarget}.
-     */
-    CallTarget getAccess(Message tree);
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/ForeignObjectAccessHeadNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,54 @@
+/*
+ * 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.  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.
+ */
+
+package com.oracle.truffle.api.interop;
+
+import com.oracle.truffle.api.frame.*;
+import com.oracle.truffle.api.nodes.Node;
+
+final class ForeignObjectAccessHeadNode extends Node {
+
+    @Child private ObjectAccessNode first;
+    private final Message accessTree;
+
+    protected ForeignObjectAccessHeadNode(Message tree) {
+        this.accessTree = tree;
+        this.first = new UnresolvedObjectAccessNode();
+        adoptChildren();
+    }
+
+    protected Message getAccessTree() {
+        return accessTree;
+    }
+
+    protected ObjectAccessNode getFirst() {
+        return first;
+    }
+
+    public Object executeForeign(VirtualFrame frame, TruffleObject receiver, Object... arguments) {
+        return first.executeWith(frame, receiver, arguments);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/GetSize.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,41 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+final class GetSize extends UnaryMessage {
+    public static final int HASH = 423432;
+
+    static Message INSTANCE = new GetSize();
+
+    @Override
+    public String toString() {
+        return "msgGetSize";
+    }
+
+    @Override
+    public int hashCode() {
+        return HASH;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/HasSize.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+final class HasSize extends UnaryMessage {
+    public static final int HASH = 423433;
+    static Message INSTANCE = new HasSize();
+
+    @Override
+    public int hashCode() {
+        return HASH;
+    }
+
+    @Override
+    public String toString() {
+        return "msgHasSize";
+    }
+}
--- a/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/InteropPredicate.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +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.  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.
- */
-package com.oracle.truffle.api.interop;
-
-/**
- * Represents a predicate of a {@code TruffleObject} argument.
- */
-public interface InteropPredicate {
-
-    /**
-     * Evaluates the predicate on the given {@code TruffleObject}.
-     *
-     * @param object the input argument
-     * @return {@code true} if the {@code TruffleObject} argument matches the predicate, otherwise
-     *         {@code false}
-     */
-    boolean test(TruffleObject object);
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/IsBoxed.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+final class IsBoxed extends UnaryMessage {
+    public static final int HASH = 423434;
+    static Message INSTANCE = new IsBoxed();
+
+    @Override
+    public int hashCode() {
+        return HASH;
+    }
+
+    @Override
+    public String toString() {
+        return "msgIsBoxed";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/IsExecutable.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+final class IsExecutable extends UnaryMessage {
+    public static final int HASH = 423435;
+    static Message INSTANCE = new IsExecutable();
+
+    @Override
+    public int hashCode() {
+        return HASH;
+    }
+
+    @Override
+    public String toString() {
+        return "msgIsExecutable";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/IsNull.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+final class IsNull extends UnaryMessage {
+    public static final int HASH = 423436;
+    static Message INSTANCE = new IsNull();
+
+    @Override
+    public int hashCode() {
+        return HASH;
+    }
+
+    @Override
+    public String toString() {
+        return "msgIsNull";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/KnownMessage.java	Tue Jun 09 19:07:39 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+/**
+ * Marker class.
+ */
+abstract class KnownMessage extends Message {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/Message.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,158 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.interop.ForeignAccess.Factory;
+
+/**
+ * Inter-operability is based on sending messages. Standard messages are defined as as constants
+ * like {@link #IS_NULL} or factory methods in this class, but one can always define their own,
+ * specialized messages.
+ */
+public abstract class Message {
+    /**
+     * Message to read a field.
+     */
+    public static final Message READ = Read.INSTANCE;
+
+    /**
+     * Converts {@link TruffleObject truffle value} to Java primitive type. Primitive types are
+     * subclasses of {@link Number}, {@link Boolean}, {@link Character} and {@link String}. Related
+     * to {@link #IS_BOXED} message.
+     */
+    public static final Message UNBOX = Unbox.INSTANCE;
+
+    /**
+     * Message to write a field.
+     */
+    public static Message WRITE = Write.INSTANCE;
+
+    /**
+     * Creates an execute message. All messages created by this method are
+     * {@link Object#equals(java.lang.Object) equal} to each other regardless of the value of
+     * <code>argumentsLength</code>.
+     *
+     * @param argumentsLength number of parameters to pass to the target
+     * @return execute message
+     */
+    public static Message createExecute(int argumentsLength) {
+        return Execute.create(false, argumentsLength);
+    }
+
+    /**
+     * Message to check for executability.
+     * <p>
+     * Calling {@link Factory#access(com.oracle.truffle.api.interop.Message) the target} created for
+     * this message should yield value of {@link Boolean}.
+     */
+    public static final Message IS_EXECUTABLE = IsExecutable.INSTANCE;
+
+    /**
+     * Creates an execute message. All messages created by this method are
+     * {@link Object#equals(java.lang.Object) equal} to each other regardless of the value of
+     * <code>argumentsLength</code>. The expected behavior of this message is to perform
+     * {@link #READ} first and on the result invoke {@link #createExecute(int)}.
+     *
+     * @param argumentsLength number of parameters to pass to the target
+     * @return read & execute message
+     */
+    public static Message createInvoke(int argumentsLength) {
+        return Execute.create(true, argumentsLength);
+    }
+
+    /**
+     * Check for <code>null</code> message. The Truffle languages are suggested to have their own
+     * object representing <code>null</code> like values in their languages. For purposes of
+     * inter-operability it is essential to canonicalize such values from time to time - sending
+     * this message is a way to recognize such <code>null</code> representing values.
+     * <p>
+     * Calling {@link Factory#access(com.oracle.truffle.api.interop.Message) the target} created for
+     * this message should yield value of {@link Boolean}.
+     */
+    public static final Message IS_NULL = IsNull.INSTANCE;
+
+    /**
+     * Message to check for having a size.
+     * <p>
+     * Calling {@link Factory#access(com.oracle.truffle.api.interop.Message) the target} created for
+     * this message should yield value of {@link Boolean}.
+     */
+    public static final Message HAS_SIZE = HasSize.INSTANCE;
+
+    /**
+     * Getter of the size. If {@link #HAS_SIZE supported}, this message allows to obtain a size (of
+     * an array).
+     * <p>
+     * Calling {@link Factory#access(com.oracle.truffle.api.interop.Message) the target} created for
+     * this message should yield value of {@link Integer}.
+     */
+    public static final Message GET_SIZE = GetSize.INSTANCE;
+
+    /**
+     * Check for value being boxed. Can you value be converted to one of the basic Java types? Many
+     * languages have a special representation for types like number, string, etc. To ensure
+     * inter-operability, these types should support unboxing - if they do, they should handle this
+     * message.
+     * <p>
+     * Calling {@link Factory#accessMessage(com.oracle.truffle.api.interop.Message) the target}
+     * created for this message should yield value of {@link Boolean}.
+     */
+    public static final Message IS_BOXED = IsBoxed.INSTANCE;
+
+    /**
+     * Compares types of two messages. Messages are encouraged to implement this method. All
+     * standard ones ({@link #IS_NULL}, {@link #READ}, etc.) do so. Messages obtained via the same
+     * {@link #createExecute(int) method} are equal, messages obtained by different methods or
+     * fields are not.
+     *
+     * @param message the object to compare to
+     * @return true, if the structure of the message is that same as of <code>this</code> one.
+     */
+    @Override
+    public abstract boolean equals(Object message);
+
+    /**
+     * When re-implementing {@link #equals(java.lang.Object)}, it is generally recommended to also
+     * implement <code>hashCode()</code>.
+     * 
+     * @return hash code
+     */
+    @Override
+    public abstract int hashCode();
+
+    /**
+     * Creates an AST node for this message. The node can be inserted into AST of your language and
+     * will handle communication with the foreign language.
+     *
+     * @return node to be inserted into your AST and passed back to
+     *         {@link ForeignAccess#execute(com.oracle.truffle.api.nodes.Node, com.oracle.truffle.api.frame.VirtualFrame, com.oracle.truffle.api.interop.TruffleObject, java.lang.Object[])}
+     *         method.
+     */
+    public final Node createNode() {
+        return new ForeignObjectAccessHeadNode(this);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/ObjectAccessNode.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,128 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+import com.oracle.truffle.api.*;
+import com.oracle.truffle.api.frame.*;
+import com.oracle.truffle.api.nodes.*;
+
+abstract class ObjectAccessNode extends Node {
+
+    public abstract Object executeWith(VirtualFrame frame, TruffleObject receiver, Object[] arguments);
+
+}
+
+class UnresolvedObjectAccessNode extends ObjectAccessNode {
+
+    private static final int CACHE_SIZE = 8;
+    private int cacheLength = 1;
+
+    @Override
+    public Object executeWith(VirtualFrame frame, TruffleObject receiver, Object[] arguments) {
+        CompilerDirectives.transferToInterpreterAndInvalidate();
+        ForeignObjectAccessHeadNode nthParent = (ForeignObjectAccessHeadNode) NodeUtil.getNthParent(this, cacheLength);
+        ObjectAccessNode first = nthParent.getFirst();
+        if (cacheLength < CACHE_SIZE) {
+            cacheLength++;
+            CachedObjectAccessNode createCachedAccess = createCachedAccess(receiver, nthParent.getAccessTree(), first);
+            return first.replace(createCachedAccess).executeWith(frame, receiver, arguments);
+        } else {
+            return first.replace(createGenericAccess(nthParent.getAccessTree())).executeWith(frame, receiver, arguments);
+        }
+    }
+
+    private static CachedObjectAccessNode createCachedAccess(TruffleObject receiver, Message accessTree, ObjectAccessNode next) {
+        ForeignAccess fa = receiver.getForeignAccess();
+        final CallTarget ct = fa.access(accessTree);
+        if (ct == null) {
+            throw new IllegalArgumentException("Message " + accessTree + " not recognized by " + fa);
+        }
+        return new CachedObjectAccessNode(Truffle.getRuntime().createDirectCallNode(ct), next, fa);
+    }
+
+    private static GenericObjectAccessNode createGenericAccess(Message access) {
+        return new GenericObjectAccessNode(access);
+    }
+}
+
+class GenericObjectAccessNode extends ObjectAccessNode {
+
+    private final Message access;
+    @Child private IndirectCallNode indirectCallNode;
+
+    public GenericObjectAccessNode(Message access) {
+        this.access = access;
+        indirectCallNode = Truffle.getRuntime().createIndirectCallNode();
+    }
+
+    public GenericObjectAccessNode(GenericObjectAccessNode prev) {
+        this(prev.access);
+    }
+
+    @Override
+    public Object executeWith(VirtualFrame frame, TruffleObject truffleObject, Object[] arguments) {
+        final ForeignAccess fa = truffleObject.getForeignAccess();
+        final CallTarget ct = fa.access(access);
+        if (ct == null) {
+            throw new IllegalStateException("Message " + access + " not recognized by " + fa);
+        }
+        return indirectCallNode.call(frame, ct, ForeignAccessArguments.create(truffleObject, arguments));
+    }
+}
+
+class CachedObjectAccessNode extends ObjectAccessNode {
+    @Child private DirectCallNode callTarget;
+    @Child private ObjectAccessNode next;
+
+    private final ForeignAccess languageCheck;
+
+    protected CachedObjectAccessNode(DirectCallNode callTarget, ObjectAccessNode next, ForeignAccess languageCheck) {
+        this.callTarget = callTarget;
+        this.next = next;
+        this.languageCheck = languageCheck;
+        this.callTarget.forceInlining();
+    }
+
+    protected CachedObjectAccessNode(CachedObjectAccessNode prev) {
+        this(prev.callTarget, prev.next, prev.languageCheck);
+    }
+
+    @Override
+    public Object executeWith(VirtualFrame frame, TruffleObject receiver, Object[] arguments) {
+        return doAccess(frame, receiver, arguments);
+    }
+
+    private Object doAccess(VirtualFrame frame, TruffleObject receiver, Object[] arguments) {
+        if (languageCheck.canHandle(receiver)) {
+            return callTarget.call(frame, ForeignAccessArguments.create(receiver, arguments));
+        } else {
+            return doNext(frame, receiver, arguments);
+        }
+    }
+
+    private Object doNext(VirtualFrame frame, TruffleObject receiver, Object[] arguments) {
+        return next.executeWith(frame, receiver, arguments);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/Read.java	Tue Jun 09 19:07:39 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+final class Read extends KnownMessage {
+    public static final int HASH = 423438;
+    static Message INSTANCE = new Read();
+
+    private Read() {
+    }
+
+    @Override
+    public boolean equals(Object message) {
+        return message instanceof Read;
+    }
+
+    @Override
+    public int hashCode() {
+        return HASH;
+    }
+
+    @Override
+    public String toString() {
+        return "msgRead";
+    }
+}
--- a/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/TruffleObject.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/TruffleObject.java	Tue Jun 09 19:07:39 2015 -0700
@@ -34,5 +34,5 @@
      *
      * @return the {@code ForeignAccessFactory} instance for this {@code TruffleObject} instance.
      */
-    ForeignAccessFactory getForeignAccessFactory();
+    ForeignAccess getForeignAccess();
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/UnaryMessage.java	Tue Jun 09 19:07:39 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+abstract class UnaryMessage extends KnownMessage {
+    protected UnaryMessage() {
+    }
+
+    @Override
+    public boolean equals(Object message) {
+        if (message == null) {
+            return false;
+        }
+        return this.getClass() == message.getClass();
+    }
+
+    @Override
+    public abstract int hashCode();
+
+    @Override
+    public abstract String toString();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/Unbox.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+final class Unbox extends UnaryMessage {
+    public static final int HASH = 423437;
+    static Message INSTANCE = new Unbox();
+
+    @Override
+    public int hashCode() {
+        return HASH;
+    }
+
+    @Override
+    public String toString() {
+        return "msgUnbox";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/Write.java	Tue Jun 09 19:07:39 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.  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.
+ */
+package com.oracle.truffle.api.interop;
+
+final class Write extends KnownMessage {
+    public static final int HASH = 423431;
+
+    static Message INSTANCE = new Write();
+
+    @Override
+    public boolean equals(Object message) {
+        return message instanceof Write;
+    }
+
+    @Override
+    public int hashCode() {
+        return HASH;
+    }
+
+    @Override
+    public String toString() {
+        return "msgWrite";
+    }
+
+}
--- a/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/exception/UnsupportedMessageException.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +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.  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.
- */
-package com.oracle.truffle.api.interop.exception;
-
-/**
- * An exception thrown if the receiver of a guest language implementation cannot resolve a message.
- */
-public final class UnsupportedMessageException extends RuntimeException {
-
-    private static final long serialVersionUID = -2014660135608964970L;
-
-    public UnsupportedMessageException(String reason) {
-        super(reason);
-    }
-
-}
--- a/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/exception/UnsupportedTypeException.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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.  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.
- */
-package com.oracle.truffle.api.interop.exception;
-
-/**
- * An exception thrown if a foreign type cannot be converted to a language-dependent regular type.
- */
-public class UnsupportedTypeException extends RuntimeException {
-
-    private static final long serialVersionUID = 5786411886196161509L;
-
-    public UnsupportedTypeException(String reason) {
-        super(reason);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/impl/ReadOnlyArrayList.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,270 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop.impl;
+
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+public final class ReadOnlyArrayList<T> implements List<T> {
+    private final T[] arr;
+    private final int first;
+    private final int last;
+
+    private ReadOnlyArrayList(T[] arr, int first, int last) {
+        this.arr = arr;
+        this.first = first;
+        this.last = last;
+    }
+
+    public static <T> List<T> asList(T[] arr, int first, int last) {
+        return new ReadOnlyArrayList<>(arr, first, last);
+    }
+
+    @Override
+    public int size() {
+        return last - first;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return first == last;
+    }
+
+    @Override
+    public boolean contains(Object o) {
+        for (int i = first; i < last; i++) {
+            if (o == arr[i] || (o != null && o.equals(arr[i]))) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public Iterator<T> iterator() {
+        return new LI(first);
+    }
+
+    @Override
+    public Object[] toArray() {
+        return toArray(new Object[size()]);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <A> A[] toArray(A[] b) {
+        A[] a;
+        if (b.length < size()) {
+            a = (A[]) Array.newInstance(b.getClass().getComponentType(), size());
+        } else {
+            a = b;
+        }
+        for (int i = 0, at = first; at < last; i++, at++) {
+            a[i] = (A) arr[at];
+        }
+        return a;
+    }
+
+    @Override
+    public boolean add(Object e) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean containsAll(Collection<?> c) {
+        for (Object obj : c) {
+            if (!contains(obj)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends T> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean addAll(int index, Collection<? extends T> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void clear() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public T get(int index) {
+        int at = first + index;
+        T ret = arr[at];
+        if (at >= last) {
+            throw new ArrayIndexOutOfBoundsException();
+        }
+        return ret;
+    }
+
+    @Override
+    public T set(int index, Object element) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void add(int index, Object element) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public T remove(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int indexOf(Object o) {
+        for (int i = first; i < last; i++) {
+            if (arr[i] == null) {
+                if (o == null) {
+                    return i - first;
+                }
+            } else {
+                if (arr[i].equals(o)) {
+                    return i - first;
+                }
+            }
+        }
+        return -1;
+    }
+
+    @Override
+    public int lastIndexOf(Object o) {
+        for (int i = last - 1; i >= first; i--) {
+            if (arr[i] == null) {
+                if (o == null) {
+                    return i - first;
+                }
+            } else {
+                if (arr[i].equals(o)) {
+                    return i - first;
+                }
+            }
+        }
+        return -1;
+    }
+
+    @Override
+    public ListIterator<T> listIterator() {
+        return new LI(first);
+    }
+
+    @Override
+    public ListIterator<T> listIterator(int index) {
+        return new LI(first + index);
+    }
+
+    @Override
+    public List<T> subList(int fromIndex, int toIndex) {
+        return new ReadOnlyArrayList<>(arr, first + fromIndex, first + toIndex);
+    }
+
+    private final class LI implements ListIterator<T>, Iterator<T> {
+        private int index;
+
+        public LI(int index) {
+            this.index = index;
+        }
+
+        @Override
+        public boolean hasNext() {
+            return index < last;
+        }
+
+        @Override
+        public T next() {
+            if (index >= last) {
+                throw new NoSuchElementException();
+            }
+            return arr[index++];
+        }
+
+        @Override
+        public boolean hasPrevious() {
+            return index > first;
+        }
+
+        @Override
+        public T previous() {
+            if (first == index) {
+                throw new NoSuchElementException();
+            }
+            return arr[--index];
+        }
+
+        @Override
+        public int nextIndex() {
+            return index - first;
+        }
+
+        @Override
+        public int previousIndex() {
+            return index - 1 - first;
+        }
+
+        @Override
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void set(Object e) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void add(Object e) {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/impl/SymbolInvokerImpl.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,103 @@
+/*
+ * 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.  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.
+ */
+package com.oracle.truffle.api.interop.impl;
+
+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.interop.ForeignAccess;
+import com.oracle.truffle.api.interop.Message;
+import com.oracle.truffle.api.interop.TruffleObject;
+import com.oracle.truffle.api.nodes.*;
+
+public final class SymbolInvokerImpl extends SymbolInvoker {
+    static final FrameDescriptor UNUSED_FRAMEDESCRIPTOR = new FrameDescriptor();
+
+    @Override
+    protected Object invoke(Object symbol, Object... arr) throws IOException {
+        if (symbol instanceof String) {
+            return symbol;
+        }
+        if (symbol instanceof Number) {
+            return symbol;
+        }
+        if (symbol instanceof Boolean) {
+            return symbol;
+        }
+        Node executeMain = Message.createExecute(arr.length).createNode();
+        CallTarget callTarget = Truffle.getRuntime().createCallTarget(new TemporaryRoot(executeMain, (TruffleObject) symbol, arr));
+        VirtualFrame frame = Truffle.getRuntime().createVirtualFrame(arr, UNUSED_FRAMEDESCRIPTOR);
+        Object ret = callTarget.call(frame);
+        if (ret instanceof TruffleObject) {
+            TruffleObject tret = (TruffleObject) ret;
+            Object isBoxedResult;
+            try {
+                Node isBoxed = Message.IS_BOXED.createNode();
+                CallTarget isBoxedTarget = Truffle.getRuntime().createCallTarget(new TemporaryRoot(isBoxed, tret));
+                isBoxedResult = isBoxedTarget.call(frame);
+            } catch (IllegalArgumentException ex) {
+                isBoxedResult = false;
+            }
+            if (Boolean.TRUE.equals(isBoxedResult)) {
+                Node unbox = Message.UNBOX.createNode();
+                CallTarget unboxTarget = Truffle.getRuntime().createCallTarget(new TemporaryRoot(unbox, tret));
+                Object unboxResult = unboxTarget.call(frame);
+                return unboxResult;
+            } else {
+                try {
+                    Node isNull = Message.IS_NULL.createNode();
+                    CallTarget isNullTarget = Truffle.getRuntime().createCallTarget(new TemporaryRoot(isNull, tret));
+                    Object isNullResult = isNullTarget.call(frame);
+                    if (Boolean.TRUE.equals(isNullResult)) {
+                        return null;
+                    }
+                } catch (IllegalArgumentException ex) {
+                    // fallthrough
+                }
+            }
+        }
+        return ret;
+    }
+
+    private static class TemporaryRoot extends RootNode {
+        @Child private Node foreignAccess;
+        private final TruffleObject function;
+        private final Object[] args;
+
+        public TemporaryRoot(Node foreignAccess, TruffleObject function, Object... args) {
+            this.foreignAccess = foreignAccess;
+            this.function = function;
+            this.args = args;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return ForeignAccess.execute(foreignAccess, frame, function, args);
+        }
+    }
+
+}
--- a/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/messages/Message.java	Tue Jun 09 18:48:06 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.  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.
- */
-package com.oracle.truffle.api.interop.messages;
-
-public interface Message {
-    boolean matchStructure(Object message);
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/package-info.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * 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.  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.
+ */
+
+/**
+ * This package provides inter-operability between different
+ * {@link com.oracle.truffle.api.TruffleLanguage Truffle languages}.
+ * <p>
+ * Languages can exchange primitive Java type wrapper objects (e.g., {@link java.lang.Integer},
+ * {@link java.lang.Double}, {@link java.lang.String}, etc) as well as any type
+ * implementing {@link com.oracle.truffle.api.interop.TruffleObject}. Foreign objects are
+ * precisely those implementing {@link com.oracle.truffle.api.interop.TruffleObject}.
+ * <p>
+ * To use a {@link com.oracle.truffle.api.interop.TruffleObject} from a different language,
+ * you need to ask the language to build appropriate AST for a given
+ * {@link com.oracle.truffle.api.interop.Message} with
+ * {@link com.oracle.truffle.api.interop.Message#createNode}. The message can then
+ * be executed with {@link com.oracle.truffle.api.interop.ForeignAccess#execute}.
+ */
+package com.oracle.truffle.api.interop;
+
--- a/graal/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/ObjectType.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/ObjectType.java	Tue Jun 09 19:07:39 2015 -0700
@@ -24,11 +24,10 @@
  */
 package com.oracle.truffle.api.object;
 
+import com.oracle.truffle.api.interop.Message;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.interop.*;
-import com.oracle.truffle.api.interop.exception.*;
-import com.oracle.truffle.api.interop.messages.*;
 
 public class ObjectType {
     /**
@@ -72,16 +71,16 @@
     public void onPropertyAdded(Property property, Shape shapeBefore, Shape shapeAfter) {
     }
 
-    public ForeignAccessFactory getForeignAccessFactory() {
-        return new ForeignAccessFactory() {
+    public ForeignAccess getForeignAccessFactory() {
+        return ForeignAccess.create(new com.oracle.truffle.api.interop.ForeignAccess.Factory() {
 
-            public InteropPredicate getLanguageCheck() {
-                throw new UnsupportedMessageException(this.toString() + " cannot be shared");
+            public boolean canHandle(TruffleObject obj) {
+                throw new IllegalArgumentException(this.toString() + " cannot be shared");
             }
 
-            public CallTarget getAccess(Message tree) {
-                throw new UnsupportedMessageException(this.toString() + " cannot be shared; Message not possible: " + tree.toString());
+            public CallTarget accessMessage(Message tree) {
+                throw new IllegalArgumentException(this.toString() + " cannot be shared; Message not possible: " + tree.toString());
             }
-        };
+        });
     }
 }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/Truffle.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/Truffle.java	Tue Jun 09 19:07:39 2015 -0700
@@ -24,9 +24,9 @@
  */
 package com.oracle.truffle.api;
 
+import java.lang.reflect.*;
 import java.security.*;
 
-import com.oracle.jvmci.service.*;
 import com.oracle.truffle.api.impl.*;
 
 /**
@@ -55,11 +55,22 @@
         return AccessController.doPrivileged(new PrivilegedAction<TruffleRuntime>() {
             public TruffleRuntime run() {
                 TruffleRuntimeAccess access = null;
+                Class<?> servicesClass = null;
                 try {
-                    access = Services.loadSingle(TruffleRuntimeAccess.class, false);
-                } catch (NoClassDefFoundError e) {
+                    servicesClass = Class.forName("com.oracle.jvmci.service.Services");
+                } catch (ClassNotFoundException e) {
                     // JVMCI is unavailable
                 }
+                if (servicesClass != null) {
+                    try {
+                        Method m = servicesClass.getDeclaredMethod("loadSingle", Class.class, boolean.class);
+                        access = (TruffleRuntimeAccess) m.invoke(null, TruffleRuntimeAccess.class, false);
+                    } catch (Throwable e) {
+                        // Fail fast for other errors
+                        throw (InternalError) new InternalError().initCause(e);
+                    }
+                }
+                // TODO: try standard ServiceLoader?
                 if (access != null) {
                     return access.getRuntime();
                 }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntimeAccess.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntimeAccess.java	Tue Jun 09 19:07:39 2015 -0700
@@ -24,13 +24,10 @@
  */
 package com.oracle.truffle.api;
 
-import com.oracle.jvmci.service.*;
-
 /**
- * A {@linkplain Service JVMCI service} that provides access to a {@link TruffleRuntime}
- * implementation.
+ * A service that provides access to a {@link TruffleRuntime} implementation.
  */
-public interface TruffleRuntimeAccess extends Service {
+public interface TruffleRuntimeAccess {
 
     /**
      * Gets the {@link TruffleRuntime} implementation available via this access object.
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java	Tue Jun 09 19:07:39 2015 -0700
@@ -32,6 +32,7 @@
 import javax.lang.model.type.*;
 import javax.lang.model.util.*;
 
+import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.*;
@@ -68,6 +69,7 @@
     private final Set<TypeMirror> expectedTypes = new HashSet<>();
     private final Set<NodeExecutionData> usedExecuteChildMethods = new HashSet<>();
     private boolean nextUsed;
+    private boolean singleSpecializableUnsupportedUsed;
 
     private List<ExecutableTypeData> usedTypes;
     private List<SpecializationData> reachableSpecializations;
@@ -239,8 +241,8 @@
                 clazz.add(createExecutableTypeOverride(usedTypes, execType));
             }
 
-            if (node.needsRewrites(context)) {
-                clazz.add(createUnsupportedMethod());
+            if (singleSpecializableUnsupportedUsed) {
+                addUnsupportedMethod(clazz);
             }
         } else {
 
@@ -297,11 +299,18 @@
         }
     }
 
-    private Element createUnsupportedMethod() {
+    private void addUnsupportedMethod(CodeTypeElement clazz) {
+        CodeVariableElement seenUnsupportedField = new CodeVariableElement(modifiers(PRIVATE), getType(boolean.class), "seenUnsupported0");
+        seenUnsupportedField.getAnnotationMirrors().add(new CodeAnnotationMirror(context.getDeclaredType(CompilationFinal.class)));
+        clazz.add(seenUnsupportedField);
         LocalContext locals = LocalContext.load(this);
-        CodeExecutableElement method = locals.createMethod(modifiers(PROTECTED), getType(UnsupportedSpecializationException.class), "unsupported", varArgsThreshold);
-
+        CodeExecutableElement method = locals.createMethod(modifiers(PRIVATE), getType(UnsupportedSpecializationException.class), "unsupported", varArgsThreshold);
         CodeTreeBuilder builder = method.createBuilder();
+        builder.startIf().string("!").string(seenUnsupportedField.getName()).end().startBlock();
+        builder.startStatement().startStaticCall(getType(CompilerDirectives.class), "transferToInterpreterAndInvalidate").end().end();
+        builder.startStatement().string(seenUnsupportedField.getName()).string(" = true").end();
+        builder.end();
+
         builder.startReturn();
         builder.startNew(getType(UnsupportedSpecializationException.class));
         builder.string("this");
@@ -309,7 +318,7 @@
         locals.addReferencesTo(builder);
         builder.end();
         builder.end();
-        return method;
+        clazz.add(method);
     }
 
     private CodeExecutableElement createNodeConstructor(CodeTypeElement clazz, ExecutableElement superConstructor) {
@@ -1512,7 +1521,8 @@
         }
     }
 
-    private static CodeTree createThrowUnsupported(LocalContext currentValues) {
+    private CodeTree createThrowUnsupported(LocalContext currentValues) {
+        singleSpecializableUnsupportedUsed = true;
         CodeTreeBuilder builder = CodeTreeBuilder.createBuilder();
         builder.startThrow().startCall("unsupported");
         currentValues.addReferencesTo(builder);
--- a/graal/com.oracle.truffle.interop/src/META-INF/services/com.oracle.truffle.api.impl.SymbolInvoker	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.oracle.truffle.interop.SymbolInvokerImpl
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/ForeignAccessArguments.java	Tue Jun 09 18:48:06 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.  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.
- */
-package com.oracle.truffle.interop;
-
-import com.oracle.truffle.api.*;
-
-public final class ForeignAccessArguments {
-    public static final Object[] EMPTY_ARGUMENTS_ARRAY = new Object[0];
-    public static final int RECEIVER_INDEX = 0;
-    public static final int RUNTIME_ARGUMENT_COUNT = 1;
-
-    public static Object[] create(Object receiver) {
-        return new Object[]{receiver};
-    }
-
-    public static Object[] create(Object receiver, Object[] arguments) {
-        Object[] objectArguments = new Object[RUNTIME_ARGUMENT_COUNT + arguments.length];
-        objectArguments[RECEIVER_INDEX] = receiver;
-        arraycopy(arguments, 0, objectArguments, RUNTIME_ARGUMENT_COUNT, arguments.length);
-        return objectArguments;
-    }
-
-    public static Object getArgument(Object[] arguments, int index) {
-        return arguments[RUNTIME_ARGUMENT_COUNT + index];
-    }
-
-    public static Object getReceiver(Object[] arguments) {
-        return arguments[RECEIVER_INDEX];
-    }
-
-    public static Object[] extractUserArguments(Object[] arguments) {
-        return copyOfRange(arguments, RUNTIME_ARGUMENT_COUNT, arguments.length);
-    }
-
-    public static Object[] extractUserArguments(int skip, Object[] arguments) {
-        return copyOfRange(arguments, RUNTIME_ARGUMENT_COUNT + skip, arguments.length);
-    }
-
-    public static int getUserArgumentCount(Object[] arguments) {
-        return arguments.length - RUNTIME_ARGUMENT_COUNT;
-    }
-
-    private static Object[] copyOfRange(Object[] original, int from, int to) {
-        int newLength = to - from;
-        if (newLength < 0) {
-            CompilerDirectives.transferToInterpreter();
-            throw new IllegalArgumentException(from + " > " + to);
-        }
-        Object[] copy = new Object[newLength];
-        arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength));
-        return copy;
-    }
-
-    private static void arraycopy(Object[] src, int srcPos, Object[] dest, int destPos, int length) {
-        for (int i = 0; i < length; i++) {
-            dest[destPos + i] = src[srcPos + i];
-        }
-    }
-
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/SymbolInvokerImpl.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +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.  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.
- */
-package com.oracle.truffle.interop;
-
-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.interop.*;
-import com.oracle.truffle.api.interop.exception.UnsupportedMessageException;
-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();
-
-    @Override
-    protected Object invoke(Object symbol, Object... arr) throws IOException {
-        if (symbol instanceof String) {
-            return symbol;
-        }
-        if (symbol instanceof Number) {
-            return symbol;
-        }
-        if (symbol instanceof Boolean) {
-            return symbol;
-        }
-        ForeignObjectAccessNode callMain = ForeignObjectAccessNode.getAccess(Execute.create(Receiver.create(), arr.length));
-        CallTarget callMainTarget = Truffle.getRuntime().createCallTarget(new TemporaryRoot(callMain, (TruffleObject) symbol, arr));
-        VirtualFrame frame = Truffle.getRuntime().createVirtualFrame(arr, UNUSED_FRAMEDESCRIPTOR);
-        Object ret = callMainTarget.call(frame);
-        if (ret instanceof TruffleObject) {
-            TruffleObject tret = (TruffleObject) ret;
-            Object isBoxedResult;
-            try {
-                ForeignObjectAccessNode isBoxed = ForeignObjectAccessNode.getAccess(IsBoxed.create(Receiver.create()));
-                CallTarget isBoxedTarget = Truffle.getRuntime().createCallTarget(new TemporaryRoot(isBoxed, tret));
-                isBoxedResult = isBoxedTarget.call(frame);
-            } catch (UnsupportedMessageException ex) {
-                isBoxedResult = false;
-            }
-            if (Boolean.TRUE.equals(isBoxedResult)) {
-                ForeignObjectAccessNode unbox = ForeignObjectAccessNode.getAccess(Unbox.create(Receiver.create()));
-                CallTarget unboxTarget = Truffle.getRuntime().createCallTarget(new TemporaryRoot(unbox, tret));
-                Object unboxResult = unboxTarget.call(frame);
-                return unboxResult;
-            } else {
-                try {
-                    ForeignObjectAccessNode isNull = ForeignObjectAccessNode.getAccess(IsNull.create(Receiver.create()));
-                    CallTarget isNullTarget = Truffle.getRuntime().createCallTarget(new TemporaryRoot(isNull, tret));
-                    Object isNullResult = isNullTarget.call(frame);
-                    if (Boolean.TRUE.equals(isNullResult)) {
-                        return null;
-                    }
-                } catch (UnsupportedMessageException ex) {
-                    // fallthrough
-                }
-            }
-        }
-        return ret;
-    }
-
-    private static class TemporaryRoot extends RootNode {
-        @Child private ForeignObjectAccessNode foreignAccess;
-        private final TruffleObject function;
-        private final Object[] args;
-
-        public TemporaryRoot(ForeignObjectAccessNode foreignAccess, TruffleObject function, Object... args) {
-            this.foreignAccess = foreignAccess;
-            this.function = function;
-            this.args = args;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            return foreignAccess.executeForeign(frame, function, args);
-        }
-    }
-
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Argument.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-public final class Argument {
-    private Argument() {
-    }
-
-    public static Argument create() {
-        return new Argument();
-    }
-
-    @Override
-    public String toString() {
-        return String.format("Argument");
-    }
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Execute.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-public final class Execute implements Message {
-    private final Object receiver;
-    private final int arity;
-
-    public static Execute create(Receiver receiver, int arity) {
-        return new Execute(receiver, arity);
-    }
-
-    public static Execute create(Message receiver, int arity) {
-        return new Execute(receiver, arity);
-    }
-
-    private Execute(Object receiver, int arity) {
-        this.receiver = receiver;
-        this.arity = arity;
-    }
-
-    public Object getReceiver() {
-        return receiver;
-    }
-
-    public int getArity() {
-        return arity;
-    }
-
-    public boolean matchStructure(Object message) {
-        if (!(message instanceof Execute)) {
-            return false;
-        }
-        Execute m1 = this;
-        Execute m2 = (Execute) message;
-        return MessageUtil.compareMessage(m1.getReceiver(), m2.getReceiver());
-    }
-
-    @Override
-    public String toString() {
-        return String.format("Execute(%s)", receiver.toString());
-    }
-
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/GetSize.java	Tue Jun 09 18:48:06 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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-public final class GetSize extends UnaryMessage {
-
-    public static GetSize create(Receiver receiver) {
-        return new GetSize(receiver);
-    }
-
-    public static GetSize create(Message receiver) {
-        return new GetSize(receiver);
-    }
-
-    private GetSize(Object receiver) {
-        super(receiver);
-    }
-
-    @Override
-    public String toString() {
-        return String.format("GetSize(%s)", receiver.toString());
-    }
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/HasSize.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-public final class HasSize extends UnaryMessage {
-    public static HasSize create(Receiver receiver) {
-        return new HasSize(receiver);
-    }
-
-    public static HasSize create(Message receiver) {
-        return new HasSize(receiver);
-    }
-
-    private HasSize(Object receiver) {
-        super(receiver);
-    }
-
-    @Override
-    public String toString() {
-        return String.format("HasSize(%s)", receiver.toString());
-    }
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/IsBoxed.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-public final class IsBoxed extends UnaryMessage {
-    public static IsBoxed create(Receiver receiver) {
-        return new IsBoxed(receiver);
-    }
-
-    public static IsBoxed create(Message receiver) {
-        return new IsBoxed(receiver);
-    }
-
-    private IsBoxed(Object receiver) {
-        super(receiver);
-    }
-
-    @Override
-    public String toString() {
-        return String.format("IsBoxed(%s)", receiver.toString());
-    }
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/IsExecutable.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-public final class IsExecutable extends UnaryMessage {
-    public static IsExecutable create(Receiver receiver) {
-        return new IsExecutable(receiver);
-    }
-
-    public static IsExecutable create(Message receiver) {
-        return new IsExecutable(receiver);
-    }
-
-    private IsExecutable(Object receiver) {
-        super(receiver);
-    }
-
-    @Override
-    public String toString() {
-        return String.format("IsExecutable(%s)", receiver.toString());
-    }
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/IsNull.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-public final class IsNull extends UnaryMessage {
-    public static IsNull create(Receiver receiver) {
-        return new IsNull(receiver);
-    }
-
-    public static IsNull create(Message receiver) {
-        return new IsNull(receiver);
-    }
-
-    private IsNull(Object receiver) {
-        super(receiver);
-    }
-
-    @Override
-    public String toString() {
-        return String.format("IsNull(%s)", receiver.toString());
-    }
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/MessageUtil.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-final class MessageUtil {
-
-    static boolean compareMessage(Object o1, Object o2) {
-        if (o1 instanceof Message && o2 instanceof Message) {
-            return ((Message) o1).matchStructure(o2);
-        } else if (o1 instanceof Receiver && o2 instanceof Receiver) {
-            return true;
-        }
-        return false;
-    }
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Read.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-public final class Read implements Message {
-    private final Object receiver;
-    private final Argument id;
-
-    private Read(Object receiver, Argument id) {
-        this.receiver = receiver;
-        this.id = id;
-    }
-
-    public static Read create(Receiver receiver, Argument id) {
-        return new Read(receiver, id);
-    }
-
-    public static Read create(Message receiver, Argument id) {
-        return new Read(receiver, id);
-    }
-
-    public Argument getId() {
-        return id;
-    }
-
-    public Object getReceiver() {
-        return receiver;
-    }
-
-    public boolean matchStructure(Object message) {
-        if (!(message instanceof Read)) {
-            return false;
-        }
-        Read m1 = this;
-        Read m2 = (Read) message;
-        return MessageUtil.compareMessage(m1.getReceiver(), m2.getReceiver());
-    }
-
-    @Override
-    public String toString() {
-        return String.format("Read(%s, %s)", receiver.toString(), id.toString());
-    }
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Receiver.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-public final class Receiver {
-
-    private Receiver() {
-
-    }
-
-    public static Receiver create() {
-        return new Receiver();
-    }
-
-    @Override
-    public String toString() {
-        return String.format("Receiver");
-    }
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/UnaryMessage.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-abstract class UnaryMessage implements Message {
-    protected final Object receiver;
-
-    protected UnaryMessage(Object receiver) {
-        this.receiver = receiver;
-    }
-
-    public Object getReceiver() {
-        return receiver;
-    }
-
-    public boolean matchStructure(Object message) {
-        if (message == null) {
-            return false;
-        }
-        if (this.getClass() != message.getClass()) {
-            return false;
-        }
-        UnaryMessage m1 = this;
-        UnaryMessage m2 = (UnaryMessage) message;
-        return MessageUtil.compareMessage(m1.getReceiver(), m2.getReceiver());
-    }
-
-    @Override
-    public abstract String toString();
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Unbox.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-public final class Unbox extends UnaryMessage {
-    public static Unbox create(Receiver receiver) {
-        return new Unbox(receiver);
-    }
-
-    public static Unbox create(Message receiver) {
-        return new Unbox(receiver);
-    }
-
-    private Unbox(Object receiver) {
-        super(receiver);
-    }
-
-    @Override
-    public String toString() {
-        return String.format("Unbox(%s)", receiver.toString());
-    }
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/messages/Write.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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.  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.
- */
-package com.oracle.truffle.interop.messages;
-
-import com.oracle.truffle.api.interop.messages.*;
-
-public final class Write implements Message {
-    private final Object receiver;
-    private final Argument id;
-    private final Argument value;
-
-    private Write(Object receiver, Argument id, Argument value) {
-        this.receiver = receiver;
-        this.id = id;
-        this.value = value;
-    }
-
-    public static Write create(Receiver receiver, Argument id, Argument value) {
-        return new Write(receiver, id, value);
-    }
-
-    public static Write create(Message receiver, Argument id, Argument value) {
-        return new Write(receiver, id, value);
-    }
-
-    public Argument getId() {
-        return id;
-    }
-
-    public Object getReceiver() {
-        return receiver;
-    }
-
-    public Argument getValue() {
-        return value;
-    }
-
-    public boolean matchStructure(Object message) {
-        if (!(message instanceof Write)) {
-            return false;
-        }
-        Write m1 = this;
-        Write m2 = (Write) message;
-        return MessageUtil.compareMessage(m1.getReceiver(), m2.getReceiver());
-    }
-
-    @Override
-    public String toString() {
-        return String.format("Write(%s, %s, %s)", receiver.toString(), id.toString(), value.toString());
-    }
-
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/node/ForeignObjectAccessHeadNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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.  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.
- */
-
-package com.oracle.truffle.interop.node;
-
-import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.api.interop.*;
-import com.oracle.truffle.api.interop.messages.*;
-
-final class ForeignObjectAccessHeadNode extends ForeignObjectAccessNode {
-
-    @Child private ObjectAccessNode first;
-    private final Message accessTree;
-
-    protected ForeignObjectAccessHeadNode(Message tree) {
-        this.accessTree = tree;
-        this.first = new UnresolvedObjectAccessNode();
-        adoptChildren();
-    }
-
-    protected Message getAccessTree() {
-        return accessTree;
-    }
-
-    protected ObjectAccessNode getFirst() {
-        return first;
-    }
-
-    @Override
-    public Object executeForeign(VirtualFrame frame, TruffleObject receiver, Object... arguments) {
-        return first.executeWith(frame, receiver, arguments);
-    }
-
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/node/ForeignObjectAccessNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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.  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.
- */
-
-package com.oracle.truffle.interop.node;
-
-import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.api.interop.*;
-import com.oracle.truffle.api.interop.messages.*;
-import com.oracle.truffle.api.nodes.*;
-
-public abstract class ForeignObjectAccessNode extends Node {
-
-    public static ForeignObjectAccessNode getAccess(Message tree) {
-        return new ForeignObjectAccessHeadNode(tree);
-    }
-
-    public abstract Object executeForeign(VirtualFrame frame, TruffleObject receiver, Object... arguments);
-
-}
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/node/ObjectAccessNode.java	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +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.  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.
- */
-package com.oracle.truffle.interop.node;
-
-import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.api.interop.*;
-import com.oracle.truffle.api.interop.messages.*;
-import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.interop.*;
-
-abstract class ObjectAccessNode extends Node {
-
-    public abstract Object executeWith(VirtualFrame frame, TruffleObject receiver, Object[] arguments);
-
-}
-
-class UnresolvedObjectAccessNode extends ObjectAccessNode {
-
-    private static final int CACHE_SIZE = 8;
-    private int cacheLength = 1;
-
-    @Override
-    public Object executeWith(VirtualFrame frame, TruffleObject receiver, Object[] arguments) {
-        CompilerDirectives.transferToInterpreterAndInvalidate();
-        ForeignObjectAccessHeadNode nthParent = (ForeignObjectAccessHeadNode) NodeUtil.getNthParent(this, cacheLength);
-        ObjectAccessNode first = nthParent.getFirst();
-        if (cacheLength < CACHE_SIZE) {
-            cacheLength++;
-            CachedObjectAccessNode createCachedAccess = createCachedAccess(receiver, nthParent.getAccessTree(), first);
-            return first.replace(createCachedAccess).executeWith(frame, receiver, arguments);
-        } else {
-            return first.replace(createGenericAccess(nthParent.getAccessTree())).executeWith(frame, receiver, arguments);
-        }
-    }
-
-    private static CachedObjectAccessNode createCachedAccess(TruffleObject receiver, Message accessTree, ObjectAccessNode next) {
-        ForeignAccessFactory accessFactory = receiver.getForeignAccessFactory();
-        return new CachedObjectAccessNode(Truffle.getRuntime().createDirectCallNode(accessFactory.getAccess(accessTree)), next, accessFactory.getLanguageCheck());
-    }
-
-    private static GenericObjectAccessNode createGenericAccess(Message access) {
-        return new GenericObjectAccessNode(access);
-    }
-}
-
-class GenericObjectAccessNode extends ObjectAccessNode {
-
-    private final Message access;
-    @Child private IndirectCallNode indirectCallNode;
-
-    public GenericObjectAccessNode(Message access) {
-        this.access = access;
-        indirectCallNode = Truffle.getRuntime().createIndirectCallNode();
-    }
-
-    public GenericObjectAccessNode(GenericObjectAccessNode prev) {
-        this(prev.access);
-    }
-
-    @Override
-    public Object executeWith(VirtualFrame frame, TruffleObject truffleObject, Object[] arguments) {
-        return indirectCallNode.call(frame, truffleObject.getForeignAccessFactory().getAccess(access), ForeignAccessArguments.create(truffleObject, arguments));
-    }
-}
-
-class CachedObjectAccessNode extends ObjectAccessNode {
-    @Child private DirectCallNode callTarget;
-    @Child private ObjectAccessNode next;
-
-    private final InteropPredicate languageCheck;
-
-    protected CachedObjectAccessNode(DirectCallNode callTarget, ObjectAccessNode next, InteropPredicate languageCheck) {
-        this.callTarget = callTarget;
-        this.next = next;
-        this.languageCheck = languageCheck;
-        this.callTarget.forceInlining();
-    }
-
-    protected CachedObjectAccessNode(CachedObjectAccessNode prev) {
-        this(prev.callTarget, prev.next, prev.languageCheck);
-    }
-
-    @Override
-    public Object executeWith(VirtualFrame frame, TruffleObject receiver, Object[] arguments) {
-        return doAccess(frame, receiver, arguments);
-    }
-
-    private Object doAccess(VirtualFrame frame, TruffleObject receiver, Object[] arguments) {
-        if (languageCheck.test(receiver)) {
-            return callTarget.call(frame, ForeignAccessArguments.create(receiver, arguments));
-        } else {
-            return doNext(frame, receiver, arguments);
-        }
-    }
-
-    private Object doNext(VirtualFrame frame, TruffleObject receiver, Object[] arguments) {
-        return next.executeWith(frame, receiver, arguments);
-    }
-}
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectImpl.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectImpl.java	Tue Jun 09 19:07:39 2015 -0700
@@ -376,7 +376,8 @@
         ShapeProfiler.getInstance().track(obj);
     }
 
-    public ForeignAccessFactory getForeignAccessFactory() {
+    @Override
+    public ForeignAccess getForeignAccess() {
         return getShape().getForeignAccessFactory();
     }
 }
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java	Tue Jun 09 19:07:39 2015 -0700
@@ -1107,7 +1107,7 @@
     protected static final DebugCounter propertyListAllocCount = DebugCounter.create("Property lists allocated");
     protected static final DebugCounter propertyListShareCount = DebugCounter.create("Property lists shared");
 
-    public ForeignAccessFactory getForeignAccessFactory() {
+    public ForeignAccess getForeignAccessFactory() {
         return getObjectType().getForeignAccessFactory();
     }
 }
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLFunction.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLFunction.java	Tue Jun 09 19:07:39 2015 -0700
@@ -98,7 +98,7 @@
      * foreign access implementation}.
      */
     @Override
-    public ForeignAccessFactory getForeignAccessFactory() {
+    public ForeignAccess getForeignAccess() {
         return SLFunctionForeignAccess.INSTANCE;
     }
 }
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLFunctionForeignAccess.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLFunctionForeignAccess.java	Tue Jun 09 19:07:39 2015 -0700
@@ -25,41 +25,37 @@
 import com.oracle.truffle.api.CallTarget;
 import com.oracle.truffle.api.Truffle;
 import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.interop.ForeignAccessFactory;
-import com.oracle.truffle.api.interop.InteropPredicate;
-import com.oracle.truffle.api.interop.exception.UnsupportedMessageException;
-import com.oracle.truffle.api.interop.messages.Message;
 import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.interop.ForeignAccessArguments;
-import com.oracle.truffle.interop.messages.Execute;
-import com.oracle.truffle.interop.messages.IsNull;
-import com.oracle.truffle.interop.messages.Receiver;
+import com.oracle.truffle.api.interop.TruffleObject;
+import com.oracle.truffle.api.interop.ForeignAccess;
+import com.oracle.truffle.api.interop.Message;
 import com.oracle.truffle.sl.nodes.call.SLDispatchNode;
 import com.oracle.truffle.sl.nodes.call.SLDispatchNodeGen;
 import java.math.BigInteger;
+import java.util.List;
 
 /**
- * Implementation of foreing access for {@link SLFunction}.
+ * Implementation of foreign access for {@link SLFunction}.
  */
-final class SLFunctionForeignAccess implements ForeignAccessFactory {
-    public static final ForeignAccessFactory INSTANCE = new SLFunctionForeignAccess();
+final class SLFunctionForeignAccess implements ForeignAccess.Factory {
+    public static final ForeignAccess INSTANCE = ForeignAccess.create(new SLFunctionForeignAccess());
 
     private SLFunctionForeignAccess() {
     }
 
     @Override
-    public InteropPredicate getLanguageCheck() {
-        return (com.oracle.truffle.api.interop.TruffleObject o) -> o instanceof SLFunction;
+    public boolean canHandle(TruffleObject o) {
+        return o instanceof SLFunction;
     }
 
     @Override
-    public CallTarget getAccess(Message tree) {
-        if (Execute.create(Receiver.create(), 0).matchStructure(tree)) {
+    public CallTarget accessMessage(Message tree) {
+        if (Message.createExecute(0).equals(tree)) {
             return Truffle.getRuntime().createCallTarget(new SLForeignCallerRootNode());
-        } else if (IsNull.create(Receiver.create()).matchStructure(tree)) {
+        } else if (Message.IS_NULL.equals(tree)) {
             return Truffle.getRuntime().createCallTarget(new SLForeignNullCheckNode());
         } else {
-            throw new UnsupportedMessageException(tree.toString() + " not supported");
+            throw new IllegalArgumentException(tree.toString() + " not supported");
         }
     }
 
@@ -68,24 +64,25 @@
 
         @Override
         public Object execute(VirtualFrame frame) {
-            SLFunction function = (SLFunction) ForeignAccessArguments.getReceiver(frame.getArguments());
+            SLFunction function = (SLFunction) ForeignAccess.getReceiver(frame);
             // the calling convention of interop passes the receiver of a
             // function call (the this object)
             // as an implicit 1st argument; we need to ignore this argument for SL
-            Object[] arguments = ForeignAccessArguments.extractUserArguments(1, frame.getArguments());
-            for (int i = 0; i < arguments.length; i++) {
-                if (arguments[i] instanceof Long) {
+            List<Object> args = ForeignAccess.getArguments(frame);
+            Object[] arr = args.subList(1, args.size()).toArray();
+            for (int i = 0; i < arr.length; i++) {
+                Object a = arr[i];
+                if (a instanceof Long) {
                     continue;
                 }
-                if (arguments[i] instanceof BigInteger) {
+                if (a instanceof BigInteger) {
                     continue;
                 }
-                if (arguments[i] instanceof Number) {
-                    arguments[i] = ((Number) arguments[i]).longValue();
+                if (a instanceof Number) {
+                    arr[i] = ((Number) a).longValue();
                 }
             }
-
-            return dispatch.executeDispatch(frame, function, arguments);
+            return dispatch.executeDispatch(frame, function, arr);
         }
 
     }
@@ -93,7 +90,7 @@
     private static class SLForeignNullCheckNode extends RootNode {
         @Override
         public Object execute(VirtualFrame frame) {
-            Object receiver = ForeignAccessArguments.getReceiver(frame.getArguments());
+            Object receiver = ForeignAccess.getReceiver(frame);
             return SLNull.SINGLETON == receiver;
         }
     }
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLNull.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLNull.java	Tue Jun 09 19:07:39 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.truffle.sl.runtime;
 
-import com.oracle.truffle.api.interop.ForeignAccessFactory;
+import com.oracle.truffle.api.interop.ForeignAccess;
 import com.oracle.truffle.api.interop.TruffleObject;
 
 /**
@@ -57,7 +57,7 @@
     }
 
     @Override
-    public ForeignAccessFactory getForeignAccessFactory() {
+    public ForeignAccess getForeignAccess() {
         return SLFunctionForeignAccess.INSTANCE;
     }
 }
Binary file graal/findbugs-SuppressFBWarnings.jar has changed
--- a/hotspot/.project	Tue Jun 09 18:48:06 2015 -0700
+++ b/hotspot/.project	Tue Jun 09 19:07:39 2015 -0700
@@ -113,7 +113,7 @@
 		<link>
 			<name>generated_java_processor</name>
 			<type>2</type>
-			<locationURI>PARENT-1-PROJECT_LOC/graal/com.oracle.jvmci.hotspot/src_gen/hotspot</locationURI>
+			<locationURI>PARENT-1-PROJECT_LOC/jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot</locationURI>
 		</link>
 		<link>
 			<name>linux</name>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.amd64/src/com/oracle/jvmci/amd64/AMD64.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,207 @@
+/*
+ * 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.amd64;
+
+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.jvmci.code.Register.RegisterCategory;
+
+/**
+ * Represents the AMD64 architecture.
+ */
+public class AMD64 extends Architecture {
+
+    public static final RegisterCategory CPU = new RegisterCategory("CPU");
+
+    // @formatter:off
+
+    // General purpose CPU registers
+    public static final Register rax = new Register(0, 0, "rax", CPU);
+    public static final Register rcx = new Register(1, 1, "rcx", CPU);
+    public static final Register rdx = new Register(2, 2, "rdx", CPU);
+    public static final Register rbx = new Register(3, 3, "rbx", CPU);
+    public static final Register rsp = new Register(4, 4, "rsp", CPU);
+    public static final Register rbp = new Register(5, 5, "rbp", CPU);
+    public static final Register rsi = new Register(6, 6, "rsi", CPU);
+    public static final Register rdi = new Register(7, 7, "rdi", CPU);
+
+    public static final Register r8  = new Register(8,  8,  "r8", CPU);
+    public static final Register r9  = new Register(9,  9,  "r9", CPU);
+    public static final Register r10 = new Register(10, 10, "r10", CPU);
+    public static final Register r11 = new Register(11, 11, "r11", CPU);
+    public static final Register r12 = new Register(12, 12, "r12", CPU);
+    public static final Register r13 = new Register(13, 13, "r13", CPU);
+    public static final Register r14 = new Register(14, 14, "r14", CPU);
+    public static final Register r15 = new Register(15, 15, "r15", CPU);
+
+    public static final Register[] cpuRegisters = {
+        rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
+        r8, r9, r10, r11, r12, r13, r14, r15
+    };
+
+    private static final int XMM_REFERENCE_MAP_SHIFT = 2;
+
+    public static final RegisterCategory XMM = new RegisterCategory("XMM", cpuRegisters.length, XMM_REFERENCE_MAP_SHIFT);
+
+    // XMM registers
+    public static final Register xmm0 = new Register(16, 0, "xmm0", XMM);
+    public static final Register xmm1 = new Register(17, 1, "xmm1", XMM);
+    public static final Register xmm2 = new Register(18, 2, "xmm2", XMM);
+    public static final Register xmm3 = new Register(19, 3, "xmm3", XMM);
+    public static final Register xmm4 = new Register(20, 4, "xmm4", XMM);
+    public static final Register xmm5 = new Register(21, 5, "xmm5", XMM);
+    public static final Register xmm6 = new Register(22, 6, "xmm6", XMM);
+    public static final Register xmm7 = new Register(23, 7, "xmm7", XMM);
+
+    public static final Register xmm8 =  new Register(24,  8, "xmm8",  XMM);
+    public static final Register xmm9 =  new Register(25,  9, "xmm9",  XMM);
+    public static final Register xmm10 = new Register(26, 10, "xmm10", XMM);
+    public static final Register xmm11 = new Register(27, 11, "xmm11", XMM);
+    public static final Register xmm12 = new Register(28, 12, "xmm12", XMM);
+    public static final Register xmm13 = new Register(29, 13, "xmm13", XMM);
+    public static final Register xmm14 = new Register(30, 14, "xmm14", XMM);
+    public static final Register xmm15 = new Register(31, 15, "xmm15", XMM);
+
+    public static final Register[] xmmRegisters = {
+        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
+        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
+    };
+
+    public static final Register[] cpuxmmRegisters = {
+        rax,  rcx,  rdx,   rbx,   rsp,   rbp,   rsi,   rdi,
+        r8,   r9,   r10,   r11,   r12,   r13,   r14,   r15,
+        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
+        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
+    };
+
+    /**
+     * Register used to construct an instruction-relative address.
+     */
+    public static final Register rip = new Register(32, -1, "rip", SPECIAL);
+
+    public static final Register[] allRegisters = {
+        rax,  rcx,  rdx,   rbx,   rsp,   rbp,   rsi,   rdi,
+        r8,   r9,   r10,   r11,   r12,   r13,   r14,   r15,
+        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
+        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,
+        rip
+    };
+
+    // @formatter:on
+
+    /**
+     * Basic set of CPU features mirroring what is returned from the cpuid instruction.
+     */
+    public static enum CPUFeature {
+        SSE,
+        SSE2,
+        SSE3,
+        SSE4a,
+        SSE4_1,
+        SSE4_2,
+        SSSE3,
+        POPCNT,
+        LZCNT,
+        AVX,
+        AVX2,
+        ERMS,
+        AMD_3DNOW_PREFETCH,
+        AES,
+        BMI1
+    }
+
+    private final EnumSet<CPUFeature> features;
+
+    /**
+     * Set of flags to control code emission.
+     */
+    public static enum Flag {
+        UseCountLeadingZerosInstruction,
+        UseCountTrailingZerosInstruction
+    }
+
+    private final EnumSet<Flag> flags;
+
+    public AMD64(EnumSet<CPUFeature> features, EnumSet<Flag> flags) {
+        super("AMD64", 8, ByteOrder.LITTLE_ENDIAN, true, allRegisters, LOAD_STORE | STORE_STORE, 1, cpuRegisters.length + (xmmRegisters.length << XMM_REFERENCE_MAP_SHIFT), 8);
+        this.features = features;
+        this.flags = flags;
+        assert features.contains(CPUFeature.SSE2) : "minimum config for x64";
+    }
+
+    public EnumSet<CPUFeature> getFeatures() {
+        return features;
+    }
+
+    public EnumSet<Flag> getFlags() {
+        return flags;
+    }
+
+    @Override
+    public boolean canStoreValue(RegisterCategory category, PlatformKind platformKind) {
+        if (!(platformKind instanceof Kind)) {
+            return false;
+        }
+
+        Kind kind = (Kind) platformKind;
+        if (category.equals(CPU)) {
+            switch (kind) {
+                case Boolean:
+                case Byte:
+                case Char:
+                case Short:
+                case Int:
+                case Long:
+                case Object:
+                    return true;
+            }
+        } else if (category.equals(XMM)) {
+            switch (kind) {
+                case Float:
+                case Double:
+                    return true;
+            }
+        }
+
+        return false;
+    }
+
+    @Override
+    public PlatformKind getLargestStorableKind(RegisterCategory category) {
+        if (category.equals(CPU)) {
+            return Kind.Long;
+        } else if (category.equals(XMM)) {
+            return Kind.Double;
+        } else {
+            return Kind.Illegal;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.code/overview.html	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/AbstractAddress.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/Architecture.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ArithmeticOperation.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BailoutException.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BytecodeFrame.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BytecodePosition.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CalleeSaveLayout.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CallingConvention.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeCacheProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,105 @@
+/*
+ * 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.code.CompilationResult.Call;
+import com.oracle.jvmci.code.CompilationResult.DataPatch;
+import com.oracle.jvmci.code.CompilationResult.Mark;
+import com.oracle.jvmci.code.DataSection.Data;
+import com.oracle.jvmci.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);
+
+    /**
+     * Gets a name for a {@link Mark} mark.
+     */
+    default String getMarkName(Mark mark) {
+        return String.valueOf(mark.id);
+    }
+
+    /**
+     * Gets a name for the {@linkplain Call#target target} of a {@link Call}.
+     */
+    default String getTargetName(Call call) {
+        return String.valueOf(call.target);
+    }
+
+    /**
+     * 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeUtil.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,474 @@
+/*
+ * 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) {
+            sb.append(refMap.toString());
+        }
+        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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CompilationResult.java	Tue Jun 09 19:07:39 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.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;
+
+    private int bytecodeSize;
+
+    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 void setBytecodeSize(int bytecodeSize) {
+        this.bytecodeSize = bytecodeSize;
+    }
+
+    public int getBytecodeSize() {
+        return bytecodeSize;
+    }
+
+    public DataSection getDataSection() {
+        return dataSection;
+    }
+
+    /**
+     * The total frame size of the method in bytes. This includes the return address pushed onto the
+     * stack, if any.
+     *
+     * @return the frame size
+     */
+    public int getTotalFrameSize() {
+        assert totalFrameSize != -1 : "frame size not yet initialized!";
+        return totalFrameSize;
+    }
+
+    /**
+     * Sets the total frame size in bytes. This includes the return address pushed onto the stack,
+     * if any.
+     *
+     * @param size the size of the frame in bytes
+     */
+    public void setTotalFrameSize(int size) {
+        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) {
+                sb.append(refMap.toString());
+                sb.append(']');
+            }
+            RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
+            if (calleeSaveInfo != null) {
+                sb.append(" callee-save-info[");
+                String sep = "";
+                for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
+                    sb.append(sep).append(e.getKey()).append("->").append(e.getValue());
+                    sep = ", ";
+                }
+                sb.append(']');
+            }
+            BytecodePosition codePos = info.getBytecodePosition();
+            if (codePos != null) {
+                MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI());
+                if (info.hasFrame()) {
+                    sb.append(" #locals=").append(info.frame().numLocals).append(" #expr=").append(info.frame().numStack);
+                    if (info.frame().numLocks > 0) {
+                        sb.append(" #locks=").append(info.frame().numLocks);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * @return the list of infopoints, sorted by {@link Site#pcOffset}
+     */
+    public List<Infopoint> getInfopoints() {
+        if (infopoints.isEmpty()) {
+            return emptyList();
+        }
+        return unmodifiableList(infopoints);
+    }
+
+    /**
+     * @return the list of data references
+     */
+    public List<DataPatch> getDataPatches() {
+        if (dataPatches.isEmpty()) {
+            return emptyList();
+        }
+        return unmodifiableList(dataPatches);
+    }
+
+    /**
+     * @return the list of exception handlers
+     */
+    public List<ExceptionHandler> getExceptionHandlers() {
+        if (exceptionHandlers.isEmpty()) {
+            return emptyList();
+        }
+        return unmodifiableList(exceptionHandlers);
+    }
+
+    /**
+     * @return the list of marks
+     */
+    public List<Mark> getMarks() {
+        if (marks.isEmpty()) {
+            return emptyList();
+        }
+        return unmodifiableList(marks);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/DataSection.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/DebugInfo.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ForeignCallLinkage.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ForeignCallsProvider.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InfopointReason.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InstalledCode.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InvalidInstalledCodeException.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/MemoryBarriers.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ReferenceMap.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * 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.*;
+
+public abstract class ReferenceMap {
+
+    /**
+     * Empty out the reference map.
+     */
+    public abstract void reset();
+
+    /**
+     * Add {@code value} to the current set of reference values.
+     *
+     * @param v
+     */
+    public abstract void addLiveValue(Value v);
+
+    /**
+     * Perform any final encoding needed before use.
+     */
+    public abstract void finish();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/Register.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterAttributes.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterConfig.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterSaveLayout.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/SourceStackTrace.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackLockValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackSlot.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackSlotValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/TargetDescription.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/TypeCheckHints.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/UnsignedMath.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ValueUtil.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/VirtualObject.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/VirtualStackSlot.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/package-info.java	Tue Jun 09 19:07:39 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, com.oracle.jvmci.meta.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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/InspectedFrame.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/InspectedFrameVisitor.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/StackIntrospection.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.common/src/com/oracle/jvmci/common/JVMCIError.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.common/src/com/oracle/jvmci/common/UnsafeAccess.java	Tue Jun 09 19:07:39 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 JVMCI.
+     */
+    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/jvmci/com.oracle.jvmci.compiler/src/com/oracle/jvmci/compiler/Compiler.java	Tue Jun 09 19:07:39 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.compiler;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.service.*;
+
+public interface Compiler extends Service {
+    int INVOCATION_ENTRY_BCI = -1;
+
+    @Option(help = "", type = OptionType.Debug) OptionValue<String> PrintFilter = new OptionValue<>(null);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintCompilation = new OptionValue<>(false);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintAfterCompilation = new OptionValue<>(false);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintBailout = new OptionValue<>(false);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> ExitVMOnBailout = new OptionValue<>(false);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> ExitVMOnException = new OptionValue<>(true);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintStackTraceOnException = new OptionValue<>(false);
+
+    CompilationResult compile(ResolvedJavaMethod method, int entryBCI, boolean mustRecordMethodInlining);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.compiler/src/com/oracle/jvmci/compiler/CompilerThread.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,61 @@
+/*
+ * 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.compiler;
+
+import com.oracle.jvmci.compiler.CompilerThreadFactory.*;
+import com.oracle.jvmci.debug.*;
+
+/**
+ * A compiler thread is a daemon thread that runs at {@link Thread#MAX_PRIORITY} and executes in the
+ * context of a thread-local {@linkplain JVMCIDebugConfig debug configuration}.
+ */
+public class CompilerThread extends Thread {
+
+    private final DebugConfigAccess debugConfigAccess;
+
+    public CompilerThread(Runnable r, String namePrefix, DebugConfigAccess debugConfigAccess) {
+        super(r);
+        this.setName(namePrefix + "-" + this.getId());
+        this.setPriority(Thread.MAX_PRIORITY);
+        this.setDaemon(true);
+        this.debugConfigAccess = debugConfigAccess;
+    }
+
+    @Override
+    public void run() {
+        JVMCIDebugConfig debugConfig = debugConfigAccess.getDebugConfig();
+        setContextClassLoader(getClass().getClassLoader());
+        try {
+            super.run();
+        } finally {
+            if (debugConfig != null) {
+                for (DebugDumpHandler dumpHandler : debugConfig.dumpHandlers()) {
+                    try {
+                        dumpHandler.close();
+                    } catch (Throwable t) {
+                    }
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.compiler/src/com/oracle/jvmci/compiler/CompilerThreadFactory.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,56 @@
+/*
+ * 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.compiler;
+
+import java.util.concurrent.*;
+
+import com.oracle.jvmci.debug.*;
+
+/**
+ * Facility for creating {@linkplain CompilerThread compiler threads}.
+ */
+public class CompilerThreadFactory implements ThreadFactory {
+
+    /**
+     * Capability to get a thread-local debug configuration for the current thread.
+     */
+    public interface DebugConfigAccess {
+        /**
+         * Get a thread-local debug configuration for the current thread. This will be null if
+         * debugging is {@linkplain Debug#isEnabled() disabled}.
+         */
+        JVMCIDebugConfig getDebugConfig();
+    }
+
+    protected final String threadNamePrefix;
+    protected final DebugConfigAccess debugConfigAccess;
+
+    public CompilerThreadFactory(String threadNamePrefix, DebugConfigAccess debugConfigAccess) {
+        this.threadNamePrefix = threadNamePrefix;
+        this.debugConfigAccess = debugConfigAccess;
+    }
+
+    public Thread newThread(Runnable r) {
+        return new CompilerThread(r, threadNamePrefix, debugConfigAccess);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.debug.test/src/com/oracle/jvmci/debug/test/DebugHistogramTest.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug.test/src/com/oracle/jvmci/debug/test/DebugTimerTest.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/overview.html	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/AnsiColor.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Debug.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,1551 @@
+/*
+ * 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.*;
+import com.oracle.jvmci.service.*;
+
+/**
+ * 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 {
+
+    static {
+        for (DebugInitializationPropertyProvider p : Services.load(DebugInitializationPropertyProvider.class)) {
+            p.apply();
+        }
+    }
+
+    /**
+     * 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugCloseable.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugConfig.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugConfigCustomizer.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,29 @@
+/*
+ * 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 com.oracle.jvmci.service.*;
+
+public interface DebugConfigCustomizer extends Service {
+    void customize(DebugConfig config);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugConfigScope.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugDumpHandler.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugDumpScope.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugEnvironment.java	Tue Jun 09 19:07:39 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.debug;
+
+import static com.oracle.jvmci.debug.JVMCIDebugConfig.*;
+
+import java.io.*;
+import java.util.*;
+
+import com.oracle.jvmci.service.*;
+
+public class DebugEnvironment {
+
+    public static JVMCIDebugConfig initialize(PrintStream log) {
+
+        if (!Debug.isEnabled()) {
+            log.println("WARNING: Scope debugging needs to be enabled with -esa or -D" + Debug.Initialization.INITIALIZER_PROPERTY_NAME + "=true");
+            return null;
+        }
+        List<DebugDumpHandler> dumpHandlers = new ArrayList<>();
+        List<DebugVerifyHandler> verifyHandlers = new ArrayList<>();
+        JVMCIDebugConfig debugConfig = new JVMCIDebugConfig(Log.getValue(), Meter.getValue(), TrackMemUse.getValue(), Time.getValue(), Dump.getValue(), Verify.getValue(), MethodFilter.getValue(),
+                        log, dumpHandlers, verifyHandlers);
+
+        for (DebugConfigCustomizer customizer : Services.load(DebugConfigCustomizer.class)) {
+            customizer.customize(debugConfig);
+        }
+
+        Debug.setConfig(debugConfig);
+        return debugConfig;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugFilter.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,185 @@
+/*
+ * 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.*;
+import java.util.regex.*;
+
+import com.oracle.jvmci.debug.internal.*;
+
+/**
+ * Implements the filter specified by the {@link JVMCIDebugConfig#Dump},
+ * {@link JVMCIDebugConfig#Log}, {@link JVMCIDebugConfig#Meter} and {@link JVMCIDebugConfig#Time}
+ * options.
+ * <p>
+ * These options enable the associated debug facility if their filter matches the
+ * {@linkplain DebugScope#getQualifiedName() name} of the {@linkplain Debug#currentScope() current
+ * scope}. For the {@link JVMCIDebugConfig#Dump} and {@link JVMCIDebugConfig#Log} options, the log
+ * or dump level is set. The {@link JVMCIDebugConfig#Meter} and {@link JVMCIDebugConfig#Time}
+ * options don't have a level, for them {@code level = 0} means disabled and a {@code level > 0}
+ * means enabled.
+ * <p>
+ * A filter is a list of comma-separated terms of the form {@code <pattern>[:<level>]}.
+ * {@code <pattern>} is interpreted as a glob pattern if it contains a "*" or "?" character.
+ * Otherwise, it is interpreted as a substring. If {@code <pattern>} is empty, it matches every
+ * scope. If {@code :<level>} is omitted, it defaults to {@link Debug#DEFAULT_LOG_LEVEL}. The term
+ * {@code ~<pattern>} is a shorthand for {@code <pattern>:0} to disable a debug facility for a
+ * pattern.
+ * <p>
+ * The resulting log level of a scope is determined by the <em>last</em> matching term. If no term
+ * matches, the log level is 0 (disabled). A filter with no terms matches every scope with a log
+ * level of {@link Debug#DEFAULT_LOG_LEVEL}.
+ *
+ * <h2>Examples of filters</h2>
+ *
+ * <ul>
+ * <li>(empty string)<br>
+ * Matches any scope with log level {@link Debug#DEFAULT_LOG_LEVEL}.
+ *
+ * <li> {@code :1}<br>
+ * Matches any scope with log level 1.
+ *
+ * <li> {@code *}<br>
+ * Matches any scope with log level {@link Debug#DEFAULT_LOG_LEVEL}.
+ *
+ * <li> {@code CodeGen,CodeInstall}<br>
+ * Matches scopes containing "CodeGen" or "CodeInstall", both with log level
+ * {@link Debug#DEFAULT_LOG_LEVEL}.
+ *
+ * <li> {@code CodeGen:2,CodeInstall:1}<br>
+ * Matches scopes containing "CodeGen" with log level 2, or "CodeInstall" with log level 1.
+ *
+ * <li> {@code :1,Dead:2}<br>
+ * Matches scopes containing "Dead" with log level 2, and all other scopes with log level 1.
+ *
+ * <li> {@code :1,Dead:0}<br>
+ * Matches all scopes with log level 1, except those containing "Dead".
+ *
+ * <li> {@code Code*}<br>
+ * Matches scopes starting with "Code" with log level {@link Debug#DEFAULT_LOG_LEVEL}.
+ *
+ * <li> {@code Code,~Dead}<br>
+ * Matches scopes containing "Code" but not "Dead", with log level {@link Debug#DEFAULT_LOG_LEVEL}.
+ * </ul>
+ */
+final class DebugFilter {
+
+    public static DebugFilter parse(String spec) {
+        if (spec == null) {
+            return null;
+        }
+        return new DebugFilter(spec.split(","));
+    }
+
+    private final Term[] terms;
+
+    private DebugFilter(String[] terms) {
+        if (terms.length == 0) {
+            this.terms = null;
+        } else {
+            this.terms = new Term[terms.length];
+            for (int i = 0; i < terms.length; i++) {
+                String t = terms[i];
+                int idx = t.indexOf(':');
+
+                String pattern;
+                int level;
+                if (idx < 0) {
+                    if (t.startsWith("~")) {
+                        pattern = t.substring(1);
+                        level = 0;
+                    } else {
+                        pattern = t;
+                        level = Debug.DEFAULT_LOG_LEVEL;
+                    }
+                } else {
+                    pattern = t.substring(0, idx);
+                    if (idx + 1 < t.length()) {
+                        level = Integer.parseInt(t.substring(idx + 1));
+                    } else {
+                        level = Debug.DEFAULT_LOG_LEVEL;
+                    }
+                }
+
+                this.terms[i] = new Term(pattern, level);
+            }
+        }
+    }
+
+    /**
+     * Check whether a given input is matched by this filter, and determine the log level.
+     */
+    public int matchLevel(String input) {
+        if (terms == null) {
+            return Debug.DEFAULT_LOG_LEVEL;
+        } else {
+            int level = 0;
+            for (Term t : terms) {
+                if (t.matches(input)) {
+                    level = t.level;
+                }
+            }
+            return level;
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("DebugFilter");
+        if (terms != null) {
+            buf.append(Arrays.toString(terms));
+        } else {
+            buf.append("[]");
+        }
+        return buf.toString();
+    }
+
+    private static class Term {
+
+        private final Pattern pattern;
+        public final int level;
+
+        public Term(String filter, int level) {
+            this.level = level;
+            if (filter.isEmpty()) {
+                this.pattern = null;
+            } else if (filter.contains("*") || filter.contains("?")) {
+                this.pattern = Pattern.compile(MethodFilter.createGlobString(filter));
+            } else {
+                this.pattern = Pattern.compile(".*" + MethodFilter.createGlobString(filter) + ".*");
+            }
+        }
+
+        /**
+         * Determines if a given input is matched by this filter.
+         */
+        public boolean matches(String input) {
+            return pattern == null || pattern.matcher(input).matches();
+        }
+
+        @Override
+        public String toString() {
+            return (pattern == null ? ".*" : pattern.toString()) + ":" + level;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugHistogram.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugInitializationPropertyProvider.java	Tue Jun 09 19:07:39 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;
+
+import com.oracle.jvmci.service.*;
+
+/**
+ * Sets one or more system properties used during initialization of the {@link Debug} class.
+ */
+public interface DebugInitializationPropertyProvider extends Service {
+    void apply();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugMemUseTracker.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugMetric.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugTimer.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugVerifyHandler.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DelegatingDebugConfig.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Fingerprint.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Indent.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/JVMCIDebugConfig.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,303 @@
+/*
+ * 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.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+
+public class JVMCIDebugConfig implements DebugConfig {
+    @SuppressWarnings("all")
+    private static boolean assertionsEnabled() {
+        boolean assertionsEnabled = false;
+        assert assertionsEnabled = true;
+        return assertionsEnabled;
+    }
+
+    // @formatter:off
+    @Option(help = "Pattern for scope(s) in which dumping is enabled (see DebugFilter and Debug.dump)", type = OptionType.Debug)
+    public static final OptionValue<String> Dump = new OptionValue<>(null);
+    @Option(help = "Pattern for scope(s) in which metering is enabled (see DebugFilter and Debug.metric). " +
+                   "An empty value enables all metrics unconditionally.", type = OptionType.Debug)
+    public static final OptionValue<String> Meter = new OptionValue<>(null);
+    @Option(help = "Pattern for scope(s) in which verification is enabled (see DebugFilter and Debug.verify).", type = OptionType.Debug)
+    public static final OptionValue<String> Verify = new OptionValue<String>() {
+        @Override
+        protected String defaultValue() {
+            return assertionsEnabled() ? "" : null;
+        }
+    };
+    @Option(help = "Pattern for scope(s) in which memory use tracking is enabled (see DebugFilter and Debug.metric). " +
+                   "An empty value enables all memory use trackers unconditionally.", type = OptionType.Debug)
+    public static final OptionValue<String> TrackMemUse = new OptionValue<>(null);
+    @Option(help = "Pattern for scope(s) in which timing is enabled (see DebugFilter and Debug.timer). " +
+                   "An empty value enables all timers unconditionally.", type = OptionType.Debug)
+    public static final OptionValue<String> Time = new OptionValue<>(null);
+    @Option(help = "Pattern for scope(s) in which logging is enabled (see DebugFilter and Debug.log)", type = OptionType.Debug)
+    public static final OptionValue<String> Log = new OptionValue<>(null);
+    @Option(help = "Pattern for filtering debug scope output based on method context (see MethodFilter)", type = OptionType.Debug)
+    public static final OptionValue<String> MethodFilter = new OptionValue<>(null);
+    @Option(help = "Only check MethodFilter against the root method in the context if true, otherwise check all methods", type = OptionType.Debug)
+    public static final OptionValue<Boolean> MethodFilterRootOnly = new OptionValue<>(false);
+
+    @Option(help = "How to print metric and timing values:%n" +
+                   "Name - aggregate by unqualified name%n" +
+                   "Partial - aggregate by partially qualified name (e.g., A.B.C.D.Counter and X.Y.Z.D.Counter will be merged to D.Counter)%n" +
+                   "Complete - aggregate by qualified name%n" +
+                   "Thread - aggregate by qualified name and thread", type = OptionType.Debug)
+    public static final OptionValue<String> DebugValueSummary = new OptionValue<>("Name");
+    @Option(help = "Omit reporting 0-value metrics", type = OptionType.Debug)
+    public static final OptionValue<Boolean> SuppressZeroDebugValues = new OptionValue<>(true);
+    @Option(help = "Only report debug values for maps which match the regular expression.", type = OptionType.Debug)
+    public static final OptionValue<String> DebugValueThreadFilter = new OptionValue<>(null);
+    @Option(help = "Send JVMCI compiler IR to dump handlers on error", type = OptionType.Debug)
+    public static final OptionValue<Boolean> DumpOnError = new OptionValue<>(false);
+    @Option(help = "Intercept also bailout exceptions", type = OptionType.Debug)
+    public static final OptionValue<Boolean> InterceptBailout = new OptionValue<>(false);
+    @Option(help = "Enable more verbose log output when available", type = OptionType.Debug)
+    public static final OptionValue<Boolean> LogVerbose = new OptionValue<>(false);
+    // @formatter:on
+
+    static boolean isNotEmpty(OptionValue<String> option) {
+        return option.getValue() != null && !option.getValue().isEmpty();
+    }
+
+    public static boolean areDebugScopePatternsEnabled() {
+        return DumpOnError.getValue() || Dump.getValue() != null || Log.getValue() != null || areScopedMetricsOrTimersEnabled();
+    }
+
+    /**
+     * Determines if any of {@link #Meter}, {@link #Time} or {@link #TrackMemUse} has a non-null,
+     * non-empty value.
+     */
+    public static boolean areScopedMetricsOrTimersEnabled() {
+        return isNotEmpty(Meter) || isNotEmpty(Time) || isNotEmpty(TrackMemUse);
+    }
+
+    private final DebugFilter logFilter;
+    private final DebugFilter meterFilter;
+    private final DebugFilter trackMemUseFilter;
+    private final DebugFilter timerFilter;
+    private final DebugFilter dumpFilter;
+    private final DebugFilter verifyFilter;
+    private final MethodFilter[] methodFilter;
+    private final List<DebugDumpHandler> dumpHandlers;
+    private final List<DebugVerifyHandler> verifyHandlers;
+    private final PrintStream output;
+    private final Set<Object> extraFilters = new HashSet<>();
+
+    public JVMCIDebugConfig(String logFilter, String meterFilter, String trackMemUseFilter, String timerFilter, String dumpFilter, String verifyFilter, String methodFilter, PrintStream output,
+                    List<DebugDumpHandler> dumpHandlers, List<DebugVerifyHandler> verifyHandlers) {
+        this.logFilter = DebugFilter.parse(logFilter);
+        this.meterFilter = DebugFilter.parse(meterFilter);
+        this.trackMemUseFilter = DebugFilter.parse(trackMemUseFilter);
+        this.timerFilter = DebugFilter.parse(timerFilter);
+        this.dumpFilter = DebugFilter.parse(dumpFilter);
+        this.verifyFilter = DebugFilter.parse(verifyFilter);
+        if (methodFilter == null || methodFilter.isEmpty()) {
+            this.methodFilter = null;
+        } else {
+            this.methodFilter = com.oracle.jvmci.debug.MethodFilter.parse(methodFilter);
+        }
+
+        // Report the filters that have been configured so the user can verify it's what they expect
+        if (logFilter != null || meterFilter != null || timerFilter != null || dumpFilter != null || methodFilter != null) {
+            // TTY.println(Thread.currentThread().getName() + ": " + toString());
+        }
+        this.dumpHandlers = dumpHandlers;
+        this.verifyHandlers = verifyHandlers;
+        this.output = output;
+    }
+
+    public int getLogLevel() {
+        return getLevel(logFilter);
+    }
+
+    public boolean isLogEnabledForMethod() {
+        return isEnabledForMethod(logFilter);
+    }
+
+    public boolean isMeterEnabled() {
+        return isEnabled(meterFilter);
+    }
+
+    public boolean isMemUseTrackingEnabled() {
+        return isEnabled(trackMemUseFilter);
+    }
+
+    public int getDumpLevel() {
+        return getLevel(dumpFilter);
+    }
+
+    public boolean isDumpEnabledForMethod() {
+        return isEnabledForMethod(dumpFilter);
+    }
+
+    public boolean isVerifyEnabled() {
+        return isEnabled(verifyFilter);
+    }
+
+    public boolean isVerifyEnabledForMethod() {
+        return isEnabledForMethod(verifyFilter);
+    }
+
+    public boolean isTimeEnabled() {
+        return isEnabled(timerFilter);
+    }
+
+    public PrintStream output() {
+        return output;
+    }
+
+    private boolean isEnabled(DebugFilter filter) {
+        return getLevel(filter) > 0;
+    }
+
+    private int getLevel(DebugFilter filter) {
+        int level;
+        if (filter == null) {
+            level = 0;
+        } else {
+            level = filter.matchLevel(Debug.currentScope());
+        }
+        if (level > 0 && !checkMethodFilter()) {
+            level = 0;
+        }
+        return level;
+    }
+
+    private boolean isEnabledForMethod(DebugFilter filter) {
+        return filter != null && checkMethodFilter();
+    }
+
+    /**
+     * Extracts a {@link JavaMethod} from an opaque debug context.
+     *
+     * @return the {@link JavaMethod} represented by {@code context} or null
+     */
+    public static JavaMethod asJavaMethod(Object context) {
+        if (context instanceof JavaMethodContex) {
+            return ((JavaMethodContex) context).asJavaMethod();
+        }
+        return null;
+    }
+
+    private boolean checkMethodFilter() {
+        if (methodFilter == null && extraFilters.isEmpty()) {
+            return true;
+        } else {
+            JavaMethod lastMethod = null;
+            for (Object o : Debug.context()) {
+                if (extraFilters.contains(o)) {
+                    return true;
+                } else if (methodFilter != null) {
+                    JavaMethod method = asJavaMethod(o);
+                    if (method != null) {
+                        if (!MethodFilterRootOnly.getValue()) {
+                            if (com.oracle.jvmci.debug.MethodFilter.matches(methodFilter, method)) {
+                                return true;
+                            }
+                        } else {
+                            /*
+                             * The context values operate as a stack so if we want MethodFilter to
+                             * only apply to the root method we have to check only the last method
+                             * seen.
+                             */
+                            lastMethod = method;
+                        }
+                    }
+                }
+            }
+            if (lastMethod != null && com.oracle.jvmci.debug.MethodFilter.matches(methodFilter, lastMethod)) {
+                return true;
+            }
+            return false;
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("Debug config:");
+        add(sb, "Log", logFilter);
+        add(sb, "Meter", meterFilter);
+        add(sb, "Time", timerFilter);
+        add(sb, "Dump", dumpFilter);
+        add(sb, "MethodFilter", methodFilter);
+        return sb.toString();
+    }
+
+    private static void add(StringBuilder sb, String name, Object filter) {
+        if (filter != null) {
+            sb.append(' ');
+            sb.append(name);
+            sb.append('=');
+            if (filter instanceof Object[]) {
+                sb.append(Arrays.toString((Object[]) filter));
+            } else {
+                sb.append(String.valueOf(filter));
+            }
+        }
+    }
+
+    @Override
+    public RuntimeException interceptException(Throwable e) {
+        if (e instanceof BailoutException && !InterceptBailout.getValue()) {
+            return null;
+        }
+        Debug.setConfig(Debug.fixedConfig(Debug.DEFAULT_LOG_LEVEL, Debug.DEFAULT_LOG_LEVEL, false, false, false, false, dumpHandlers, verifyHandlers, output));
+        Debug.log(String.format("Exception occurred in scope: %s", Debug.currentScope()));
+        for (Object o : Debug.context()) {
+            if (DumpOnError.getValue()) {
+                Debug.dump(o, "Exception");
+            } else {
+                Debug.log("Context obj %s", o);
+            }
+
+        }
+        return null;
+    }
+
+    @Override
+    public Collection<DebugDumpHandler> dumpHandlers() {
+        return dumpHandlers;
+    }
+
+    @Override
+    public Collection<DebugVerifyHandler> verifyHandlers() {
+        return verifyHandlers;
+    }
+
+    @Override
+    public void addToContext(Object o) {
+        extraFilters.add(o);
+    }
+
+    @Override
+    public void removeFromContext(Object o) {
+        extraFilters.remove(o);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/JavaMethodContex.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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 com.oracle.jvmci.meta.*;
+
+/**
+ * Interface for objects used in Debug {@linkplain Debug#context() context} that can provide a
+ * {@link JavaMethod}.
+ */
+public interface JavaMethodContex {
+    JavaMethod asJavaMethod();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/LogStream.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/MethodFilter.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,231 @@
+/*
+ * 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.meta.JavaType;
+import com.oracle.jvmci.meta.JavaMethod;
+import com.oracle.jvmci.meta.Signature;
+import java.util.*;
+import java.util.regex.*;
+
+/**
+ * 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:
+ *
+ * <pre>
+ * SourcePatterns = SourcePattern ["," SourcePatterns] .
+ * SourcePattern = [ Class "." ] method [ "(" [ Parameter { ";" Parameter } ] ")" ] .
+ * Parameter = Class | "int" | "long" | "float" | "double" | "short" | "char" | "boolean" .
+ * Class = { package "." } class .
+ * </pre>
+ *
+ *
+ * Glob pattern matching (*, ?) is allowed in all parts of the source pattern. Examples for valid
+ * filters are:
+ *
+ * <ul>
+ * <li>
+ *
+ * <pre>
+ * visit(Argument;BlockScope)
+ * </pre>
+ *
+ * Matches all methods named "visit", with the first parameter of type "Argument", and the second
+ * parameter of type "BlockScope". The packages of the parameter types are irrelevant.</li>
+ * <li>
+ *
+ * <pre>
+ * arraycopy(Object;;;;)
+ * </pre>
+ *
+ * Matches all methods named "arraycopy", with the first parameter of type "Object", and four more
+ * parameters of any type. The packages of the parameter types are irrelevant.</li>
+ * <li>
+ *
+ * <pre>
+ * com.oracle.graal.compiler.graph.PostOrderNodeIterator.*
+ * </pre>
+ *
+ * Matches all methods in the class "com.oracle.graal.compiler.graph.PostOrderNodeIterator".</li>
+ * <li>
+ *
+ * <pre>
+ * *
+ * </pre>
+ *
+ * Matches all methods in all classes</li>
+ * <li>
+ *
+ * <pre>
+ * com.oracle.graal.compiler.graph.*.visit
+ * </pre>
+ *
+ * Matches all methods named "visit" in classes in the package "com.oracle.graal.compiler.graph".
+ * <li>
+ *
+ * <pre>
+ * arraycopy,toString
+ * </pre>
+ *
+ * Matches all methods named "arraycopy" or "toString", meaning that ',' acts as an <i>or</i>
+ * operator.</li>
+ * </ul>
+ */
+public class MethodFilter {
+
+    private final Pattern clazz;
+    private final Pattern methodName;
+    private final Pattern[] signature;
+
+    /**
+     * Parses a string containing list of comma separated filter patterns into an array of
+     * {@link MethodFilter}s.
+     */
+    public static MethodFilter[] parse(String commaSeparatedPatterns) {
+        String[] filters = commaSeparatedPatterns.split(",");
+        MethodFilter[] methodFilters = new MethodFilter[filters.length];
+        for (int i = 0; i < filters.length; i++) {
+            methodFilters[i] = new MethodFilter(filters[i]);
+        }
+        return methodFilters;
+    }
+
+    /**
+     * Determines if a given method is matched by a given array of filters.
+     */
+    public static boolean matches(MethodFilter[] filters, JavaMethod method) {
+        for (MethodFilter filter : filters) {
+            if (filter.matches(method)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Determines if a given class name is matched by a given array of filters.
+     */
+    public static boolean matchesClassName(MethodFilter[] filters, String className) {
+        for (MethodFilter filter : filters) {
+            if (filter.matchesClassName(className)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public MethodFilter(String sourcePattern) {
+        String pattern = sourcePattern.trim();
+
+        // extract parameter part
+        int pos = pattern.indexOf('(');
+        if (pos != -1) {
+            if (pattern.charAt(pattern.length() - 1) != ')') {
+                throw new IllegalArgumentException("missing ')' at end of method filter pattern: " + pattern);
+            }
+            String[] signatureClasses = pattern.substring(pos + 1, pattern.length() - 1).split(";", -1);
+            signature = new Pattern[signatureClasses.length];
+            for (int i = 0; i < signatureClasses.length; i++) {
+                signature[i] = createClassGlobPattern(signatureClasses[i].trim());
+            }
+            pattern = pattern.substring(0, pos);
+        } else {
+            signature = null;
+        }
+
+        // If there is at least one "." then everything before the last "." is the class name.
+        // Otherwise, the pattern contains only the method name.
+        pos = pattern.lastIndexOf('.');
+        if (pos != -1) {
+            clazz = createClassGlobPattern(pattern.substring(0, pos));
+            methodName = Pattern.compile(createGlobString(pattern.substring(pos + 1)));
+        } else {
+            clazz = null;
+            methodName = Pattern.compile(createGlobString(pattern));
+        }
+    }
+
+    static String createGlobString(String pattern) {
+        return Pattern.quote(pattern).replace("?", "\\E.\\Q").replace("*", "\\E.*\\Q");
+    }
+
+    private static Pattern createClassGlobPattern(String pattern) {
+        if (pattern.length() == 0) {
+            return null;
+        } else if (pattern.contains(".")) {
+            return Pattern.compile(createGlobString(pattern));
+        } else {
+            return Pattern.compile("([^\\.\\$]*[\\.\\$])*" + createGlobString(pattern));
+        }
+    }
+
+    /**
+     * Determines if the class part of this filter matches a given class name.
+     */
+    public boolean matchesClassName(String className) {
+        return clazz == null || clazz.matcher(className).matches();
+    }
+
+    public boolean matches(JavaMethod o) {
+        // check method name first, since MetaUtil.toJavaName is expensive
+        if (methodName != null && !methodName.matcher(o.getName()).matches()) {
+            return false;
+        }
+        if (clazz != null && !clazz.matcher(o.getDeclaringClass().toJavaName()).matches()) {
+            return false;
+        }
+        if (signature != null) {
+            Signature sig = o.getSignature();
+            if (sig.getParameterCount(false) != signature.length) {
+                return false;
+            }
+            for (int i = 0; i < signature.length; i++) {
+                JavaType type = sig.getParameterType(i, null);
+                String javaName = type.toJavaName();
+                if (signature[i] != null && !signature[i].matcher(javaName).matches()) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("MethodFilter[");
+        String sep = "";
+        if (clazz != null) {
+            buf.append(sep).append("clazz=").append(clazz);
+            sep = ", ";
+        }
+        if (methodName != null) {
+            buf.append(sep).append("methodName=").append(methodName);
+            sep = ", ";
+        }
+        if (signature != null) {
+            buf.append(sep).append("signature=").append(Arrays.toString(signature));
+            sep = ", ";
+        }
+        return buf.append("]").toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TTY.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,302 @@
+/*
+ * 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.*;
+
+import com.oracle.jvmci.service.*;
+
+/**
+ * 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();
+                    log.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();
+            log.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) {
+                log.set(previous);
+            }
+        }
+    }
+
+    /**
+     * The {@link PrintStream} to which all non-suppressed output from {@link TTY} is written.
+     */
+    public static final PrintStream out;
+    static {
+        TTYStreamProvider p = Services.loadSingle(TTYStreamProvider.class, false);
+        out = p == null ? System.out : p.getStream();
+    }
+
+    private static final ThreadLocal<LogStream> log = new ThreadLocal<LogStream>() {
+
+        @Override
+        protected LogStream initialValue() {
+            return new LogStream(out);
+        }
+    };
+
+    public static boolean isSuppressed() {
+        return log.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 log.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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TTYStreamProvider.java	Tue Jun 09 19:07:39 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.debug;
+
+import java.io.*;
+
+import com.oracle.jvmci.service.*;
+
+/**
+ * Provides a {@link PrintStream} that writes to the underlying log stream of the VM.
+ */
+public interface TTYStreamProvider extends Service {
+    PrintStream getStream();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TopLevelDebugConfig.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/AccumulatedDebugValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/CloseableCounterImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramAsciiPrinter.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramRPrinter.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugScope.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,487 @@
+/*
+ * 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;
+        }
+
+        this.output = TTY.out;
+        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.out;
+        } 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugValueMap.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/KeyRegistry.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/MemUseTrackerImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/MetricImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/TimerImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot.amd64/src/com/oracle/jvmci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,169 @@
+/*
+ * 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.hotspot.amd64;
+
+import static com.oracle.jvmci.hotspot.InitTimer.*;
+
+import java.util.*;
+
+import com.oracle.jvmci.amd64.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.runtime.*;
+import com.oracle.jvmci.service.*;
+
+@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 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";
+    }
+
+    @Override
+    public String toString() {
+        return getJVMCIRuntimeName() + ":" + 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";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot.amd64/src/com/oracle/jvmci/hotspot/amd64/AMD64HotSpotRegisterConfig.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,268 @@
+/*
+ * 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.hotspot.amd64;
+
+import com.oracle.jvmci.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.jvmci.amd64.AMD64.*;
+
+import java.util.*;
+
+import com.oracle.jvmci.code.CallingConvention.Type;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
+
+public class AMD64HotSpotRegisterConfig implements RegisterConfig {
+
+    private final Architecture architecture;
+
+    private final Register[] allocatable;
+
+    private final int maxFrameSize;
+
+    /**
+     * The caller saved registers always include all parameter registers.
+     */
+    private final Register[] callerSaved;
+
+    private final boolean allAllocatableAreCallerSaved;
+
+    private final RegisterAttributes[] attributesMap;
+
+    public int getMaximumFrameSize() {
+        return maxFrameSize;
+    }
+
+    @Override
+    public Register[] getAllocatableRegisters() {
+        return allocatable.clone();
+    }
+
+    public Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers) {
+        ArrayList<Register> list = new ArrayList<>();
+        for (Register reg : registers) {
+            if (architecture.canStoreValue(reg.getRegisterCategory(), kind)) {
+                list.add(reg);
+            }
+        }
+
+        Register[] ret = list.toArray(new Register[list.size()]);
+        return ret;
+    }
+
+    @Override
+    public RegisterAttributes[] getAttributesMap() {
+        return attributesMap.clone();
+    }
+
+    private final Register[] javaGeneralParameterRegisters;
+    private final Register[] nativeGeneralParameterRegisters;
+    private final Register[] xmmParameterRegisters = {xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7};
+
+    /*
+     * Some ABIs (e.g. Windows) require a so-called "home space", that is a save area on the stack
+     * to store the argument registers
+     */
+    private final boolean needsNativeStackHomeSpace;
+
+    private final CalleeSaveLayout csl;
+
+    private static Register[] initAllocatable(boolean reserveForHeapBase) {
+        Register[] registers = null;
+        // @formatter:off
+        if (reserveForHeapBase) {
+            registers = new Register[] {
+                        rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9,  r10, r11, /*r12,*/ r13, r14, /*r15, */
+                        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
+                        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
+                      };
+        } else {
+            registers = new Register[] {
+                        rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9,  r10, r11, r12, r13, r14, /*r15, */
+                        xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
+                        xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
+                      };
+        }
+       // @formatter:on
+        return registers;
+    }
+
+    public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config) {
+        this(architecture, config, initAllocatable(config.useCompressedOops));
+        assert callerSaved.length >= allocatable.length;
+    }
+
+    public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config, Register[] allocatable) {
+        this.architecture = architecture;
+        this.maxFrameSize = config.maxFrameSize;
+
+        if (config.windowsOs) {
+            javaGeneralParameterRegisters = new Register[]{rdx, r8, r9, rdi, rsi, rcx};
+            nativeGeneralParameterRegisters = new Register[]{rcx, rdx, r8, r9};
+            this.needsNativeStackHomeSpace = true;
+        } else {
+            javaGeneralParameterRegisters = new Register[]{rsi, rdx, rcx, r8, r9, rdi};
+            nativeGeneralParameterRegisters = new Register[]{rdi, rsi, rdx, rcx, r8, r9};
+            this.needsNativeStackHomeSpace = false;
+        }
+
+        csl = null;
+        this.allocatable = allocatable.clone();
+        Set<Register> callerSaveSet = new HashSet<>();
+        Collections.addAll(callerSaveSet, allocatable);
+        Collections.addAll(callerSaveSet, xmmParameterRegisters);
+        Collections.addAll(callerSaveSet, javaGeneralParameterRegisters);
+        Collections.addAll(callerSaveSet, nativeGeneralParameterRegisters);
+        callerSaved = callerSaveSet.toArray(new Register[callerSaveSet.size()]);
+
+        allAllocatableAreCallerSaved = true;
+        attributesMap = RegisterAttributes.createMap(this, AMD64.allRegisters);
+    }
+
+    @Override
+    public Register[] getCallerSaveRegisters() {
+        return callerSaved;
+    }
+
+    @Override
+    public boolean areAllAllocatableRegistersCallerSaved() {
+        return allAllocatableAreCallerSaved;
+    }
+
+    @Override
+    public Register getRegisterForRole(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly) {
+        if (type == Type.NativeCall) {
+            return callingConvention(nativeGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
+        }
+        // On x64, parameter locations are the same whether viewed
+        // from the caller or callee perspective
+        return callingConvention(javaGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
+    }
+
+    public Register[] getCallingConventionRegisters(Type type, Kind kind) {
+        if (architecture.canStoreValue(XMM, kind)) {
+            return xmmParameterRegisters;
+        }
+        assert architecture.canStoreValue(CPU, kind);
+        return type == Type.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters;
+    }
+
+    private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, Type type, TargetDescription target, boolean stackOnly) {
+        AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
+
+        int currentGeneral = 0;
+        int currentXMM = 0;
+        int currentStackOffset = type == Type.NativeCall && needsNativeStackHomeSpace ? generalParameterRegisters.length * target.wordSize : 0;
+
+        for (int i = 0; i < parameterTypes.length; i++) {
+            final Kind kind = parameterTypes[i].getKind();
+
+            switch (kind) {
+                case Byte:
+                case Boolean:
+                case Short:
+                case Char:
+                case Int:
+                case Long:
+                case Object:
+                    if (!stackOnly && currentGeneral < generalParameterRegisters.length) {
+                        Register register = generalParameterRegisters[currentGeneral++];
+                        locations[i] = register.asValue(target.getLIRKind(kind));
+                    }
+                    break;
+                case Float:
+                case Double:
+                    if (!stackOnly && currentXMM < xmmParameterRegisters.length) {
+                        Register register = xmmParameterRegisters[currentXMM++];
+                        locations[i] = register.asValue(target.getLIRKind(kind));
+                    }
+                    break;
+                default:
+                    throw JVMCIError.shouldNotReachHere();
+            }
+
+            if (locations[i] == null) {
+                locations[i] = StackSlot.get(target.getLIRKind(kind.getStackKind()), currentStackOffset, !type.out);
+                currentStackOffset += Math.max(target.getSizeInBytes(kind), target.wordSize);
+            }
+        }
+
+        Kind returnKind = returnType == null ? Kind.Void : returnType.getKind();
+        AllocatableValue returnLocation = returnKind == Kind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(target.getLIRKind(returnKind.getStackKind()));
+        return new CallingConvention(currentStackOffset, returnLocation, locations);
+    }
+
+    @Override
+    public Register getReturnRegister(Kind kind) {
+        switch (kind) {
+            case Boolean:
+            case Byte:
+            case Char:
+            case Short:
+            case Int:
+            case Long:
+            case Object:
+                return rax;
+            case Float:
+            case Double:
+                return xmm0;
+            case Void:
+            case Illegal:
+                return null;
+            default:
+                throw new UnsupportedOperationException("no return register for type " + kind);
+        }
+    }
+
+    @Override
+    public Register getFrameRegister() {
+        return rsp;
+    }
+
+    public CalleeSaveLayout getCalleeSaveLayout() {
+        return csl;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave:  " + Arrays.toString(getCallerSaveRegisters()) + "%n");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot.jfr/src/com/oracle/jvmci/hotspot/jfr/events/JFREventProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,170 @@
+/*
+ * 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.jfr.events;
+
+import java.net.*;
+
+import com.oracle.jrockit.jfr.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.events.*;
+import com.oracle.jvmci.hotspot.events.EmptyEventProvider.EmptyCompilerFailureEvent;
+import com.oracle.jvmci.hotspot.events.EmptyEventProvider.EmptyCompilationEvent;
+import com.oracle.jvmci.service.*;
+
+/**
+ * A JFR implementation for {@link EventProvider}. This implementation is used when Flight Recorder
+ * is turned on.
+ */
+@ServiceProvider(EventProvider.class)
+public final class JFREventProvider implements EventProvider {
+
+    private final boolean enabled;
+
+    @SuppressWarnings("deprecation")
+    public JFREventProvider() {
+        enabled = HotSpotJVMCIRuntime.runtime().getConfig().flightRecorder;
+        if (enabled) {
+            try {
+                /*
+                 * The "HotSpot JVM" producer is a native producer and we cannot use it. So we
+                 * create our own. This has the downside that Mission Control is confused and
+                 * doesn't show JVMCI events in the "Code" tab. There are plans to revise the JFR
+                 * code for JDK 9.
+                 */
+                Producer producer = new Producer("HotSpot JVM", "Oracle Hotspot JVM", "http://www.oracle.com/hotspot/jvm/");
+                producer.register();
+                // Register event classes with Producer.
+                for (Class<?> c : JFREventProvider.class.getDeclaredClasses()) {
+                    if (c.isAnnotationPresent(EventDefinition.class)) {
+                        assert com.oracle.jrockit.jfr.InstantEvent.class.isAssignableFrom(c) : c;
+                        registerEvent(producer, c);
+                    }
+                }
+            } catch (URISyntaxException e) {
+                throw new InternalError(e);
+            }
+        }
+    }
+
+    /**
+     * Register an event class with the {@link Producer}.
+     *
+     * @param c event class
+     * @return the {@link EventToken event token}
+     */
+    @SuppressWarnings({"deprecation", "javadoc", "unchecked"})
+    private static EventToken registerEvent(Producer producer, Class<?> c) {
+        try {
+            return producer.addEvent((Class<? extends com.oracle.jrockit.jfr.InstantEvent>) c);
+        } catch (InvalidEventDefinitionException | InvalidValueException e) {
+            throw new InternalError(e);
+        }
+    }
+
+    public CompilationEvent newCompilationEvent() {
+        if (enabled) {
+            return new JFRCompilationEvent();
+        }
+        return new EmptyCompilationEvent();
+    }
+
+    /**
+     * A JFR compilation event.
+     *
+     * <p>
+     * See: event {@code Compilation} in {@code src/share/vm/trace/trace.xml}
+     */
+    @SuppressWarnings("deprecation")
+    @EventDefinition(name = "Compilation", path = "vm/compiler/compilation")
+    public static class JFRCompilationEvent extends com.oracle.jrockit.jfr.DurationEvent implements CompilationEvent {
+
+        /*
+         * FIXME method should be a Method* but we can't express that in Java.
+         */
+        @ValueDefinition(name = "Java Method") public String method;
+        @ValueDefinition(name = "Compilation ID", relationKey = "COMP_ID") public int compileId;
+        @ValueDefinition(name = "Compilation Level") public short compileLevel;
+        @ValueDefinition(name = "Succeeded") public boolean succeeded;
+        @ValueDefinition(name = "On Stack Replacement") public boolean isOsr;
+        @ValueDefinition(name = "Compiled Code Size", contentType = ContentType.Bytes) public int codeSize;
+        @ValueDefinition(name = "Inlined Code Size", contentType = ContentType.Bytes) public int inlinedBytes;
+
+        public void setMethod(String method) {
+            this.method = method;
+        }
+
+        public void setCompileId(int id) {
+            this.compileId = id;
+        }
+
+        public void setCompileLevel(int compileLevel) {
+            this.compileLevel = (short) compileLevel;
+        }
+
+        public void setSucceeded(boolean succeeded) {
+            this.succeeded = succeeded;
+        }
+
+        public void setIsOsr(boolean isOsr) {
+            this.isOsr = isOsr;
+        }
+
+        public void setCodeSize(int codeSize) {
+            this.codeSize = codeSize;
+        }
+
+        public void setInlinedBytes(int inlinedBytes) {
+            this.inlinedBytes = inlinedBytes;
+        }
+    }
+
+    public CompilerFailureEvent newCompilerFailureEvent() {
+        if (enabled) {
+            return new JFRCompilerFailureEvent();
+        }
+        return new EmptyCompilerFailureEvent();
+    }
+
+    /**
+     * A JFR compiler failure event.
+     *
+     * <p>
+     * See: event {@code CompilerFailure} in {@code src/share/vm/trace/trace.xml}
+     */
+    @SuppressWarnings("deprecation")
+    @EventDefinition(name = "Compilation Failure", path = "vm/compiler/failure")
+    public static class JFRCompilerFailureEvent extends com.oracle.jrockit.jfr.InstantEvent implements CompilerFailureEvent {
+
+        @ValueDefinition(name = "Compilation ID", relationKey = "COMP_ID") public int compileId;
+        @ValueDefinition(name = "Message", description = "The failure message") public String failure;
+
+        public void setCompileId(int id) {
+            this.compileId = id;
+        }
+
+        public void setMessage(String message) {
+            this.failure = message;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot.sparc/src/com/oracle/jvmci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,100 @@
+/*
+ * 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.hotspot.sparc;
+
+import static com.oracle.jvmci.hotspot.InitTimer.*;
+
+import java.util.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
+import com.oracle.jvmci.service.*;
+import com.oracle.jvmci.sparc.*;
+import com.oracle.jvmci.sparc.SPARC.CPUFeature;
+
+@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 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";
+    }
+
+    @Override
+    public String toString() {
+        return getJVMCIRuntimeName() + ":" + 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";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot.sparc/src/com/oracle/jvmci/hotspot/sparc/SPARCHotSpotRegisterConfig.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,304 @@
+/*
+ * 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.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 com.oracle.jvmci.sparc.*;
+
+import static com.oracle.jvmci.sparc.SPARC.*;
+
+import java.util.*;
+
+import com.oracle.jvmci.code.CallingConvention.Type;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
+
+public class SPARCHotSpotRegisterConfig implements RegisterConfig {
+
+    private final Architecture architecture;
+
+    private final Register[] allocatable;
+
+    private final RegisterAttributes[] attributesMap;
+
+    @Override
+    public Register[] getAllocatableRegisters() {
+        return allocatable.clone();
+    }
+
+    public Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers) {
+        ArrayList<Register> list = new ArrayList<>();
+        for (Register reg : registers) {
+            if (architecture.canStoreValue(reg.getRegisterCategory(), kind)) {
+                // Special treatment for double precision
+                // TODO: This is wasteful it uses only half of the registers as float.
+                if (kind == Kind.Double) {
+                    if (reg.name.startsWith("d")) {
+                        list.add(reg);
+                    }
+                } else if (kind == Kind.Float) {
+                    if (reg.name.startsWith("f")) {
+                        list.add(reg);
+                    }
+                } else {
+                    list.add(reg);
+                }
+            }
+        }
+
+        Register[] ret = list.toArray(new Register[list.size()]);
+        return ret;
+    }
+
+    @Override
+    public RegisterAttributes[] getAttributesMap() {
+        return attributesMap.clone();
+    }
+
+    private final Register[] cpuCallerParameterRegisters = {o0, o1, o2, o3, o4, o5};
+    private final Register[] cpuCalleeParameterRegisters = {i0, i1, i2, i3, i4, i5};
+
+    private final Register[] fpuParameterRegisters = {f0, f1, f2, f3, f4, f5, f6, f7};
+    private final Register[] fpuDoubleParameterRegisters = {d0, null, d2, null, d4, null, d6, null};
+    // @formatter:off
+    private final Register[] callerSaveRegisters =
+                   {g1, g2, g3, g4, g5, g6, g7,
+                    o0, o1, o2, o3, o4, o5, o7,
+                    f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
+                    f8,  f9,  f10, f11, f12, f13, f14, f15,
+                    f16, f17, f18, f19, f20, f21, f22, f23,
+                    f24, f25, f26, f27, f28, f29, f30, f31,
+                    d32, d34, d36, d38, d40, d42, d44, d46,
+                    d48, d50, d52, d54, d56, d58, d60, d62};
+    // @formatter:on
+
+    /**
+     * Registers saved by the callee. This lists all L and I registers which are saved in the
+     * register window.
+     */
+    private final Register[] calleeSaveRegisters = {l0, l1, l2, l3, l4, l5, l6, l7, i0, i1, i2, i3, i4, i5, i6, i7};
+
+    private final CalleeSaveLayout csl;
+
+    private static Register[] initAllocatable(boolean reserveForHeapBase) {
+        Register[] registers = null;
+        if (reserveForHeapBase) {
+            // @formatter:off
+            registers = new Register[]{
+                        // TODO this is not complete
+                        // o7 cannot be used as register because it is always overwritten on call
+                        // and the current register handler would ignore this fact if the called
+                        // method still does not modify registers, in fact o7 is modified by the Call instruction
+                        // There would be some extra handlin necessary to be able to handle the o7 properly for local usage
+                        o0, o1, o2, o3, o4, o5, /*o6, o7,*/
+                        l0, l1, l2, l3, l4, l5, l6, l7,
+                        i0, i1, i2, i3, i4, i5, /*i6,*/ /*i7,*/
+                        //f0, f1, f2, f3, f4, f5, f6, f7,
+                        f8,  f9,  f10, f11, f12, f13, f14, f15,
+                        f16, f17, f18, f19, f20, f21, f22, f23,
+                        f24, f25, f26, f27, f28, f29, f30, f31,
+                        d32, d34, d36, d38, d40, d42, d44, d46,
+                        d48, d50, d52, d54, d56, d58, d60, d62
+            };
+            // @formatter:on
+        } else {
+            // @formatter:off
+            registers = new Register[]{
+                        // TODO this is not complete
+                        o0, o1, o2, o3, o4, o5, /*o6, o7,*/
+                        l0, l1, l2, l3, l4, l5, l6, l7,
+                        i0, i1, i2, i3, i4, i5, /*i6,*/ /*i7,*/
+//                        f0, f1, f2, f3, f4, f5, f6, f7
+                        f8,  f9,  f10, f11, f12, f13, f14, f15,
+                        f16, f17, f18, f19, f20, f21, f22, f23,
+                        f24, f25, f26, f27, f28, f29, f30, f31,
+                        d32, d34, d36, d38, d40, d42, d44, d46,
+                        d48, d50, d52, d54, d56, d58, d60, d62
+            };
+            // @formatter:on
+        }
+
+        return registers;
+    }
+
+    public SPARCHotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config) {
+        this(target, initAllocatable(config.useCompressedOops));
+    }
+
+    public SPARCHotSpotRegisterConfig(TargetDescription target, Register[] allocatable) {
+        this.architecture = target.arch;
+
+        csl = new CalleeSaveLayout(target, -1, -1, target.arch.getWordSize(), calleeSaveRegisters);
+        this.allocatable = allocatable.clone();
+        attributesMap = RegisterAttributes.createMap(this, SPARC.allRegisters);
+    }
+
+    @Override
+    public Register[] getCallerSaveRegisters() {
+        return callerSaveRegisters;
+    }
+
+    @Override
+    public boolean areAllAllocatableRegistersCallerSaved() {
+        return false;
+    }
+
+    @Override
+    public Register getRegisterForRole(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly) {
+        if (type == Type.JavaCall || type == Type.NativeCall) {
+            return callingConvention(cpuCallerParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
+        }
+        if (type == Type.JavaCallee) {
+            return callingConvention(cpuCalleeParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
+        }
+        throw JVMCIError.shouldNotReachHere();
+    }
+
+    public Register[] getCallingConventionRegisters(Type type, Kind kind) {
+        if (architecture.canStoreValue(FPUs, kind) || architecture.canStoreValue(FPUd, kind)) {
+            return fpuParameterRegisters;
+        }
+        assert architecture.canStoreValue(CPU, kind);
+        return type == Type.JavaCallee ? cpuCalleeParameterRegisters : cpuCallerParameterRegisters;
+    }
+
+    private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, Type type, TargetDescription target, boolean stackOnly) {
+        AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
+
+        int currentGeneral = 0;
+        int currentFloating = 0;
+        int currentStackOffset = 0;
+
+        for (int i = 0; i < parameterTypes.length; i++) {
+            final Kind kind = parameterTypes[i].getKind();
+
+            switch (kind) {
+                case Byte:
+                case Boolean:
+                case Short:
+                case Char:
+                case Int:
+                case Long:
+                case Object:
+                    if (!stackOnly && currentGeneral < generalParameterRegisters.length) {
+                        Register register = generalParameterRegisters[currentGeneral++];
+                        locations[i] = register.asValue(target.getLIRKind(kind));
+                    }
+                    break;
+                case Double:
+                    if (!stackOnly && currentFloating < fpuParameterRegisters.length) {
+                        if (currentFloating % 2 != 0) {
+                            // Make register number even to be a double reg
+                            currentFloating++;
+                        }
+                        Register register = fpuDoubleParameterRegisters[currentFloating];
+                        currentFloating += 2; // Only every second is a double register
+                        locations[i] = register.asValue(target.getLIRKind(kind));
+                    }
+                    break;
+                case Float:
+                    if (!stackOnly && currentFloating < fpuParameterRegisters.length) {
+                        Register register = fpuParameterRegisters[currentFloating++];
+                        locations[i] = register.asValue(target.getLIRKind(kind));
+                    }
+                    break;
+                default:
+                    throw JVMCIError.shouldNotReachHere();
+            }
+
+            if (locations[i] == null) {
+                // Stack slot is always aligned to its size in bytes but minimum wordsize
+                int typeSize = SPARC.spillSlotSize(target, kind);
+                currentStackOffset = roundUp(currentStackOffset, typeSize);
+                locations[i] = StackSlot.get(target.getLIRKind(kind.getStackKind()), currentStackOffset, !type.out);
+                currentStackOffset += typeSize;
+            }
+        }
+
+        Kind returnKind = returnType == null ? Kind.Void : returnType.getKind();
+        AllocatableValue returnLocation = returnKind == Kind.Void ? Value.ILLEGAL : getReturnRegister(returnKind, type).asValue(target.getLIRKind(returnKind.getStackKind()));
+        return new CallingConvention(currentStackOffset, returnLocation, locations);
+    }
+
+    private static int roundUp(int number, int mod) {
+        return ((number + mod - 1) / mod) * mod;
+    }
+
+    @Override
+    public Register getReturnRegister(Kind kind) {
+        return getReturnRegister(kind, Type.JavaCallee);
+    }
+
+    private static Register getReturnRegister(Kind kind, Type type) {
+        switch (kind) {
+            case Boolean:
+            case Byte:
+            case Char:
+            case Short:
+            case Int:
+            case Long:
+            case Object:
+                return type == Type.JavaCallee ? i0 : o0;
+            case Float:
+                return f0;
+            case Double:
+                return d0;
+            case Void:
+            case Illegal:
+                return null;
+            default:
+                throw new UnsupportedOperationException("no return register for type " + kind);
+        }
+    }
+
+    @Override
+    public Register getFrameRegister() {
+        return sp;
+    }
+
+    public CalleeSaveLayout getCalleeSaveLayout() {
+        return csl;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave:  " + Arrays.toString(getCallerSaveRegisters()) + "%n");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilationStatistics.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,212 @@
+/*
+ * 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 java.lang.Thread.*;
+
+import java.io.*;
+import java.lang.annotation.*;
+import java.lang.management.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+import com.sun.management.ThreadMXBean;
+
+@SuppressWarnings("unused")
+public final class CompilationStatistics {
+
+    private static final long RESOLUTION = 100000000;
+    private static final boolean ENABLED = Boolean.getBoolean("jvmci.comp.stats");
+
+    private static final CompilationStatistics DUMMY = new CompilationStatistics(null, false);
+
+    private static ConcurrentLinkedDeque<CompilationStatistics> list = new ConcurrentLinkedDeque<>();
+
+    private static final ThreadLocal<Deque<CompilationStatistics>> current = new ThreadLocal<Deque<CompilationStatistics>>() {
+
+        @Override
+        protected Deque<CompilationStatistics> initialValue() {
+            return new ArrayDeque<>();
+        }
+    };
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.FIELD)
+    private static @interface NotReported {
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.FIELD)
+    private static @interface TimeValue {
+    }
+
+    private static long zeroTime = System.nanoTime();
+
+    private static long getThreadAllocatedBytes() {
+        ThreadMXBean thread = (ThreadMXBean) ManagementFactory.getThreadMXBean();
+        return thread.getThreadAllocatedBytes(currentThread().getId());
+    }
+
+    @NotReported private final long startTime;
+    @NotReported private long threadAllocatedBytesStart;
+
+    private int bytecodeCount;
+    private int codeSize;
+    @TimeValue private long duration;
+    private long memoryUsed;
+    private final boolean osr;
+    private final String holder;
+    private final String name;
+    private final String signature;
+
+    private CompilationStatistics(HotSpotResolvedJavaMethod method, boolean osr) {
+        this.osr = osr;
+        if (method != null) {
+            holder = method.getDeclaringClass().getName();
+            name = method.getName();
+            signature = method.getSignature().toMethodDescriptor();
+            startTime = System.nanoTime();
+            bytecodeCount = method.getCodeSize();
+            threadAllocatedBytesStart = getThreadAllocatedBytes();
+        } else {
+            holder = "";
+            name = "";
+            signature = "";
+            startTime = 0;
+        }
+    }
+
+    public void finish(HotSpotResolvedJavaMethod method, HotSpotInstalledCode code) {
+        if (ENABLED) {
+            duration = System.nanoTime() - startTime;
+            codeSize = (int) code.getCodeSize();
+            memoryUsed = getThreadAllocatedBytes() - threadAllocatedBytesStart;
+            if (current.get().getLast() != this) {
+                throw new RuntimeException("mismatch in finish()");
+            }
+            current.get().removeLast();
+        }
+    }
+
+    public static CompilationStatistics current() {
+        return current.get().isEmpty() ? null : current.get().getLast();
+    }
+
+    public static CompilationStatistics create(HotSpotResolvedJavaMethod method, boolean isOSR) {
+        if (ENABLED) {
+            CompilationStatistics stats = new CompilationStatistics(method, isOSR);
+            list.add(stats);
+            current.get().addLast(stats);
+            return stats;
+        } else {
+            return DUMMY;
+        }
+    }
+
+    @SuppressWarnings("deprecation")
+    public static void clear(String dumpName) {
+        if (!ENABLED) {
+            return;
+        }
+        try {
+            ConcurrentLinkedDeque<CompilationStatistics> snapshot = list;
+            long snapshotZeroTime = zeroTime;
+
+            list = new ConcurrentLinkedDeque<>();
+            zeroTime = System.nanoTime();
+
+            Date now = new Date();
+            String dateString = (now.getYear() + 1900) + "-" + (now.getMonth() + 1) + "-" + now.getDate() + "-" + now.getHours() + "" + now.getMinutes();
+
+            dumpCompilations(snapshot, dumpName, dateString);
+
+            try (FileOutputStream fos = new FileOutputStream("timeline_" + dateString + "_" + dumpName + ".csv", true); PrintStream out = new PrintStream(fos)) {
+
+                long[] timeSpent = new long[10000];
+                int maxTick = 0;
+                for (CompilationStatistics stats : snapshot) {
+                    long start = stats.startTime - snapshotZeroTime;
+                    long duration = stats.duration;
+                    if (start < 0) {
+                        duration -= -start;
+                        start = 0;
+                    }
+
+                    int tick = (int) (start / RESOLUTION);
+                    long timeLeft = RESOLUTION - (start % RESOLUTION);
+
+                    while (tick < timeSpent.length && duration > 0) {
+                        if (tick > maxTick) {
+                            maxTick = tick;
+                        }
+                        timeSpent[tick] += Math.min(timeLeft, duration);
+                        duration -= timeLeft;
+                        tick++;
+                        timeLeft = RESOLUTION;
+                    }
+                }
+                String timelineName = System.getProperty("stats.timeline.name");
+                if (timelineName != null && !timelineName.isEmpty()) {
+                    out.print(timelineName + "\t");
+                }
+                for (int i = 0; i <= maxTick; i++) {
+                    out.print((timeSpent[i] * 100 / RESOLUTION) + "\t");
+                }
+                out.println();
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    protected static void dumpCompilations(ConcurrentLinkedDeque<CompilationStatistics> snapshot, String dumpName, String dateString) throws IllegalAccessException, FileNotFoundException {
+        String fileName = "compilations_" + dateString + "_" + dumpName + ".csv";
+        try (PrintStream out = new PrintStream(fileName)) {
+            // output the list of all compilations
+
+            Field[] declaredFields = CompilationStatistics.class.getDeclaredFields();
+            ArrayList<Field> fields = new ArrayList<>();
+            for (Field field : declaredFields) {
+                if (!Modifier.isStatic(field.getModifiers()) && !field.isAnnotationPresent(NotReported.class)) {
+                    fields.add(field);
+                }
+            }
+            for (Field field : fields) {
+                out.print(field.getName() + "\t");
+            }
+            out.println();
+            for (CompilationStatistics stats : snapshot) {
+                for (Field field : fields) {
+                    if (field.isAnnotationPresent(TimeValue.class)) {
+                        double value = field.getLong(stats) / 1000000d;
+                        out.print(String.format(Locale.ENGLISH, "%.3f", value) + "\t");
+                    } else {
+                        out.print(field.get(stats) + "\t");
+                    }
+                }
+                out.println();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilationTask.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,293 @@
+/*
+ * 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.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.debug.Debug.*;
+import static com.oracle.jvmci.compiler.Compiler.*;
+
+import java.lang.management.*;
+import java.util.concurrent.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.compiler.Compiler;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.debug.internal.*;
+import com.oracle.jvmci.hotspot.events.*;
+import com.oracle.jvmci.hotspot.events.EventProvider.CompilationEvent;
+import com.oracle.jvmci.hotspot.events.EventProvider.CompilerFailureEvent;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.service.*;
+
+//JaCoCo Exclude
+
+public class CompilationTask {
+
+    private static final DebugMetric BAILOUTS = Debug.metric("Bailouts");
+
+    private static final EventProvider eventProvider;
+    static {
+        EventProvider provider = Services.loadSingle(EventProvider.class, false);
+        if (provider == null) {
+            eventProvider = new EmptyEventProvider();
+        } else {
+            eventProvider = provider;
+        }
+    }
+    private static final Compiler compiler = Services.loadSingle(Compiler.class, true);
+
+    private final HotSpotResolvedJavaMethod method;
+    private final int entryBCI;
+    private final int id;
+
+    /**
+     * Specifies whether the compilation result is installed as the
+     * {@linkplain HotSpotNmethod#isDefault() default} nmethod for the compiled method.
+     */
+    private final boolean installAsDefault;
+
+    /**
+     * A {@link com.sun.management.ThreadMXBean} to be able to query some information about the
+     * current compiler thread, e.g. total allocated bytes.
+     */
+    private static final com.sun.management.ThreadMXBean threadMXBean = (com.sun.management.ThreadMXBean) ManagementFactory.getThreadMXBean();
+
+    /**
+     * The address of the JVMCIEnv associated with this compilation or 0L if no such object exists.
+     */
+    private final long jvmciEnv;
+
+    public CompilationTask(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id, boolean installAsDefault) {
+        this.method = method;
+        this.entryBCI = entryBCI;
+        this.id = id;
+        this.jvmciEnv = jvmciEnv;
+        this.installAsDefault = installAsDefault;
+    }
+
+    public ResolvedJavaMethod getMethod() {
+        return method;
+    }
+
+    /**
+     * Returns the compilation id of this task.
+     *
+     * @return compile id
+     */
+    public int getId() {
+        return id;
+    }
+
+    public int getEntryBCI() {
+        return entryBCI;
+    }
+
+    /**
+     * Time spent in compilation.
+     */
+    private static final DebugTimer CompilationTime = Debug.timer("CompilationTime");
+
+    /**
+     * Meters the {@linkplain CompilationResult#getBytecodeSize() bytecodes} compiled.
+     */
+    private static final DebugMetric CompiledBytecodes = Debug.metric("CompiledBytecodes");
+
+    public static final DebugTimer CodeInstallationTime = Debug.timer("CodeInstallation");
+
+    public void runCompilation() {
+        HotSpotVMConfig config = HotSpotJVMCIRuntime.runtime().getConfig();
+        final long threadId = Thread.currentThread().getId();
+        long startCompilationTime = System.nanoTime();
+        HotSpotInstalledCode installedCode = null;
+        final boolean isOSR = entryBCI != Compiler.INVOCATION_ENTRY_BCI;
+
+        // Log a compilation event.
+        CompilationEvent compilationEvent = eventProvider.newCompilationEvent();
+
+        // If there is already compiled code for this method on our level we simply return.
+        // JVMCI compiles are always at the highest compile level, even in non-tiered mode so we
+        // only need to check for that value.
+        if (method.hasCodeAtLevel(entryBCI, config.compilationLevelFullOptimization)) {
+            return;
+        }
+
+        CompilationResult result = null;
+        try (DebugCloseable a = CompilationTime.start()) {
+            CompilationStatistics stats = CompilationStatistics.create(method, isOSR);
+            final boolean printCompilation = PrintCompilation.getValue() && !TTY.isSuppressed();
+            if (printCompilation) {
+                TTY.println(getMethodDescription() + "...");
+            }
+
+            TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method);
+            final long start = System.currentTimeMillis();
+            final long allocatedBytesBefore = threadMXBean.getThreadAllocatedBytes(threadId);
+
+            try (Scope s = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true))) {
+                // Begin the compilation event.
+                compilationEvent.begin();
+
+                result = compiler.compile(method, entryBCI, mustRecordMethodInlining(config));
+
+                result.setId(getId());
+            } catch (Throwable e) {
+                throw Debug.handle(e);
+            } finally {
+                // End the compilation event.
+                compilationEvent.end();
+
+                filter.remove();
+                final boolean printAfterCompilation = PrintAfterCompilation.getValue() && !TTY.isSuppressed();
+
+                if (printAfterCompilation || printCompilation) {
+                    final long stop = System.currentTimeMillis();
+                    final int targetCodeSize = result != null ? result.getTargetCodeSize() : -1;
+                    final long allocatedBytesAfter = threadMXBean.getThreadAllocatedBytes(threadId);
+                    final long allocatedBytes = (allocatedBytesAfter - allocatedBytesBefore) / 1024;
+
+                    if (printAfterCompilation) {
+                        TTY.println(getMethodDescription() + String.format(" | %4dms %5dB %5dkB", stop - start, targetCodeSize, allocatedBytes));
+                    } else if (printCompilation) {
+                        TTY.println(String.format("%-6d JVMCI %-70s %-45s %-50s | %4dms %5dB %5dkB", id, "", "", "", stop - start, targetCodeSize, allocatedBytes));
+                    }
+                }
+            }
+
+            try (DebugCloseable b = CodeInstallationTime.start()) {
+                installedCode = (HotSpotInstalledCode) installMethod(result);
+            }
+            stats.finish(method, installedCode);
+        } catch (BailoutException bailout) {
+            BAILOUTS.increment();
+            if (ExitVMOnBailout.getValue()) {
+                TTY.out.println(method.format("Bailout in %H.%n(%p)"));
+                bailout.printStackTrace(TTY.out);
+                System.exit(-1);
+            } else if (PrintBailout.getValue()) {
+                TTY.out.println(method.format("Bailout in %H.%n(%p)"));
+                bailout.printStackTrace(TTY.out);
+            }
+        } catch (Throwable t) {
+            if (PrintStackTraceOnException.getValue() || ExitVMOnException.getValue()) {
+                t.printStackTrace(TTY.out);
+            }
+
+            // Log a failure event.
+            CompilerFailureEvent event = eventProvider.newCompilerFailureEvent();
+            if (event.shouldWrite()) {
+                event.setCompileId(getId());
+                event.setMessage(t.getMessage());
+                event.commit();
+            }
+
+            if (ExitVMOnException.getValue()) {
+                System.exit(-1);
+            }
+        } finally {
+            int compiledBytecodes = 0;
+            int codeSize = 0;
+            if (result != null) {
+                compiledBytecodes = result.getBytecodeSize();
+            }
+            if (installedCode != null) {
+                codeSize = installedCode.getSize();
+            }
+            CompiledBytecodes.add(compiledBytecodes);
+
+            // Log a compilation event.
+            if (compilationEvent.shouldWrite()) {
+                compilationEvent.setMethod(method.format("%H.%n(%p)"));
+                compilationEvent.setCompileId(getId());
+                compilationEvent.setCompileLevel(config.compilationLevelFullOptimization);
+                compilationEvent.setSucceeded(result != null && installedCode != null);
+                compilationEvent.setIsOsr(isOSR);
+                compilationEvent.setCodeSize(codeSize);
+                compilationEvent.setInlinedBytes(compiledBytecodes);
+                compilationEvent.commit();
+            }
+
+            if (jvmciEnv != 0) {
+                long ctask = unsafe.getAddress(jvmciEnv + config.jvmciEnvTaskOffset);
+                assert ctask != 0L;
+                unsafe.putInt(ctask + config.compileTaskNumInlinedBytecodesOffset, compiledBytecodes);
+            }
+            long compilationTime = System.nanoTime() - startCompilationTime;
+            if ((config.ciTime || config.ciTimeEach) && installedCode != null) {
+                long timeUnitsPerSecond = TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS);
+                CompilerToVM c2vm = HotSpotJVMCIRuntime.runtime().getCompilerToVM();
+                c2vm.notifyCompilationStatistics(id, method, entryBCI != Compiler.INVOCATION_ENTRY_BCI, compiledBytecodes, compilationTime, timeUnitsPerSecond, installedCode);
+            }
+        }
+    }
+
+    /**
+     * Determines whether to disable method inlining recording for the method being compiled.
+     */
+    private boolean mustRecordMethodInlining(HotSpotVMConfig config) {
+        if (config.ciTime || config.ciTimeEach || CompiledBytecodes.isEnabled()) {
+            return true;
+        }
+        if (jvmciEnv == 0 || unsafe.getByte(jvmciEnv + config.jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset) != 0) {
+            return true;
+        }
+        return false;
+    }
+
+    private String getMethodDescription() {
+        return String.format("%-6d JVMCI %-70s %-45s %-50s %s", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature().toMethodDescriptor(),
+                        entryBCI == Compiler.INVOCATION_ENTRY_BCI ? "" : "(OSR@" + entryBCI + ") ");
+    }
+
+    private InstalledCode installMethod(final CompilationResult compResult) {
+        final HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) HotSpotJVMCIRuntime.runtime().getHostJVMCIBackend().getCodeCache();
+        InstalledCode installedCode = null;
+        try (Scope s = Debug.scope("CodeInstall", new DebugDumpScope(String.valueOf(id), true), codeCache, method)) {
+            installedCode = codeCache.installMethod(method, compResult, jvmciEnv, installAsDefault);
+        } catch (Throwable e) {
+            throw Debug.handle(e);
+        }
+        return installedCode;
+    }
+
+    @Override
+    public String toString() {
+        return "Compilation[id=" + id + ", " + method.format("%H.%n(%p)") + (entryBCI == Compiler.INVOCATION_ENTRY_BCI ? "" : "@" + entryBCI) + "]";
+    }
+
+    /**
+     * Compiles a method to machine code.
+     */
+    public static void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) {
+        // Ensure a debug configuration for this thread is initialized
+        if (Debug.isEnabled() && DebugScope.getConfig() == null) {
+            DebugEnvironment.initialize(TTY.out);
+        }
+
+        CompilationTask task = new CompilationTask(method, entryBCI, jvmciEnv, id, true);
+        try (DebugConfigScope dcs = setConfig(new TopLevelDebugConfig())) {
+            task.runCompilation();
+        }
+        return;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompileTheWorld.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,503 @@
+/*
+ * 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 static com.oracle.jvmci.compiler.Compiler.*;
+import static com.oracle.jvmci.debug.internal.MemUseTrackerImpl.*;
+
+import java.io.*;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.net.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+import java.util.jar.*;
+import java.util.stream.*;
+
+import com.oracle.jvmci.compiler.*;
+import com.oracle.jvmci.compiler.CompilerThreadFactory.DebugConfigAccess;
+import com.oracle.jvmci.compiler.Compiler;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.internal.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionUtils.OptionConsumer;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
+import com.oracle.jvmci.runtime.*;
+
+/**
+ * This class implements compile-the-world functionality with JVMCI.
+ */
+public final class CompileTheWorld {
+
+    /**
+     * Magic token to trigger reading files from the boot class path.
+     */
+    public static final String SUN_BOOT_CLASS_PATH = "sun.boot.class.path";
+
+    public static class Options {
+        // @formatter:off
+        @Option(help = "Compile all methods in all classes on given class path", type = OptionType.Debug)
+        public static final OptionValue<String> CompileTheWorldClasspath = new OptionValue<>(SUN_BOOT_CLASS_PATH);
+        @Option(help = "Verbose CompileTheWorld operation", type = OptionType.Debug)
+        public static final OptionValue<Boolean> CompileTheWorldVerbose = new OptionValue<>(true);
+        @Option(help = "The number of CompileTheWorld iterations to perform", type = OptionType.Debug)
+        public static final OptionValue<Integer> CompileTheWorldIterations = new OptionValue<>(1);
+        @Option(help = "Only compile methods matching this filter", type = OptionType.Debug)
+        public static final OptionValue<String> CompileTheWorldMethodFilter = new OptionValue<>(null);
+        @Option(help = "Exclude methods matching this filter from compilation", type = OptionType.Debug)
+        public static final OptionValue<String> CompileTheWorldExcludeMethodFilter = new OptionValue<>(null);
+        @Option(help = "First class to consider when using -XX:+CompileTheWorld", type = OptionType.Debug)
+        public static final OptionValue<Integer> CompileTheWorldStartAt = new OptionValue<>(1);
+        @Option(help = "Last class to consider when using -XX:+CompileTheWorld", type = OptionType.Debug)
+        public static final OptionValue<Integer> CompileTheWorldStopAt = new OptionValue<>(Integer.MAX_VALUE);
+        @Option(help = "Option value overrides to use during compile the world. For example, " +
+                       "to disable inlining and partial escape analysis specify '-PartialEscapeAnalysis -Inline'. " +
+                       "The format for each option is the same as on the command line just without the '-G:' prefix.", type = OptionType.Debug)
+        public static final OptionValue<String> CompileTheWorldConfig = new OptionValue<>(null);
+
+        @Option(help = "Run CTW using as many threads as there are processors on the system", type = OptionType.Debug)
+        public static final OptionValue<Boolean> CompileTheWorldMultiThreaded = new OptionValue<>(false);
+        @Option(help = "Number of threads to use for multithreaded CTW.  Defaults to Runtime.getRuntime().availableProcessors()", type = OptionType.Debug)
+        public static final OptionValue<Integer> CompileTheWorldThreads = new OptionValue<>(0);
+        // @formatter:on
+
+        /**
+         * Overrides {@link #CompileTheWorldStartAt} and {@link #CompileTheWorldStopAt} from
+         * {@code -XX} HotSpot options of the same name if the latter have non-default values.
+         */
+        public static void overrideWithNativeOptions(HotSpotVMConfig c) {
+            if (c.compileTheWorldStartAt != 1) {
+                CompileTheWorldStartAt.setValue(c.compileTheWorldStartAt);
+            }
+            if (c.compileTheWorldStopAt != Integer.MAX_VALUE) {
+                CompileTheWorldStopAt.setValue(c.compileTheWorldStopAt);
+            }
+        }
+    }
+
+    /**
+     * A mechanism for overriding JVMCI options that affect compilation. A {@link Config} object
+     * should be used in a try-with-resources statement to ensure overriding of options is scoped
+     * properly. For example:
+     *
+     * <pre>
+     *     Config config = ...;
+     *     try (AutoCloseable s = config == null ? null : config.apply()) {
+     *         // perform a JVMCI compilation
+     *     }
+     * </pre>
+     */
+    @SuppressWarnings("serial")
+    public static class Config extends HashMap<OptionValue<?>, Object> implements OptionConsumer {
+        /**
+         * Creates a {@link Config} object by parsing a set of space separated override options.
+         *
+         * @param options a space separated set of option value settings with each option setting in
+         *            a format compatible with
+         *            {@link OptionUtils#parseOption(String, OptionConsumer)}. Ignored if null.
+         */
+        public Config(String options) {
+            if (options != null) {
+                for (String option : options.split("\\s+")) {
+                    OptionUtils.parseOption(option, this);
+                }
+            }
+        }
+
+        /**
+         * Applies the overrides represented by this object. The overrides are in effect until
+         * {@link OverrideScope#close()} is called on the returned object.
+         */
+        OverrideScope apply() {
+            return OptionValue.override(this);
+        }
+
+        public void set(OptionDescriptor desc, Object value) {
+            put(desc.getOptionValue(), value);
+        }
+    }
+
+    /** List of Zip/Jar files to compile (see {@link Options#CompileTheWorldClasspath}). */
+    private final String files;
+
+    /** Class index to start compilation at (see {@link Options#CompileTheWorldStartAt}). */
+    private final int startAt;
+
+    /** Class index to stop compilation at (see {@link Options#CompileTheWorldStopAt}). */
+    private final int stopAt;
+
+    /** Only compile methods matching one of the filters in this array if the array is non-null. */
+    private final MethodFilter[] methodFilters;
+
+    /** Exclude methods matching one of the filters in this array if the array is non-null. */
+    private final MethodFilter[] excludeMethodFilters;
+
+    // Counters
+    private int classFileCounter = 0;
+    private AtomicLong compiledMethodsCounter = new AtomicLong();
+    private AtomicLong compileTime = new AtomicLong();
+    private AtomicLong memoryUsed = new AtomicLong();
+
+    private boolean verbose;
+    private final Config config;
+
+    /**
+     * Signal that the threads should start compiling in multithreaded mode.
+     */
+    private boolean running;
+
+    private ThreadPoolExecutor threadPool;
+
+    /**
+     * Creates a compile-the-world instance.
+     *
+     * @param files {@link File#pathSeparator} separated list of Zip/Jar files to compile
+     * @param startAt index of the class file to start compilation at
+     * @param stopAt index of the class file to stop compilation at
+     * @param methodFilters
+     * @param excludeMethodFilters
+     */
+    public CompileTheWorld(String files, Config config, int startAt, int stopAt, String methodFilters, String excludeMethodFilters, boolean verbose) {
+        this.files = files;
+        this.startAt = startAt;
+        this.stopAt = stopAt;
+        this.methodFilters = methodFilters == null || methodFilters.isEmpty() ? null : MethodFilter.parse(methodFilters);
+        this.excludeMethodFilters = excludeMethodFilters == null || excludeMethodFilters.isEmpty() ? null : MethodFilter.parse(excludeMethodFilters);
+        this.verbose = verbose;
+        this.config = config;
+
+        // We don't want the VM to exit when a method fails to compile...
+        config.putIfAbsent(ExitVMOnException, false);
+
+        // ...but we want to see exceptions.
+        config.putIfAbsent(PrintBailout, true);
+        config.putIfAbsent(PrintStackTraceOnException, true);
+        config.putIfAbsent(HotSpotResolvedJavaMethodImpl.Options.UseProfilingInformation, false);
+    }
+
+    /**
+     * Compiles all methods in all classes in the Zip/Jar archive files in
+     * {@link Options#CompileTheWorldClasspath}. If {@link Options#CompileTheWorldClasspath}
+     * contains the magic token {@link #SUN_BOOT_CLASS_PATH} passed up from HotSpot we take the
+     * files from the boot class path.
+     */
+    public void compile() throws Throwable {
+        // By default only report statistics for the CTW threads themselves
+        if (JVMCIDebugConfig.DebugValueThreadFilter.hasDefaultValue()) {
+            JVMCIDebugConfig.DebugValueThreadFilter.setValue("^CompileTheWorld");
+        }
+
+        if (SUN_BOOT_CLASS_PATH.equals(files)) {
+            final String[] entries = System.getProperty(SUN_BOOT_CLASS_PATH).split(File.pathSeparator);
+            String bcpFiles = "";
+            for (int i = 0; i < entries.length; i++) {
+                final String entry = entries[i];
+
+                // We stop at rt.jar, unless it is the first boot class path entry.
+                if (entry.endsWith("rt.jar") && (i > 0)) {
+                    break;
+                }
+                if (i > 0) {
+                    bcpFiles += File.pathSeparator;
+                }
+                bcpFiles += entry;
+            }
+            compile(bcpFiles);
+        } else {
+            compile(files);
+        }
+    }
+
+    public void println() {
+        println("");
+    }
+
+    public void println(String format, Object... args) {
+        println(String.format(format, args));
+    }
+
+    public void println(String s) {
+        if (verbose) {
+            TTY.println(s);
+        }
+    }
+
+    @SuppressWarnings("unused")
+    private static void dummy() {
+    }
+
+    /**
+     * Compiles all methods in all classes in the Zip/Jar files passed.
+     *
+     * @param fileList {@link File#pathSeparator} separated list of Zip/Jar files to compile
+     * @throws IOException
+     */
+    private void compile(String fileList) throws IOException {
+        final String[] entries = fileList.split(File.pathSeparator);
+        long start = System.currentTimeMillis();
+
+        CompilerThreadFactory factory = new CompilerThreadFactory("CompileTheWorld", new DebugConfigAccess() {
+            public JVMCIDebugConfig getDebugConfig() {
+                if (Debug.isEnabled() && DebugScope.getConfig() == null) {
+                    return DebugEnvironment.initialize(System.out);
+                }
+                return null;
+            }
+        });
+
+        try {
+            // compile dummy method to get compiler initilized outside of the config debug override.
+            HotSpotResolvedJavaMethod dummyMethod = (HotSpotResolvedJavaMethod) JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess().lookupJavaMethod(
+                            CompileTheWorld.class.getDeclaredMethod("dummy"));
+            CompilationTask task = new CompilationTask(dummyMethod, Compiler.INVOCATION_ENTRY_BCI, 0L, dummyMethod.allocateCompileId(Compiler.INVOCATION_ENTRY_BCI), false);
+            task.runCompilation();
+        } catch (NoSuchMethodException | SecurityException e1) {
+            e1.printStackTrace();
+        }
+
+        /*
+         * Always use a thread pool, even for single threaded mode since it simplifies the use of
+         * DebugValueThreadFilter to filter on the thread names.
+         */
+        int threadCount = 1;
+        if (Options.CompileTheWorldMultiThreaded.getValue()) {
+            threadCount = Options.CompileTheWorldThreads.getValue();
+            if (threadCount == 0) {
+                threadCount = Runtime.getRuntime().availableProcessors();
+            }
+        } else {
+            running = true;
+        }
+        threadPool = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), factory);
+
+        try (OverrideScope s = config.apply()) {
+            for (int i = 0; i < entries.length; i++) {
+                final String entry = entries[i];
+
+                // For now we only compile all methods in all classes in zip/jar files.
+                if (!entry.endsWith(".zip") && !entry.endsWith(".jar")) {
+                    println("CompileTheWorld : Skipped classes in " + entry);
+                    println();
+                    continue;
+                }
+
+                if (methodFilters == null || methodFilters.length == 0) {
+                    println("CompileTheWorld : Compiling all classes in " + entry);
+                } else {
+                    String include = Arrays.asList(methodFilters).stream().map(MethodFilter::toString).collect(Collectors.joining(", "));
+                    println("CompileTheWorld : Compiling all methods in " + entry + " matching one of the following filters: " + include);
+                }
+                if (excludeMethodFilters != null && excludeMethodFilters.length > 0) {
+                    String exclude = Arrays.asList(excludeMethodFilters).stream().map(MethodFilter::toString).collect(Collectors.joining(", "));
+                    println("CompileTheWorld : Excluding all methods matching one of the following filters: " + exclude);
+                }
+                println();
+
+                URL url = new URL("jar", "", "file:" + entry + "!/");
+                ClassLoader loader = new URLClassLoader(new URL[]{url});
+
+                JarFile jarFile = new JarFile(entry);
+                Enumeration<JarEntry> e = jarFile.entries();
+
+                while (e.hasMoreElements()) {
+                    JarEntry je = e.nextElement();
+                    if (je.isDirectory() || !je.getName().endsWith(".class")) {
+                        continue;
+                    }
+
+                    // Are we done?
+                    if (classFileCounter >= stopAt) {
+                        break;
+                    }
+
+                    String className = je.getName().substring(0, je.getName().length() - ".class".length());
+                    String dottedClassName = className.replace('/', '.');
+                    classFileCounter++;
+
+                    if (methodFilters != null && !MethodFilter.matchesClassName(methodFilters, dottedClassName)) {
+                        continue;
+                    }
+                    if (excludeMethodFilters != null && MethodFilter.matchesClassName(excludeMethodFilters, dottedClassName)) {
+                        continue;
+                    }
+
+                    if (dottedClassName.startsWith("jdk.management.") || dottedClassName.startsWith("jdk.internal.cmm.*")) {
+                        continue;
+                    }
+
+                    try {
+                        // Load and initialize class
+                        Class<?> javaClass = Class.forName(dottedClassName, true, loader);
+
+                        // Pre-load all classes in the constant pool.
+                        try {
+                            HotSpotResolvedObjectType objectType = HotSpotResolvedObjectTypeImpl.fromObjectClass(javaClass);
+                            ConstantPool constantPool = objectType.constantPool();
+                            for (int cpi = 1; cpi < constantPool.length(); cpi++) {
+                                constantPool.loadReferencedType(cpi, HotSpotConstantPool.Bytecodes.LDC);
+                            }
+                        } catch (Throwable t) {
+                            // If something went wrong during pre-loading we just ignore it.
+                            println("Preloading failed for (%d) %s: %s", classFileCounter, className, t);
+                        }
+
+                        // Are we compiling this class?
+                        MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
+                        if (classFileCounter >= startAt) {
+                            println("CompileTheWorld (%d) : %s", classFileCounter, className);
+
+                            // Compile each constructor/method in the class.
+                            for (Constructor<?> constructor : javaClass.getDeclaredConstructors()) {
+                                HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(constructor);
+                                if (canBeCompiled(javaMethod, constructor.getModifiers())) {
+                                    compileMethod(javaMethod);
+                                }
+                            }
+                            for (Method method : javaClass.getDeclaredMethods()) {
+                                HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(method);
+                                if (canBeCompiled(javaMethod, method.getModifiers())) {
+                                    compileMethod(javaMethod);
+                                }
+                            }
+                        }
+                    } catch (Throwable t) {
+                        println("CompileTheWorld (%d) : Skipping %s %s", classFileCounter, className, t.toString());
+                        t.printStackTrace();
+                    }
+                }
+                jarFile.close();
+            }
+        }
+
+        if (!running) {
+            startThreads();
+        }
+        int wakeups = 0;
+        while (threadPool.getCompletedTaskCount() != threadPool.getTaskCount()) {
+            if (wakeups % 15 == 0) {
+                TTY.println("CompileTheWorld : Waiting for " + (threadPool.getTaskCount() - threadPool.getCompletedTaskCount()) + " compiles");
+            }
+            try {
+                threadPool.awaitTermination(1, TimeUnit.SECONDS);
+                wakeups++;
+            } catch (InterruptedException e) {
+            }
+        }
+        threadPool = null;
+
+        long elapsedTime = System.currentTimeMillis() - start;
+
+        println();
+        if (Options.CompileTheWorldMultiThreaded.getValue()) {
+            TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms elapsed, %d ms compile time, %d bytes of memory used)", classFileCounter, compiledMethodsCounter.get(), elapsedTime,
+                            compileTime.get(), memoryUsed.get());
+        } else {
+            TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms, %d bytes of memory used)", classFileCounter, compiledMethodsCounter.get(), compileTime.get(), memoryUsed.get());
+        }
+    }
+
+    private synchronized void startThreads() {
+        running = true;
+        // Wake up any waiting threads
+        notifyAll();
+    }
+
+    private synchronized void waitToRun() {
+        while (!running) {
+            try {
+                wait();
+            } catch (InterruptedException e) {
+            }
+        }
+    }
+
+    private void compileMethod(HotSpotResolvedJavaMethod method) throws InterruptedException, ExecutionException {
+        if (methodFilters != null && !MethodFilter.matches(methodFilters, method)) {
+            return;
+        }
+        if (excludeMethodFilters != null && MethodFilter.matches(excludeMethodFilters, method)) {
+            return;
+        }
+        Future<?> task = threadPool.submit(new Runnable() {
+            public void run() {
+                waitToRun();
+                try (OverrideScope s = config.apply()) {
+                    compileMethod(method, classFileCounter);
+                }
+            }
+        });
+        if (threadPool.getCorePoolSize() == 1) {
+            task.get();
+        }
+    }
+
+    /**
+     * Compiles a method and gathers some statistics.
+     */
+    private void compileMethod(HotSpotResolvedJavaMethod method, int counter) {
+        try {
+            long start = System.currentTimeMillis();
+            long allocatedAtStart = getCurrentThreadAllocatedBytes();
+
+            CompilationTask task = new CompilationTask(method, Compiler.INVOCATION_ENTRY_BCI, 0L, method.allocateCompileId(Compiler.INVOCATION_ENTRY_BCI), false);
+            task.runCompilation();
+
+            memoryUsed.getAndAdd(getCurrentThreadAllocatedBytes() - allocatedAtStart);
+            compileTime.getAndAdd(System.currentTimeMillis() - start);
+            compiledMethodsCounter.incrementAndGet();
+        } catch (Throwable t) {
+            // Catch everything and print a message
+            println("CompileTheWorld (%d) : Error compiling method: %s", counter, method.format("%H.%n(%p):%r"));
+            t.printStackTrace(TTY.out);
+        }
+    }
+
+    /**
+     * Determines if a method should be compiled (Cf. CompilationPolicy::can_be_compiled).
+     *
+     * @return true if it can be compiled, false otherwise
+     */
+    private static boolean canBeCompiled(HotSpotResolvedJavaMethod javaMethod, int modifiers) {
+        if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
+            return false;
+        }
+        HotSpotVMConfig c = HotSpotJVMCIRuntime.runtime().getConfig();
+        if (c.dontCompileHugeMethods && javaMethod.getCodeSize() > c.hugeMethodLimit) {
+            return false;
+        }
+        // Allow use of -XX:CompileCommand=dontinline to exclude problematic methods
+        if (!javaMethod.canBeInlined()) {
+            return false;
+        }
+        // Skip @Snippets for now
+        for (Annotation annotation : javaMethod.getAnnotations()) {
+            if (annotation.annotationType().getName().equals("com.oracle.graal.replacements.Snippet")) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVM.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVMImpl.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,206 @@
+/*
+ * 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.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCodeCacheProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,242 @@
+/*
+ * 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 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.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 getMarkName(Mark mark) {
+        int markId = (int) mark.id;
+        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 CodeCacheProvider.super.getMarkName(mark);
+    }
+
+    /**
+     * Decodes a call target to a mnemonic if possible.
+     */
+    @Override
+    public 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 CodeCacheProvider.super.getTargetName(call);
+    }
+
+    @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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledCode.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledNmethod.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompressedNullConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantPool.java	Tue Jun 09 19:07:39 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}.
+     */
+    public 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantReflectionProvider.java	Tue Jun 09 19:07:39 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 the computed index or -1 if the offset isn't within the array
+     */
+    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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotForeignCallTarget.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotInstalledCode.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIBackendFactory.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.*;
+import com.oracle.jvmci.service.*;
+
+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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,326 @@
+/*
+ * 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.hotspot.logging.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.runtime.*;
+import com.oracle.jvmci.service.*;
+
+//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() {
+
+        // 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 final Iterable<HotSpotVMEventListener> vmEventListeners;
+
+    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));
+        }
+
+        Iterable<HotSpotVMEventListener> listeners = Services.load(HotSpotVMEventListener.class);
+        if (!listeners.iterator().hasNext()) {
+            listeners = Arrays.asList(new HotSpotVMEventListener() {
+            });
+        }
+        vmEventListeners = listeners;
+    }
+
+    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"})
+    private void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long jvmciEnv, int id) {
+        for (HotSpotVMEventListener vmEventListener : vmEventListeners) {
+            vmEventListener.compileMetaspaceMethod(metaspaceMethod, entryBCI, jvmciEnv, id);
+        }
+    }
+
+    /**
+     * Called from the VM.
+     */
+    @SuppressWarnings({"unused"})
+    private void compileTheWorld() throws Throwable {
+        for (HotSpotVMEventListener vmEventListener : vmEventListeners) {
+            vmEventListener.notifyCompileTheWorld();
+        }
+    }
+
+    /**
+     * Shuts down the runtime.
+     *
+     * Called from the VM.
+     */
+    @SuppressWarnings({"unused"})
+    private void shutdown() throws Exception {
+        for (HotSpotVMEventListener vmEventListener : vmEventListeners) {
+            vmEventListener.notifyShutdown();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIVMEventListener.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,58 @@
+/*
+ * 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.hotspot.CompileTheWorld.Options.*;
+
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.CompileTheWorld.Config;
+import com.oracle.jvmci.service.*;
+
+@ServiceProvider(HotSpotVMEventListener.class)
+public class HotSpotJVMCIVMEventListener implements HotSpotVMEventListener {
+
+    @Override
+    public void notifyCompileTheWorld() throws Throwable {
+        CompilerToVM compilerToVM = HotSpotJVMCIRuntime.runtime().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() {
+        // nothing to do
+    }
+
+    @Override
+    public void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long jvmciEnv, int id) {
+        HotSpotResolvedJavaMethod method = HotSpotResolvedJavaMethodImpl.fromMetaspace(metaspaceMethod);
+        CompilationTask.compileMethod(method, entryBCI, jvmciEnv, id);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJavaType.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMemoryAccessProvider.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMemoryAccessProviderImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaAccessProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,326 @@
+/*
+ * 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.*;
+
+// JaCoCo Exclude
+
+/**
+ * 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaspaceConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaspaceConstantImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethod.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,68 @@
+/*
+ * 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.debug.*;
+import com.oracle.jvmci.meta.*;
+
+public abstract class HotSpotMethod implements JavaMethod, Formattable, JavaMethodContex {
+
+    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));
+    }
+
+    public JavaMethod asJavaMethod() {
+        return this;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodData.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodDataAccessor.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodHandleAccessProvider.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodUnresolved.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotNmethod.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotObjectConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotObjectConstantImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotOptions.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,55 @@
+/*
+ * 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.*;
+
+//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 : ServiceLoader.load(Options.class, HotSpotOptions.class.getClassLoader())) {
+            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();
+            }
+        }
+
+        OptionUtils.printFlags(options, JVMCI_OPTION_PREFIX);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotProfilingInfo.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotProxified.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotReferenceMap.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,109 @@
+/*
+ * 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.code.ValueUtil.*;
+
+import java.util.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+
+public final class HotSpotReferenceMap extends ReferenceMap {
+
+    private Value[] objects;
+    private int[] bytesPerElement;
+    private int maxRegisterSize;
+    private ArrayList<Value> objectValues;
+
+    private final TargetDescription target;
+
+    public HotSpotReferenceMap(TargetDescription target) {
+        this.target = target;
+        this.objects = Value.NO_VALUES;
+    }
+
+    @Override
+    public void reset() {
+        objectValues = new ArrayList<>();
+        objects = Value.NO_VALUES;
+        bytesPerElement = null;
+        maxRegisterSize = 0;
+    }
+
+    @Override
+    public void addLiveValue(Value v) {
+        if (isConstant(v)) {
+            return;
+        }
+        LIRKind lirKind = v.getLIRKind();
+        if (!lirKind.isValue()) {
+            objectValues.add(v);
+        }
+        if (isRegister(v)) {
+            int size = target.getSizeInBytes(lirKind.getPlatformKind());
+            if (size > maxRegisterSize) {
+                maxRegisterSize = size;
+            }
+        }
+    }
+
+    @Override
+    public void finish() {
+        objects = objectValues.toArray(new Value[objectValues.size()]);
+        this.bytesPerElement = new int[objects.length];
+        for (int i = 0; i < objects.length; i++) {
+            bytesPerElement[i] = bytesPerElement(objects[i].getLIRKind());
+        }
+        objectValues = null;
+    }
+
+    private int bytesPerElement(LIRKind kind) {
+        PlatformKind platformKind = kind.getPlatformKind();
+        return target.getSizeInBytes(platformKind) / platformKind.getVectorLength();
+    }
+
+    @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 (Arrays.equals(objects, that.objects) && this.target.equals(that.target)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return Arrays.toString(objects);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaField.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaFieldImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethod.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,116 @@
+/*
+ * 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.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);
+
+    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);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,750 @@
+/*
+ * 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.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("jvmci.traceMethodDataFilter");
+
+    @Override
+    public 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 JVMCI 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaType.java	Tue Jun 09 19:07:39 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 JVMCI 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedObjectType.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java	Tue Jun 09 19:07:39 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 JVMCI 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 JVMCI 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 JVMCI 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedPrimitiveType.java	Tue Jun 09 19:07:39 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 JVMCI 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSignature.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSpeculationLog.java	Tue Jun 09 19:07:39 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.hotspot;
+
+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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotStackFrameReference.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotTTYStreamProvider.java	Tue Jun 09 19:07:39 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 java.io.*;
+
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.Options;
+import com.oracle.jvmci.service.*;
+
+@ServiceProvider(TTYStreamProvider.class)
+class HotSpotTTYStreamProvider implements TTYStreamProvider {
+
+    public PrintStream getStream() {
+        return Options.LogFile.getStream();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotTargetDescription.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,37 @@
+/*
+ * 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 com.oracle.jvmci.code.*;
+
+public class HotSpotTargetDescription extends TargetDescription {
+
+    public HotSpotTargetDescription(Architecture arch, boolean isMP, int stackAlignment, int implicitNullCheckLimit, boolean inlineObjects) {
+        super(arch, isMP, stackAlignment, implicitNullCheckLimit, inlineObjects);
+    }
+
+    @Override
+    public ReferenceMap createReferenceMap(boolean hasRegisters, int stackSlotCount) {
+        return new HotSpotReferenceMap(this);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotUnresolvedField.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotUnresolvedJavaType.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMConfig.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMConfigVerifier.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMEventListener.java	Tue Jun 09 19:07:39 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.jvmci.hotspot;
+
+import com.oracle.jvmci.service.*;
+
+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.
+     *
+     * @param metaspaceMethod
+     * @param entryBCI
+     * @param jvmciEnv
+     * @param id
+     */
+    default void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long jvmciEnv, int id) {
+    }
+
+    /**
+     * Notifies this client that HotSpot is running in CompileTheWorld mode and the JVMCI compiler
+     * should now perform its version of CompileTheWorld.
+     */
+    default void notifyCompileTheWorld() throws Throwable {
+    }
+
+    /**
+     * Notifies this client that the VM is shutting down.
+     */
+    default void notifyShutdown() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVmSymbols.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/InitTimer.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/PrintStreamOption.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,146 @@
+/*
+ * 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()} 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() {
+        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() {
+                    CompilerToVM vm;
+
+                    private CompilerToVM vm() {
+                        if (vm == null) {
+                            vm = HotSpotJVMCIRuntime.runtime().getCompilerToVM();
+                        }
+                        return vm;
+                    }
+
+                    @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;
+                        }
+                        vm().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 {
+                        vm().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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/Stable.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/events/EmptyEventProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,105 @@
+/*
+ * 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.events;
+
+import com.oracle.jvmci.common.*;
+
+/**
+ * An empty implementation for {@link EventProvider}. This implementation is used when no logging is
+ * requested.
+ */
+public final class EmptyEventProvider implements EventProvider {
+
+    public CompilationEvent newCompilationEvent() {
+        return new EmptyCompilationEvent();
+    }
+
+    public static class EmptyCompilationEvent implements CompilationEvent {
+        public void commit() {
+            throw JVMCIError.shouldNotReachHere();
+        }
+
+        public boolean shouldWrite() {
+            // Events of this class should never been written.
+            return false;
+        }
+
+        public void begin() {
+        }
+
+        public void end() {
+        }
+
+        public void setMethod(String method) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+
+        public void setCompileId(int compileId) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+
+        public void setCompileLevel(int compileLevel) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+
+        public void setSucceeded(boolean succeeded) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+
+        public void setIsOsr(boolean isOsr) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+
+        public void setCodeSize(int codeSize) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+
+        public void setInlinedBytes(int inlinedBytes) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+    }
+
+    public CompilerFailureEvent newCompilerFailureEvent() {
+        return new EmptyCompilerFailureEvent();
+    }
+
+    public static class EmptyCompilerFailureEvent implements CompilerFailureEvent {
+        public void commit() {
+            throw JVMCIError.shouldNotReachHere();
+        }
+
+        public boolean shouldWrite() {
+            // Events of this class should never been written.
+            return false;
+        }
+
+        public void setCompileId(int compileId) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+
+        public void setMessage(String message) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/events/EventProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,107 @@
+/*
+ * 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.events;
+
+import com.oracle.jvmci.service.*;
+
+/**
+ * A provider that provides a specific implementation for events that can be logged in the compiler.
+ */
+public interface EventProvider extends Service {
+
+    /**
+     * An instant event is an event that is not considered to have taken any time.
+     */
+    interface InstantEvent {
+        /**
+         * Commits the event.
+         */
+        void commit();
+
+        /**
+         * Determines if this particular event instance would be committed to the data stream right
+         * now if application called {@link #commit()}. This in turn depends on whether the event is
+         * enabled and possible other factors.
+         *
+         * @return if this event would be committed on a call to {@link #commit()}.
+         */
+        boolean shouldWrite();
+    }
+
+    /**
+     * Timed events describe an operation that somehow consumes time.
+     */
+    interface TimedEvent extends InstantEvent {
+        /**
+         * Starts the timing for this event.
+         */
+        void begin();
+
+        /**
+         * Ends the timing period for this event.
+         */
+        void end();
+    }
+
+    /**
+     * Creates a new {@link CompilationEvent}.
+     *
+     * @return a compilation event
+     */
+    CompilationEvent newCompilationEvent();
+
+    /**
+     * A compilation event.
+     */
+    interface CompilationEvent extends TimedEvent {
+        void setMethod(String method);
+
+        void setCompileId(int compileId);
+
+        void setCompileLevel(int compileLevel);
+
+        void setSucceeded(boolean succeeded);
+
+        void setIsOsr(boolean isOsr);
+
+        void setCodeSize(int codeSize);
+
+        void setInlinedBytes(int inlinedBytes);
+    }
+
+    /**
+     * Creates a new {@link CompilerFailureEvent}.
+     *
+     * @return a compiler failure event
+     */
+    CompilerFailureEvent newCompilerFailureEvent();
+
+    /**
+     * A compiler failure event.
+     */
+    interface CompilerFailureEvent extends InstantEvent {
+        void setCompileId(int compileId);
+
+        void setMessage(String message);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/CountingProxy.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/Logger.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/LoggingProxy.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/ProxyUtil.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/package-info.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspotvmconfig.processor/src/META-INF/services/javax.annotation.processing.Processor	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,1 @@
+com.oracle.jvmci.hotspotvmconfig.processor.HotSpotVMConfigProcessor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.hotspotvmconfig.processor/src/com/oracle/jvmci/hotspotvmconfig/processor/HotSpotVMConfigProcessor.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMField.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMFlag.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMType.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/overview.html	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractJavaProfile.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractProfiledItem.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractValue.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,98 @@
+/*
+ * 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.
+     */
+    public final boolean identityEquals(AbstractValue other) {
+        return this == other;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AllocatableValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Assumptions.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Constant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantPool.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantReflectionProvider.java	Tue Jun 09 19:07:39 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 be 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DefaultProfilingInfo.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DeoptimizationAction.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DeoptimizationReason.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ExceptionHandler.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ForeignCallDescriptor.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/InvokeTarget.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaField.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaMethod.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaMethodProfile.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaType.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaTypeProfile.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Kind.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/KindProvider.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LIRKind.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LineNumberTable.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LineNumberTableImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Local.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalVariableTable.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalVariableTableImpl.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocationIdentity.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MemoryAccessProvider.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MetaAccessProvider.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MetaUtil.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodHandleAccessProvider.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodIdHolder.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodIdMap.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ModifiersProvider.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/NamedLocationIdentity.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/NullConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/PlatformKind.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/PrimitiveConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ProfilingInfo.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/RawConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaField.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaMethod.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,316 @@
+/*
+ * 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 JVMCI 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.
+     */
+    default ProfilingInfo getProfilingInfo() {
+        return getProfilingInfo(true, true);
+    }
+
+    /**
+     * Returns an object that provides access to the profiling information recorded for this method.
+     *
+     * @param includeNormal if true,
+     *            {@linkplain ProfilingInfo#getDeoptimizationCount(DeoptimizationReason)
+     *            deoptimization counts} will include deoptimization that happened during execution
+     *            of standard non-osr methods.
+     * @param includeOSR if true,
+     *            {@linkplain ProfilingInfo#getDeoptimizationCount(DeoptimizationReason)
+     *            deoptimization counts} will include deoptimization that happened during execution
+     *            of on-stack-replacement methods.
+     */
+    ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR);
+
+    /**
+     * 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>");
+    }
+
+    SpeculationLog getSpeculationLog();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaType.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/SerializableConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Signature.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/SpeculationLog.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,68 @@
+/*
+ * 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.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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/TriState.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/TrustedInterface.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/VMConstant.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Value.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,69 @@
+/*
+ * 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 {
+
+    Value[] NO_VALUES = new Value[0];
+
+    AllocatableValue ILLEGAL = new IllegalValue();
+
+    public final class IllegalValue extends AllocatableValue {
+        private IllegalValue() {
+            super(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 instanceof IllegalValue;
+        }
+    }
+
+    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.
+     */
+    default boolean identityEquals(Value other) {
+        return this == other;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/package-info.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options.processor/src/META-INF/services/javax.annotation.processing.Processor	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,1 @@
+com.oracle.jvmci.options.processor.OptionProcessor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/JVMCIJars.java	Tue Jun 09 19:07:39 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 JVMCIJars implements Iterable<ZipEntry> {
+    private final List<ZipFile> jars = new ArrayList<>(2);
+
+    public JVMCIJars() {
+        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/jvmci/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/OptionProcessor.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options.test/src/com/oracle/jvmci/options/test/NestedBooleanOptionValueTest.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options.test/src/com/oracle/jvmci/options/test/TestOptionValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options/src/com/oracle/jvmci/options/DerivedOptionValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options/src/com/oracle/jvmci/options/NestedBooleanOptionValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options/src/com/oracle/jvmci/options/Option.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionDescriptor.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionType.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionUtils.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options/src/com/oracle/jvmci/options/Options.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionsLoader.java	Tue Jun 09 19:07:39 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.options;
+
+import java.util.*;
+
+/**
+ * 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 : ServiceLoader.load(Options.class, OptionsLoader.class.getClassLoader())) {
+            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/jvmci/com.oracle.jvmci.options/src/com/oracle/jvmci/options/StableOptionValue.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/ConstantTest.java	Tue Jun 09 19:07:39 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.jvmci.runtime.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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/FieldUniverse.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * 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.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 static final Map<Field, ResolvedJavaField> fields = new HashMap<>();
+
+    {
+        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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/MethodUniverse.java	Tue Jun 09 19:07:39 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.jvmci.runtime.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 static final Map<Method, ResolvedJavaMethod> methods = new HashMap<>();
+    public static final Map<Constructor<?>, ResolvedJavaMethod> constructors = new HashMap<>();
+
+    {
+        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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/NameAndSignature.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,87 @@
+/*
+ * 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.runtime.test;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.runtime.*;
+
+class NameAndSignature {
+
+    public static final MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,170 @@
+/*
+ * 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.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.runtime.*;
+
+public class ResolvedJavaTypeResolveConcreteMethodTest {
+    public final MetaAccessProvider metaAccess;
+
+    public ResolvedJavaTypeResolveConcreteMethodTest() {
+        metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/ResolvedJavaTypeResolveMethodTest.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,170 @@
+/*
+ * 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.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.runtime.*;
+
+public class ResolvedJavaTypeResolveMethodTest {
+    public final MetaAccessProvider metaAccess;
+
+    public ResolvedJavaTypeResolveMethodTest() {
+        metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestConstantReflectionProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,125 @@
+/*
+ * 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.runtime.test;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+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 (ConstantValue c1 : constants()) {
+            for (ConstantValue c2 : constants()) {
+                // test symmetry
+                assertEquals(constantReflection.constantEquals(c1.value, c2.value), constantReflection.constantEquals(c2.value, c1.value));
+                if (c1.value.getKind() != Kind.Object && c2.value.getKind() != Kind.Object) {
+                    assertEquals(c1.value.equals(c2.value), constantReflection.constantEquals(c2.value, c1.value));
+                }
+            }
+        }
+    }
+
+    @Test
+    public void readArrayLengthTest() {
+        for (ConstantValue cv : constants()) {
+            JavaConstant c = cv.value;
+            Integer actual = constantReflection.readArrayLength(c);
+            if (c.getKind() != Kind.Object || c.isNull() || !cv.boxed.getClass().isArray()) {
+                assertNull(actual);
+            } else {
+                assertNotNull(actual);
+                int actualInt = actual;
+                assertEquals(Array.getLength(cv.boxed), actualInt);
+            }
+        }
+    }
+
+    static class PrimitiveConstants {
+        static final long LONG_CONST = 42;
+        static final int INT_CONST = 66;
+        static final byte BYTE_CONST = 123;
+        static final boolean BOOL_CONST = true;
+    }
+
+    static class BoxedConstants {
+        static final Long LONG_CONST = 42L;
+        static final Integer INT_CONST = 66;
+        static final Byte BYTE_CONST = 123;
+        static final Boolean BOOL_CONST = true;
+    }
+
+    @Test
+    public void boxTest() {
+        for (ConstantValue cv : constants()) {
+            JavaConstant c = cv.value;
+            JavaConstant boxed = constantReflection.boxPrimitive(c);
+            if (boxed != null && c.getKind().isPrimitive()) {
+                assertTrue(boxed.getKind().isObject());
+                assertFalse(boxed.isNull());
+            }
+        }
+
+        List<ConstantValue> primitiveConstants = readConstants(PrimitiveConstants.class);
+        List<ConstantValue> boxedConstants = readConstants(BoxedConstants.class);
+        for (int i = 0; i < primitiveConstants.size(); i++) {
+            ConstantValue prim = primitiveConstants.get(i);
+            ConstantValue box = boxedConstants.get(i);
+            assertEquals(box.value, constantReflection.boxPrimitive(prim.value));
+        }
+
+        assertNull(constantReflection.boxPrimitive(JavaConstant.NULL_POINTER));
+    }
+
+    @Test
+    public void unboxTest() {
+        for (ConstantValue cv : constants()) {
+            JavaConstant c = cv.value;
+            JavaConstant unboxed = c.isNull() ? null : constantReflection.unboxPrimitive(c);
+            if (unboxed != null) {
+                assertFalse(unboxed.getKind().isObject());
+            }
+        }
+        List<ConstantValue> primitiveConstants = readConstants(PrimitiveConstants.class);
+        List<ConstantValue> boxedConstants = readConstants(BoxedConstants.class);
+        for (int i = 0; i < primitiveConstants.size(); i++) {
+            ConstantValue prim = primitiveConstants.get(i);
+            ConstantValue box = boxedConstants.get(i);
+            assert prim.getSimpleName().equals(box.getSimpleName());
+            assertEquals(prim.value, constantReflection.unboxPrimitive(box.value));
+        }
+
+        assertNull(constantReflection.unboxPrimitive(JavaConstant.NULL_POINTER));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestJavaField.java	Tue Jun 09 19:07:39 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.jvmci.runtime.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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestJavaMethod.java	Tue Jun 09 19:07:39 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.jvmci.runtime.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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestJavaType.java	Tue Jun 09 19:07:39 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.jvmci.runtime.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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestMetaAccessProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,94 @@
+/*
+ * 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.runtime.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 (ConstantValue cv : constants()) {
+            JavaConstant c = cv.value;
+            if (c.getKind() == Kind.Object && !c.isNull()) {
+                Object o = cv.boxed;
+                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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestResolvedJavaField.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,145 @@
+/*
+ * 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.runtime.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);
+        }
+    }
+
+    static class ReadConstantValueTestConstants {
+        String stringField = "field";
+        final String constantStringField = "constantField";
+
+        static final Object CONST1 = new ReadConstantValueTestConstants();
+        static final Object CONST2 = null;
+        static final Object CONST3 = new String();
+    }
+
+    @Test
+    public void readConstantValueTest() throws NoSuchFieldException {
+        ResolvedJavaField field = metaAccess.lookupJavaField(ReadConstantValueTestConstants.class.getDeclaredField("stringField"));
+        List<ConstantValue> receiverConstants = readConstants(ReadConstantValueTestConstants.class);
+        for (ConstantValue receiver : receiverConstants) {
+            JavaConstant value = constantReflection.readConstantFieldValue(field, receiver.value);
+            assertNull(value);
+        }
+
+        ResolvedJavaField constField = metaAccess.lookupJavaField(ReadConstantValueTestConstants.class.getDeclaredField("constantStringField"));
+        for (ConstantValue receiver : receiverConstants) {
+            JavaConstant value = constantReflection.readConstantFieldValue(constField, receiver.value);
+            if (value != null) {
+                Object expected = "constantField";
+                String actual = ((ReadConstantValueTestConstants) receiver.boxed).constantStringField;
+                assertTrue(actual + " != " + expected, actual == expected);
+            }
+        }
+    }
+
+    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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestResolvedJavaMethod.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,381 @@
+/*
+ * 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.runtime.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",
+        "getSpeculationLog",
+        "$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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TestResolvedJavaType.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,874 @@
+/*
+ * 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.runtime.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.jvmci.common.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * 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 (ConstantValue cv : constants()) {
+            JavaConstant c = cv.value;
+            if (c.getKind() == Kind.Object && !c.isNull()) {
+                ResolvedJavaType cType = metaAccess.lookupJavaType(c);
+                for (ResolvedJavaType t : javaTypes) {
+                    if (t.isAssignableFrom(cType)) {
+                        assertTrue(t.isInstance(c));
+                    } else {
+                        assertFalse(t.isInstance(c));
+                    }
+                }
+            }
+        }
+    }
+
+    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 static 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/jvmci/com.oracle.jvmci.runtime.test/src/com/oracle/jvmci/runtime/test/TypeUniverse.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,205 @@
+/*
+ * 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.runtime.test;
+
+import static java.lang.reflect.Modifier.*;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.Queue;
+import java.util.stream.*;
+
+import org.junit.*;
+
+import sun.misc.*;
+
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.runtime.*;
+
+//JaCoCo Exclude
+
+/**
+ * Context for type related tests.
+ */
+public class TypeUniverse {
+
+    public static final Unsafe unsafe;
+    public static final double JAVA_VERSION = Double.valueOf(System.getProperty("java.specification.version"));
+
+    public static final MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
+    public static final ConstantReflectionProvider constantReflection = JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection();
+    public static final Collection<Class<?>> classes = new HashSet<>();
+    public static final Set<ResolvedJavaType> javaTypes;
+    public static final Map<Class<?>, Class<?>> arrayClasses = new HashMap<>();
+
+    private static List<ConstantValue> constants;
+
+    static {
+        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);
+        }
+
+        javaTypes = Collections.unmodifiableSet(classes.stream().map(c -> metaAccess.lookupJavaType(c)).collect(Collectors.toSet()));
+    }
+
+    static class ConstantsUniverse {
+        static final Object[] ARRAYS = classes.stream().map(c -> c != void.class && !c.isArray() ? Array.newInstance(c, 42) : null).filter(o -> o != null).collect(Collectors.toList()).toArray();
+        static final Object CONST1 = new ArrayList<>();
+        static final Object CONST2 = new ArrayList<>();
+        static final Object CONST3 = new IdentityHashMap<>();
+        static final Object CONST4 = new LinkedHashMap<>();
+        static final Object CONST5 = new TreeMap<>();
+        static final Object CONST6 = new ArrayDeque<>();
+        static final Object CONST7 = new LinkedList<>();
+        static final Object CONST8 = "a string";
+        static final Object CONST9 = 42;
+        static final Object CONST10 = String.class;
+        static final Object CONST11 = String[].class;
+    }
+
+    public static List<ConstantValue> constants() {
+        if (constants == null) {
+            List<ConstantValue> res = readConstants(JavaConstant.class);
+            res.addAll(readConstants(ConstantsUniverse.class));
+            constants = res;
+        }
+        return constants;
+    }
+
+    public static class ConstantValue {
+        public final String name;
+        public final JavaConstant value;
+        public final Object boxed;
+
+        public ConstantValue(String name, JavaConstant value, Object boxed) {
+            this.name = name;
+            this.value = value;
+            this.boxed = boxed;
+        }
+
+        @Override
+        public String toString() {
+            return name + "=" + value;
+        }
+
+        public String getSimpleName() {
+            return name.substring(name.lastIndexOf('.') + 1);
+        }
+    }
+
+    /**
+     * Reads the value of all {@code static final} fields from a given class into an array of
+     * {@link ConstantValue}s.
+     */
+    public static List<ConstantValue> readConstants(Class<?> fromClass) {
+        try {
+            List<ConstantValue> res = new ArrayList<>();
+            for (Field field : fromClass.getDeclaredFields()) {
+                if (isStatic(field.getModifiers()) && isFinal(field.getModifiers())) {
+                    JavaField javaField = metaAccess.lookupJavaField(field);
+                    Object boxed = field.get(null);
+                    if (boxed instanceof JavaConstant) {
+                        res.add(new ConstantValue(javaField.format("%H.%n"), (JavaConstant) boxed, boxed));
+                    } else {
+                        JavaConstant value = constantReflection.readConstantFieldValue(javaField, null);
+                        if (value != null) {
+                            res.add(new ConstantValue(javaField.format("%H.%n"), value, boxed));
+                            if (boxed instanceof Object[]) {
+                                Object[] arr = (Object[]) boxed;
+                                for (int i = 0; i < arr.length; i++) {
+                                    JavaConstant element = constantReflection.readArrayElement(value, i);
+                                    if (element != null) {
+                                        res.add(new ConstantValue(javaField.format("%H.%n[" + i + "]"), element, arr[i]));
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            return res;
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    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 static 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);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCI.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCIBackend.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCIRuntime.java	Tue Jun 09 19:07:39 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/jvmci/com.oracle.jvmci.service.processor/src/META-INF/services/javax.annotation.processing.Processor	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,1 @@
+com.oracle.jvmci.service.processor.ServiceProviderProcessor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.service.processor/src/com/oracle/jvmci/service/processor/ServiceProviderProcessor.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,119 @@
+/*
+ * 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.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.jvmci.service.*;
+
+@SupportedAnnotationTypes("com.oracle.jvmci.service.ServiceProvider")
+public class ServiceProviderProcessor extends AbstractProcessor {
+
+    private final Set<TypeElement> processed = new HashSet<>();
+    private TypeElement baseJVMCIServiceInterface;
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    private boolean verifyAnnotation(TypeMirror serviceInterface, TypeElement serviceProvider) {
+        if (!processingEnv.getTypeUtils().isSubtype(serviceProvider.asType(), baseJVMCIServiceInterface.asType())) {
+            String msg = String.format("Service implementation class %s must implement %s", serviceProvider.getSimpleName(), baseJVMCIServiceInterface);
+            processingEnv.getMessager().printMessage(Kind.ERROR, msg, serviceProvider);
+            return false;
+        }
+        if (!processingEnv.getTypeUtils().isSubtype(serviceProvider.asType(), serviceInterface)) {
+            String msg = String.format("Service provider class %s must 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;
+        }
+
+        baseJVMCIServiceInterface = processingEnv.getElementUtils().getTypeElement("com.oracle.jvmci.service.Service");
+
+        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/jvmci/com.oracle.jvmci.service/src/com/oracle/jvmci/service/JVMCIClassLoaderFactory.java	Tue Jun 09 19:07:39 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.service;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * Utility called from the VM to create and register a separate class loader for loading JVMCI
+ * classes (i.e., those in found in lib/jvmci/*.jar).
+ */
+class JVMCIClassLoaderFactory {
+
+    /**
+     * 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/jvmci/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Service.java	Tue Jun 09 19:07:39 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.service;
+
+/**
+ * Marker interface for a service implementation that can be loaded by {@link Services#load(Class)}
+ * or {@link Services#loadSingle(Class, boolean)}. These implementations are hidden behind a class
+ * loader not accessible to applications. For this reason, {@link Services#load(Class)} and
+ * {@link Services#loadSingle(Class, boolean)} perform {@link SecurityManager} checks.
+ *
+ * @see Services
+ * @see ServiceProvider
+ */
+public interface Service {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.service/src/com/oracle/jvmci/service/ServiceProvider.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,36 @@
+/*
+ * 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.service;
+
+import java.lang.annotation.*;
+
+/**
+ * Annotates a JVMCI implementation of a service. This annotation is used by the JVMCI build system
+ * to deploy the necessary files used to {@linkplain Services#load(Class) load} services at runtime.
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface ServiceProvider {
+
+    Class<?> value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,130 @@
+/*
+ * 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.service;
+
+import java.util.*;
+
+import sun.reflect.*;
+
+/**
+ * An mechanism for loading services that have a {@linkplain Service JVMCI implementation}.
+ */
+public class Services {
+
+    private static final String SUPPRESS_PROPERTY_NAME = "jvmci.service.suppressNoClassDefFoundError";
+
+    /**
+     * Determines whether to suppress the {@link NoClassDefFoundError} raised if a service
+     * implementation class specified in a {@code <jre>/jvmci/services/*} file is missing.
+     */
+    private static final boolean SuppressNoClassDefFoundError = Boolean.getBoolean(SUPPRESS_PROPERTY_NAME);
+
+    private static final ClassValue<List<?>> cache = new ClassValue<List<?>>() {
+        @Override
+        protected List<?> computeValue(Class<?> type) {
+            try {
+                return Arrays.asList(getServiceImpls(type));
+            } catch (NoClassDefFoundError e) {
+                if (SuppressNoClassDefFoundError) {
+                    return Collections.emptyList();
+                } else {
+                    NoClassDefFoundError newEx = new NoClassDefFoundError(e.getMessage() + "  (suppress with -D" + SUPPRESS_PROPERTY_NAME + "=true)");
+                    if (e.getCause() != null) {
+                        newEx.initCause(e.getCause());
+                    }
+                    throw newEx;
+                }
+            }
+        }
+    };
+
+    /**
+     * Gets an {@link Iterable} of the JVMCI implementations available for a given service.
+     *
+     * @throws SecurityException if a security manager is present and it denies
+     *             <tt>{@link RuntimePermission}("jvmciServices")</tt>
+     */
+    @SuppressWarnings("unchecked")
+    @CallerSensitive
+    public static <S> Iterable<S> load(Class<S> service) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new RuntimePermission("jvmciServices"));
+        }
+        try {
+            return (Iterable<S>) cache.get(service);
+        } catch (UnsatisfiedLinkError e) {
+            return Collections.emptyList();
+        }
+    }
+
+    /**
+     * Gets the JVMCI implementation for a given service for which at most one implementation must
+     * be available.
+     *
+     * @param service the service whose implementation is being requested
+     * @param required specifies if an {@link InternalError} should be thrown if no implementation
+     *            of {@code service} is available
+     * @throws SecurityException if a security manager is present and it denies
+     *             <tt>{@link RuntimePermission}("jvmciServices")</tt>
+     */
+    @SuppressWarnings({"unchecked"})
+    @CallerSensitive
+    public static <S> S loadSingle(Class<S> service, boolean required) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new RuntimePermission("jvmciServices"));
+        }
+        Iterable<S> impls;
+        try {
+            impls = (Iterable<S>) cache.get(service);
+        } catch (UnsatisfiedLinkError e) {
+            impls = Collections.emptyList();
+        }
+
+        S singleImpl = null;
+        for (S impl : impls) {
+            if (singleImpl != null) {
+                throw new InternalError(String.format("Multiple %s implementations found: %s, %s", service.getName(), singleImpl.getClass().getName(), impl.getClass().getName()));
+            }
+            singleImpl = impl;
+        }
+        if (singleImpl == null && required) {
+            String javaHome = System.getProperty("java.home");
+            String vmName = System.getProperty("java.vm.name");
+            Formatter errorMessage = new Formatter();
+            errorMessage.format("The VM does not expose required service %s.%n", service.getName());
+            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 singleImpl;
+    }
+
+    static {
+        Reflection.registerMethodsToFilter(Services.class, "getServiceImpls");
+        Reflection.registerFieldsToFilter(Services.class, "cache");
+    }
+
+    private static native <S> S[] getServiceImpls(Class<?> service);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/com.oracle.jvmci.sparc/src/com/oracle/jvmci/sparc/SPARC.java	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,337 @@
+/*
+ * 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.sparc;
+
+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.jvmci.code.Register.RegisterCategory;
+
+/**
+ * Represents the SPARC architecture.
+ */
+public class SPARC extends Architecture {
+
+    public static final RegisterCategory CPU = new RegisterCategory("CPU");
+
+    // General purpose registers
+    public static final Register r0 = new Register(0, 0, "g0", CPU);
+    public static final Register r1 = new Register(1, 1, "g1", CPU);
+    public static final Register r2 = new Register(2, 2, "g2", CPU);
+    public static final Register r3 = new Register(3, 3, "g3", CPU);
+    public static final Register r4 = new Register(4, 4, "g4", CPU);
+    public static final Register r5 = new Register(5, 5, "g5", CPU);
+    public static final Register r6 = new Register(6, 6, "g6", CPU);
+    public static final Register r7 = new Register(7, 7, "g7", CPU);
+
+    public static final Register r8 = new Register(8, 8, "o0", CPU);
+    public static final Register r9 = new Register(9, 9, "o1", CPU);
+    public static final Register r10 = new Register(10, 10, "o2", CPU);
+    public static final Register r11 = new Register(11, 11, "o3", CPU);
+    public static final Register r12 = new Register(12, 12, "o4", CPU);
+    public static final Register r13 = new Register(13, 13, "o5", CPU);
+    public static final Register r14 = new Register(14, 14, "o6", CPU);
+    public static final Register r15 = new Register(15, 15, "o7", CPU);
+
+    public static final Register r16 = new Register(16, 16, "l0", CPU);
+    public static final Register r17 = new Register(17, 17, "l1", CPU);
+    public static final Register r18 = new Register(18, 18, "l2", CPU);
+    public static final Register r19 = new Register(19, 19, "l3", CPU);
+    public static final Register r20 = new Register(20, 20, "l4", CPU);
+    public static final Register r21 = new Register(21, 21, "l5", CPU);
+    public static final Register r22 = new Register(22, 22, "l6", CPU);
+    public static final Register r23 = new Register(23, 23, "l7", CPU);
+
+    public static final Register r24 = new Register(24, 24, "i0", CPU);
+    public static final Register r25 = new Register(25, 25, "i1", CPU);
+    public static final Register r26 = new Register(26, 26, "i2", CPU);
+    public static final Register r27 = new Register(27, 27, "i3", CPU);
+    public static final Register r28 = new Register(28, 28, "i4", CPU);
+    public static final Register r29 = new Register(29, 29, "i5", CPU);
+    public static final Register r30 = new Register(30, 30, "i6", CPU);
+    public static final Register r31 = new Register(31, 31, "i7", CPU);
+
+    public static final Register g0 = r0;
+    public static final Register g1 = r1;
+    public static final Register g2 = r2;
+    public static final Register g3 = r3;
+    public static final Register g4 = r4;
+    public static final Register g5 = r5;
+    public static final Register g6 = r6;
+    public static final Register g7 = r7;
+
+    public static final Register o0 = r8;
+    public static final Register o1 = r9;
+    public static final Register o2 = r10;
+    public static final Register o3 = r11;
+    public static final Register o4 = r12;
+    public static final Register o5 = r13;
+    public static final Register o6 = r14;
+    public static final Register o7 = r15;
+
+    public static final Register l0 = r16;
+    public static final Register l1 = r17;
+    public static final Register l2 = r18;
+    public static final Register l3 = r19;
+    public static final Register l4 = r20;
+    public static final Register l5 = r21;
+    public static final Register l6 = r22;
+    public static final Register l7 = r23;
+
+    public static final Register i0 = r24;
+    public static final Register i1 = r25;
+    public static final Register i2 = r26;
+    public static final Register i3 = r27;
+    public static final Register i4 = r28;
+    public static final Register i5 = r29;
+    public static final Register i6 = r30;
+    public static final Register i7 = r31;
+
+    public static final Register sp = o6;
+    public static final Register fp = i6;
+
+    // @formatter:off
+    public static final Register[] cpuRegisters = {
+        r0,  r1,  r2,  r3,  r4,  r5,  r6,  r7,
+        r8,  r9,  r10, r11, r12, r13, r14, r15,
+        r16, r17, r18, r19, r20, r21, r22, r23,
+        r24, r25, r26, r27, r28, r29, r30, r31
+    };
+    // @formatter:on
+
+    public static final RegisterCategory FPUs = new RegisterCategory("FPUs", cpuRegisters.length);
+    public static final RegisterCategory FPUd = new RegisterCategory("FPUd", cpuRegisters.length + 32);
+
+    // Floating point registers
+    public static final Register f0 = new Register(32, 0, "f0", FPUs);
+    public static final Register f1 = new Register(33, 1, "f1", FPUs);
+    public static final Register f2 = new Register(34, 2, "f2", FPUs);
+    public static final Register f3 = new Register(35, 3, "f3", FPUs);
+    public static final Register f4 = new Register(36, 4, "f4", FPUs);
+    public static final Register f5 = new Register(37, 5, "f5", FPUs);
+    public static final Register f6 = new Register(38, 6, "f6", FPUs);
+    public static final Register f7 = new Register(39, 7, "f7", FPUs);
+
+    public static final Register f8 = new Register(40, 8, "f8", FPUs);
+    public static final Register f9 = new Register(41, 9, "f9", FPUs);
+    public static final Register f10 = new Register(42, 10, "f10", FPUs);
+    public static final Register f11 = new Register(43, 11, "f11", FPUs);
+    public static final Register f12 = new Register(44, 12, "f12", FPUs);
+    public static final Register f13 = new Register(45, 13, "f13", FPUs);
+    public static final Register f14 = new Register(46, 14, "f14", FPUs);
+    public static final Register f15 = new Register(47, 15, "f15", FPUs);
+
+    public static final Register f16 = new Register(48, 16, "f16", FPUs);
+    public static final Register f17 = new Register(49, 17, "f17", FPUs);
+    public static final Register f18 = new Register(50, 18, "f18", FPUs);
+    public static final Register f19 = new Register(51, 19, "f19", FPUs);
+    public static final Register f20 = new Register(52, 20, "f20", FPUs);
+    public static final Register f21 = new Register(53, 21, "f21", FPUs);
+    public static final Register f22 = new Register(54, 22, "f22", FPUs);
+    public static final Register f23 = new Register(55, 23, "f23", FPUs);
+
+    public static final Register f24 = new Register(56, 24, "f24", FPUs);
+    public static final Register f25 = new Register(57, 25, "f25", FPUs);
+    public static final Register f26 = new Register(58, 26, "f26", FPUs);
+    public static final Register f27 = new Register(59, 27, "f27", FPUs);
+    public static final Register f28 = new Register(60, 28, "f28", FPUs);
+    public static final Register f29 = new Register(61, 29, "f29", FPUs);
+    public static final Register f30 = new Register(62, 30, "f30", FPUs);
+    public static final Register f31 = new Register(63, 31, "f31", FPUs);
+
+    public static final Register d0 = new Register(32, getDoubleEncoding(0), "d0", FPUs);
+    public static final Register d2 = new Register(34, getDoubleEncoding(2), "d2", FPUs);
+    public static final Register d4 = new Register(36, getDoubleEncoding(4), "d4", FPUs);
+    public static final Register d6 = new Register(38, getDoubleEncoding(6), "d6", FPUs);
+    public static final Register d8 = new Register(40, getDoubleEncoding(8), "d8", FPUs);
+    public static final Register d10 = new Register(42, getDoubleEncoding(10), "d10", FPUs);
+    public static final Register d12 = new Register(44, getDoubleEncoding(12), "d12", FPUs);
+    public static final Register d14 = new Register(46, getDoubleEncoding(14), "d14", FPUs);
+
+    public static final Register d16 = new Register(48, getDoubleEncoding(16), "d16", FPUs);
+    public static final Register d18 = new Register(50, getDoubleEncoding(18), "d18", FPUs);
+    public static final Register d20 = new Register(52, getDoubleEncoding(20), "d20", FPUs);
+    public static final Register d22 = new Register(54, getDoubleEncoding(22), "d22", FPUs);
+    public static final Register d24 = new Register(56, getDoubleEncoding(24), "d24", FPUs);
+    public static final Register d26 = new Register(58, getDoubleEncoding(26), "d26", FPUs);
+    public static final Register d28 = new Register(60, getDoubleEncoding(28), "d28", FPUs);
+    public static final Register d30 = new Register(62, getDoubleEncoding(28), "d28", FPUs);
+
+    public static final Register d32 = new Register(64, getDoubleEncoding(32), "d32", FPUd);
+    public static final Register d34 = new Register(65, getDoubleEncoding(34), "d34", FPUd);
+    public static final Register d36 = new Register(66, getDoubleEncoding(36), "d36", FPUd);
+    public static final Register d38 = new Register(67, getDoubleEncoding(38), "d38", FPUd);
+    public static final Register d40 = new Register(68, getDoubleEncoding(40), "d40", FPUd);
+    public static final Register d42 = new Register(69, getDoubleEncoding(42), "d42", FPUd);
+    public static final Register d44 = new Register(70, getDoubleEncoding(44), "d44", FPUd);
+    public static final Register d46 = new Register(71, getDoubleEncoding(46), "d46", FPUd);
+
+    public static final Register d48 = new Register(72, getDoubleEncoding(48), "d48", FPUd);
+    public static final Register d50 = new Register(73, getDoubleEncoding(50), "d50", FPUd);
+    public static final Register d52 = new Register(74, getDoubleEncoding(52), "d52", FPUd);
+    public static final Register d54 = new Register(75, getDoubleEncoding(54), "d54", FPUd);
+    public static final Register d56 = new Register(76, getDoubleEncoding(56), "d56", FPUd);
+    public static final Register d58 = new Register(77, getDoubleEncoding(58), "d58", FPUd);
+    public static final Register d60 = new Register(78, getDoubleEncoding(60), "d60", FPUd);
+    public static final Register d62 = new Register(79, getDoubleEncoding(62), "d62", FPUd);
+
+    // @formatter:off
+    public static final Register[] fpuRegisters = {
+        f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
+        f8,  f9,  f10, f11, f12, f13, f14, f15,
+        f16, f17, f18, f19, f20, f21, f22, f23,
+        f24, f25, f26, f27, f28, f29, f30, f31,
+        d32, d34, d36, d38, d40, d42, d44, d46,
+        d48, d50, d52, d54, d56, d58, d60, d62
+    };
+    // @formatter:on
+
+    // @formatter:off
+    public static final Register[] allRegisters = {
+        // CPU
+        r0,  r1,  r2,  r3,  r4,  r5,  r6,  r7,
+        r8,  r9,  r10, r11, r12, r13, r14, r15,
+        r16, r17, r18, r19, r20, r21, r22, r23,
+        r24, r25, r26, r27, r28, r29, r30, r31,
+        // FPU
+        f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,
+        f8,  f9,  f10, f11, f12, f13, f14, f15,
+        f16, f17, f18, f19, f20, f21, f22, f23,
+        f24, f25, f26, f27, f28, f29, f30, f31,
+        d32, d34, d36, d38, d40, d42, d44, d46,
+        d48, d50, d52, d54, d56, d58, d60, d62
+    };
+    // @formatter:on
+
+    /**
+     * Stack bias for stack and frame pointer loads.
+     */
+    public static final int STACK_BIAS = 0x7ff;
+    /**
+     * In fact there are 64 single floating point registers, 32 of them could be accessed. TODO:
+     * Improve handling of these float registers
+     */
+    public static final int FLOAT_REGISTER_COUNT = 64;
+
+    /**
+     * Alignment for valid memory access.
+     */
+    public static final int MEMORY_ACCESS_ALIGN = 4;
+
+    public final Set<CPUFeature> features;
+
+    public SPARC(Set<CPUFeature> features) {
+        super("SPARC", 8, ByteOrder.BIG_ENDIAN, false, allRegisters, LOAD_STORE | STORE_STORE, 1, r31.encoding + FLOAT_REGISTER_COUNT + 1, 8);
+        this.features = features;
+    }
+
+    @Override
+    public boolean canStoreValue(RegisterCategory category, PlatformKind lirKind) {
+        if (!(lirKind instanceof Kind)) {
+            return false;
+        }
+
+        Kind kind = (Kind) lirKind;
+        if (category.equals(CPU)) {
+            switch (kind) {
+                case Boolean:
+                case Byte:
+                case Char:
+                case Short:
+                case Int:
+                case Long:
+                case Object:
+                    return true;
+            }
+        } else if (category.equals(FPUs) && kind.equals(Kind.Float)) {
+            return true;
+        } else if (category.equals(FPUd) && kind.equals(Kind.Double)) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public PlatformKind getLargestStorableKind(RegisterCategory category) {
+        if (category.equals(CPU)) {
+            return Kind.Long;
+        } else if (category.equals(FPUs)) {
+            return Kind.Double;
+        } else {
+            return Kind.Illegal;
+        }
+    }
+
+    public static int spillSlotSize(TargetDescription td, PlatformKind kind) {
+        return Math.max(td.getSizeInBytes(kind), MEMORY_ACCESS_ALIGN);
+    }
+
+    public static int getDoubleEncoding(int reg) {
+        assert reg < 64 && ((reg & 1) == 0);
+        // ignore v8 assertion for now
+        return (reg & 0x1e) | ((reg & 0x20) >> 5);
+    }
+
+    public static boolean isCPURegister(Register r) {
+        return r.getRegisterCategory().equals(CPU);
+    }
+
+    public static boolean isCPURegister(Register... regs) {
+        for (Register reg : regs) {
+            if (!isCPURegister(reg)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static boolean isSingleFloatRegister(Register r) {
+        return r.name.startsWith("f");
+    }
+
+    public static boolean isDoubleFloatRegister(Register r) {
+        return r.name.startsWith("d");
+    }
+
+    public Set<CPUFeature> getFeatures() {
+        return features;
+    }
+
+    public boolean hasFeature(CPUFeature feature) {
+        return features.contains(feature);
+    }
+
+    public enum CPUFeature {
+        VIS1,
+        VIS2,
+        VIS3,
+        CBCOND
+    }
+}
Binary file jvmci/findbugs-SuppressFBWarnings.jar has changed
--- a/make/Makefile	Tue Jun 09 18:48:06 2015 -0700
+++ b/make/Makefile	Tue Jun 09 19:07:39 2015 -0700
@@ -309,25 +309,13 @@
 			$(MAKE_ARGS) $(VM_TARGET) 
 
 
-ifeq ($(JVMCI_USE_MAKE),)
-  ifeq (, $(shell python2.7 --version 2>/dev/null && echo ok))
-    ifeq (, $(shell python2.6 --version 2>/dev/null && echo ok))
-      PYTHON=python
-    else
-      PYTHON=python2.6
-    endif
-  else
-    PYTHON=python2.7
-  endif
-  
-  # Builds code that can be shared among different build flavors
 buildshared:
-	$(PYTHON) -u $(GAMMADIR)/mxtool/mx.py build --no-native --export-dir $(SHARED_DIR)
-else
-buildshared:
-	cd .. && $(MAKE) -f make/jvmci.make TARGET=build/make MX_TARGET=. HS_COMMON_SRC=$(HS_COMMON_SRC) JDK=$(ABS_BOOTDIR) EXPORT_DIR=$(SHARED_DIR) export
-endif
-
+	cd .. && \
+	$(MAKE) -f make/jvmci.make \
+		TARGET=build/make \
+		HS_COMMON_SRC=$(HS_COMMON_SRC) \
+		ABS_BOOTDIR=$(ABS_BOOTDIR) \
+		EXPORT_DIR=$(SHARED_DIR) export
 
 # Export file rule
 generic_export: $(EXPORT_LIST)
--- a/make/bsd/makefiles/vm.make	Tue Jun 09 18:48:06 2015 -0700
+++ b/make/bsd/makefiles/vm.make	Tue Jun 09 19:07:39 2015 -0700
@@ -219,7 +219,7 @@
   JVMCI_SPECIFIC_FILES   := jvmci\*
 else
   JVMCI_SPECIFIC_FILES   :=
-  Src_Dirs_I += $(HS_COMMON_SRC)/../graal/com.oracle.jvmci.hotspot/src_gen/hotspot
+  Src_Dirs_I += $(HS_COMMON_SRC)/../jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot
 endif
 
 # Always exclude these.
@@ -387,7 +387,10 @@
 DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)
 DEST_JVM_DIZ       = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
 
-install_jvm: $(LIBJVM)
+$(DEST_SUBDIR):
+	mkdir $(DEST_SUBDIR)
+
+install_jvm: $(LIBJVM) $(DEST_SUBDIR)
 	@echo "Copying $(LIBJVM) to $(DEST_JVM)"
 ifeq ($(OS_VENDOR), Darwin)
 	$(QUIETLY) test ! -d $(LIBJVM_DEBUGINFO) || \
--- a/make/defs.make	Tue Jun 09 18:48:06 2015 -0700
+++ b/make/defs.make	Tue Jun 09 19:07:39 2015 -0700
@@ -373,63 +373,9 @@
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.hotspot.HotSpotResolvedJavaFieldImpl
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.hotspot.HotSpotResolvedJavaMethodImpl
-
-ifeq ($(JVMCI_USE_MAKE),)
-EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/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_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.HotSpotVMEventListener
-
-EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.debug.DebugInitializationPropertyProvider
-
-EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.api.runtime.GraalRuntimeAccess
-EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.code.DisassemblerProvider
-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_JVMCI_SERVICES_DIR)/com.oracle.graal.truffle.LoopNodeFactory
-
-EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.truffle.api.TruffleRuntimeAccess
-EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.nfi.api.NativeFunctionInterfaceAccess
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.hotspot.CompileTheWorld
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.compiler.Compiler
 
-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.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.BytecodeParser
-endif
 
 .PHONY: $(HS_ALT_MAKE)/defs.make
 
--- a/make/hotspot_version	Tue Jun 09 18:48:06 2015 -0700
+++ b/make/hotspot_version	Tue Jun 09 19:07:39 2015 -0700
@@ -34,8 +34,8 @@
 HOTSPOT_VM_COPYRIGHT=Copyright 2015
 
 HS_MAJOR_VER=25
-HS_MINOR_VER=40
-HS_BUILD_NUMBER=25
+HS_MINOR_VER=45
+HS_BUILD_NUMBER=02
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/make/jvmci.make	Tue Jun 09 18:48:06 2015 -0700
+++ b/make/jvmci.make	Tue Jun 09 19:07:39 2015 -0700
@@ -1,46 +1,49 @@
-VERBOSE=
-TARGET=.
-JDK=
+# This Makefile is generated automatically, do not edit
+# This file was built with the command: mx.sh makefile -o ./make/jvmci.make
 
-WGET=wget
-JAVAC=$(JDK)/bin/javac -g -target 1.8
-JAR=$(JDK)/bin/jar
+TARGET=.
+# Bootstrap JDK to be used (for javac and jar)
+ABS_BOOTDIR=
 
-EXPORT_DIR=export
+JAVAC=$(ABS_BOOTDIR)/bin/javac -g -target 1.8
+JAR=$(ABS_BOOTDIR)/bin/jar
+
 EXPORTED_FILES_ADDITIONAL=$(TARGET)/options $(TARGET)/services
 HS_COMMON_SRC=.
-# where all other stuff built by mx (graal.jar) resides
-MX_TARGET=.
-PROVIDERS_INF=/META-INF/providers/
-SERVICES_INF=/META-INF/services/
-OPTIONS_INF=/META-INF/options/
 
-ifeq ($(JDK),)
-    $(error Variable JDK must be set to a JDK installation.)
-    endif
-    ifneq ($(VERBOSE),)
+# Directories, where the generated property-files reside within the JAR files
+PROVIDERS_INF=/META-INF/providers
+SERVICES_INF=/META-INF/services
+OPTIONS_INF=/META-INF/options
+
+ifeq ($(ABS_BOOTDIR),)
+    $(error Variable ABS_BOOTDIR must be set to a JDK installation.)
+endif
+ifneq ($(MAKE_VERBOSE),)
     SHELL=sh -x
 endif
 
-define process_options =
+define process_options
     $(eval providers=$(1)/$(PROVIDERS_INF))
     $(eval services=$(1)/$(SERVICES_INF))
     $(eval options=$(1)/$(OPTIONS_INF))
     test -d $(services) || mkdir -p $(services)
     test ! -d $(providers) || (cd $(providers) && for i in $$(ls); do c=$$(cat $$i); echo $$i >> $(abspath $(services))/$$c; rm $$i; done)
 
-    # We're building all projects together with one javac call; thus we cannot determine, from which project the generated file is thus we hardcode it for now
+    # Since all projects are built together with one javac call we cannot determine
+    # which project contains HotSpotVMConfig.inline.hpp so we hardcode it.
     $(eval vmconfig=$(1)/hotspot/HotSpotVMConfig.inline.hpp)
-    $(eval vmconfigDest=$(HS_COMMON_SRC)/../graal/com.oracle.jvmci.hotspot/src_gen/hotspot)
+    $(eval vmconfigDest=$(HS_COMMON_SRC)/../jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot)
     test ! -f $(vmconfig) || (mkdir -p $(vmconfigDest) && cp $(vmconfig) $(vmconfigDest))
 endef
 
-define extract =
+define extract
     $(eval TMP := $(shell mktemp -d $(1)_XXXXX))
-    mkdir -p $(2)
-    cd $(TMP) && $(JAR) xf $(abspath $(1)) &&         ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) &&  (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2))))
-    rm -r $(TMP)
-    cp $(1) $(2)
+    mkdir -p $(2);
+    cd $(TMP) && $(JAR) xf $(abspath $(1)) && \
+        ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) &&  (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2))));
+    rm -r $(TMP);
+    cp $(1) $(2);
 endef
 
 
@@ -53,120 +56,127 @@
 
 
 
-JDK_BOOTCLASSPATH = $(JDK)/jre/lib/resources.jar:$(JDK)/jre/lib/rt.jar:$(JDK)/jre/lib/jsse.jar:$(JDK)/jre/lib/jce.jar:$(JDK)/jre/lib/charsets.jar:$(JDK)/jre/lib/jfr.jar
+JDK_BOOTCLASSPATH = $(ABS_BOOTDIR)/jre/lib/resources.jar:$(ABS_BOOTDIR)/jre/lib/rt.jar:$(ABS_BOOTDIR)/jre/lib/jsse.jar:$(ABS_BOOTDIR)/jre/lib/jce.jar:$(ABS_BOOTDIR)/jre/lib/charsets.jar:$(ABS_BOOTDIR)/jre/lib/jfr.jar
 
-COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC = $(shell find graal/com.oracle.jvmci.hotspotvmconfig/src -type f -name *.java 2> /dev/null)
-COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find graal/com.oracle.jvmci.common/src -type f -name *.java 2> /dev/null)
-COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find graal/com.oracle.jvmci.hotspotvmconfig.processor/src -type f -name *.java 2> /dev/null)
+JVMCI_OPTIONS_PROCESSOR_SRC = $(shell find jvmci/com.oracle.jvmci.options/src -type f -name '*.java' 2> /dev/null)
+JVMCI_OPTIONS_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.options.processor/src -type f -name '*.java' 2> /dev/null)
 
-COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR = $(TARGET)/graal/com.oracle.jvmci.hotspotvmconfig.processor/ap/com.oracle.jvmci.hotspotvmconfig.processor.jar
+JVMCI_OPTIONS_PROCESSOR_JAR = $(TARGET)/jvmci/com.oracle.jvmci.options.processor/ap/com.oracle.jvmci.options.processor.jar
 
-COM_ORACLE_JVMCI_SERVICE_PROCESSOR_SRC = $(shell find graal/com.oracle.jvmci.service/src -type f -name *.java 2> /dev/null)
-COM_ORACLE_JVMCI_SERVICE_PROCESSOR_SRC += $(shell find graal/com.oracle.jvmci.service.processor/src -type f -name *.java 2> /dev/null)
-
-COM_ORACLE_JVMCI_SERVICE_PROCESSOR_JAR = $(TARGET)/graal/com.oracle.jvmci.service.processor/ap/com.oracle.jvmci.service.processor.jar
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC = $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.common/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig.processor/src -type f -name '*.java' 2> /dev/null)
 
-COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_SRC = $(shell find graal/com.oracle.jvmci.service/src -type f -name *.java 2> /dev/null)
-COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_SRC += $(shell find graal/com.oracle.jvmci.options/src -type f -name *.java 2> /dev/null)
-COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_SRC += $(shell find graal/com.oracle.jvmci.options.processor/src -type f -name *.java 2> /dev/null)
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR = $(TARGET)/jvmci/com.oracle.jvmci.hotspotvmconfig.processor/ap/com.oracle.jvmci.hotspotvmconfig.processor.jar
 
-COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_JAR = $(TARGET)/graal/com.oracle.jvmci.options.processor/ap/com.oracle.jvmci.options.processor.jar
+JVMCI_SERVICE_PROCESSOR_SRC = $(shell find jvmci/com.oracle.jvmci.service/src -type f -name '*.java' 2> /dev/null)
+JVMCI_SERVICE_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.service.processor/src -type f -name '*.java' 2> /dev/null)
+
+JVMCI_SERVICE_PROCESSOR_JAR = $(TARGET)/jvmci/com.oracle.jvmci.service.processor/ap/com.oracle.jvmci.service.processor.jar
 
-JVMCI_HOTSPOT_SRC = $(shell find graal/com.oracle.jvmci.hotspotvmconfig/src -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.hotspotvmconfig/graal/com.oracle.jvmci.hotspotvmconfig/src_gen -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.amd64/src -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.amd64/graal/com.oracle.jvmci.amd64/src_gen -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.hotspot/src -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.hotspot/graal/com.oracle.jvmci.hotspot/src_gen -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.hotspot.amd64/src -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.hotspot.amd64/graal/com.oracle.jvmci.hotspot.amd64/src_gen -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.sparc/src -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.sparc/graal/com.oracle.jvmci.sparc/src_gen -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.hotspot.sparc/src -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.hotspot.sparc/graal/com.oracle.jvmci.hotspot.sparc/src_gen -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.hotspot.jfr/src -type f -name *.java 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find graal/com.oracle.jvmci.hotspot.jfr/graal/com.oracle.jvmci.hotspot.jfr/src_gen -type f -name *.java 2> /dev/null)
+JVMCI_API_SRC = $(shell find jvmci/com.oracle.jvmci.meta/src -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.meta/jvmci/com.oracle.jvmci.meta/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.code/src -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.code/jvmci/com.oracle.jvmci.code/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.runtime/src -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.runtime/jvmci/com.oracle.jvmci.runtime/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.options/src -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.options/jvmci/com.oracle.jvmci.options/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.common/src -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.common/jvmci/com.oracle.jvmci.common/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.debug/src -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.debug/jvmci/com.oracle.jvmci.debug/src_gen -type f -name '*.java' 2> /dev/null)
 
-JVMCI_HOTSPOT_JAR = $(TARGET)/build/jvmci-hotspot.jar
+JVMCI_API_JAR = $(TARGET)/build/jvmci-api.jar
 
-JVMCI_HOTSPOT_DEP_JARS = $(TARGET)/build/jvmci-service.jar $(TARGET)/build/jvmci-api.jar graal/findbugs-SuppressFBWarnings.jar
+JVMCI_API_DEP_JARS = $(TARGET)/build/jvmci-service.jar jvmci/findbugs-SuppressFBWarnings.jar
 
-EXPORTED_FILES += $(JVMCI_HOTSPOT_JAR)
+EXPORTED_FILES += $(JVMCI_API_JAR)
 
-JVMCI_SERVICE_SRC = $(shell find graal/com.oracle.jvmci.service/src -type f -name *.java 2> /dev/null)
+JVMCI_SERVICE_SRC = $(shell find jvmci/com.oracle.jvmci.service/src -type f -name '*.java' 2> /dev/null)
 
 JVMCI_SERVICE_JAR = $(TARGET)/build/jvmci-service.jar
 
-JVMCI_SERVICE_DEP_JARS = graal/findbugs-SuppressFBWarnings.jar
+JVMCI_SERVICE_DEP_JARS = jvmci/findbugs-SuppressFBWarnings.jar
 
 EXPORTED_FILES += $(JVMCI_SERVICE_JAR)
 
-JVMCI_API_SRC = $(shell find graal/com.oracle.jvmci.meta/src -type f -name *.java 2> /dev/null)
-JVMCI_API_SRC += $(shell find graal/com.oracle.jvmci.code/src -type f -name *.java 2> /dev/null)
-JVMCI_API_SRC += $(shell find graal/com.oracle.jvmci.runtime/src -type f -name *.java 2> /dev/null)
-JVMCI_API_SRC += $(shell find graal/com.oracle.jvmci.options/src -type f -name *.java 2> /dev/null)
-JVMCI_API_SRC += $(shell find graal/com.oracle.jvmci.common/src -type f -name *.java 2> /dev/null)
-JVMCI_API_SRC += $(shell find graal/com.oracle.jvmci.debug/src -type f -name *.java 2> /dev/null)
-
-JVMCI_API_JAR = $(TARGET)/build/jvmci-api.jar
+JVMCI_HOTSPOT_SRC = $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig/jvmci/com.oracle.jvmci.hotspotvmconfig/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.amd64/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.amd64/jvmci/com.oracle.jvmci.amd64/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.compiler/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.compiler/jvmci/com.oracle.jvmci.compiler/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot/jvmci/com.oracle.jvmci.hotspot/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.amd64/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.amd64/jvmci/com.oracle.jvmci.hotspot.amd64/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.sparc/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.sparc/jvmci/com.oracle.jvmci.sparc/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.sparc/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.sparc/jvmci/com.oracle.jvmci.hotspot.sparc/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.jfr/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.jfr/jvmci/com.oracle.jvmci.hotspot.jfr/src_gen -type f -name '*.java' 2> /dev/null)
 
-JVMCI_API_DEP_JARS = $(TARGET)/build/jvmci-service.jar graal/findbugs-SuppressFBWarnings.jar
+JVMCI_HOTSPOT_JAR = $(TARGET)/build/jvmci-hotspot.jar
 
-EXPORTED_FILES += $(JVMCI_API_JAR)
+JVMCI_HOTSPOT_DEP_JARS = $(TARGET)/build/jvmci-api.jar $(TARGET)/build/jvmci-service.jar jvmci/findbugs-SuppressFBWarnings.jar
+
+EXPORTED_FILES += $(JVMCI_HOTSPOT_JAR)
 
-$(COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR): $(COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC)  
-	$(eval TMP := $(shell mktemp -d COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_XXXXX))
-	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH)  $(COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC)
-	cp -r graal/com.oracle.jvmci.hotspotvmconfig.processor/src/META-INF $(TMP)
+$(JVMCI_OPTIONS_PROCESSOR_JAR): $(JVMCI_OPTIONS_PROCESSOR_SRC)  
+	$(eval TMP := $(shell mktemp -d JVMCI_OPTIONS_PROCESSOR_XXXXX))
+	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH)  $(JVMCI_OPTIONS_PROCESSOR_SRC)
+	cp -r jvmci/com.oracle.jvmci.options.processor/src/META-INF $(TMP)
 	$(call process_options,$(TMP),False)
-	mkdir -p $$(dirname $(COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR))
-	$(JAR) cf $(COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR) -C $(TMP) .
+	mkdir -p $$(dirname $(JVMCI_OPTIONS_PROCESSOR_JAR))
+	$(JAR) cf $(JVMCI_OPTIONS_PROCESSOR_JAR) -C $(TMP) .
 	rm -r $(TMP)
 
-$(COM_ORACLE_JVMCI_SERVICE_PROCESSOR_JAR): $(COM_ORACLE_JVMCI_SERVICE_PROCESSOR_SRC)  
-	$(eval TMP := $(shell mktemp -d COM_ORACLE_JVMCI_SERVICE_PROCESSOR_XXXXX))
-	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH)  $(COM_ORACLE_JVMCI_SERVICE_PROCESSOR_SRC)
-	cp -r graal/com.oracle.jvmci.service.processor/src/META-INF $(TMP)
+$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR): $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC)  
+	$(eval TMP := $(shell mktemp -d JVMCI_HOTSPOTVMCONFIG_PROCESSOR_XXXXX))
+	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH)  $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC)
+	cp -r jvmci/com.oracle.jvmci.hotspotvmconfig.processor/src/META-INF $(TMP)
 	$(call process_options,$(TMP),False)
-	mkdir -p $$(dirname $(COM_ORACLE_JVMCI_SERVICE_PROCESSOR_JAR))
-	$(JAR) cf $(COM_ORACLE_JVMCI_SERVICE_PROCESSOR_JAR) -C $(TMP) .
+	mkdir -p $$(dirname $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR))
+	$(JAR) cf $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR) -C $(TMP) .
+	rm -r $(TMP)
+
+$(JVMCI_SERVICE_PROCESSOR_JAR): $(JVMCI_SERVICE_PROCESSOR_SRC)  
+	$(eval TMP := $(shell mktemp -d JVMCI_SERVICE_PROCESSOR_XXXXX))
+	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH)  $(JVMCI_SERVICE_PROCESSOR_SRC)
+	cp -r jvmci/com.oracle.jvmci.service.processor/src/META-INF $(TMP)
+	$(call process_options,$(TMP),False)
+	mkdir -p $$(dirname $(JVMCI_SERVICE_PROCESSOR_JAR))
+	$(JAR) cf $(JVMCI_SERVICE_PROCESSOR_JAR) -C $(TMP) .
 	rm -r $(TMP)
 
-$(COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_JAR): $(COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_SRC)  
-	$(eval TMP := $(shell mktemp -d COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_XXXXX))
-	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH)  $(COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_SRC)
-	cp -r graal/com.oracle.jvmci.options.processor/src/META-INF $(TMP)
-	$(call process_options,$(TMP),False)
-	mkdir -p $$(dirname $(COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_JAR))
-	$(JAR) cf $(COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_JAR) -C $(TMP) .
+$(JVMCI_API_JAR): $(JVMCI_API_SRC) $(JVMCI_OPTIONS_PROCESSOR_JAR) $(JVMCI_API_DEP_JARS)
+	$(eval TMP := $(shell mktemp -d JVMCI_API_XXXXX))
+	$(JAVAC) -d $(TMP) -processorpath $(JVMCI_OPTIONS_PROCESSOR_JAR) -bootclasspath $(JDK_BOOTCLASSPATH) -cp $(shell echo $(JVMCI_API_DEP_JARS) | tr ' ' ':') $(JVMCI_API_SRC)
+	
+	$(call process_options,$(TMP),True)
+	mkdir -p $$(dirname $(JVMCI_API_JAR))
+	$(JAR) cf $(JVMCI_API_JAR) -C $(TMP) .
 	rm -r $(TMP)
 
-$(JVMCI_HOTSPOT_JAR): $(JVMCI_HOTSPOT_SRC) $(COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR) $(COM_ORACLE_JVMCI_SERVICE_PROCESSOR_JAR) $(COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_JAR) $(JVMCI_HOTSPOT_DEP_JARS)
+$(JVMCI_SERVICE_JAR): $(JVMCI_SERVICE_SRC)  $(JVMCI_SERVICE_DEP_JARS)
+	$(eval TMP := $(shell mktemp -d JVMCI_SERVICE_XXXXX))
+	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH) -cp $(shell echo $(JVMCI_SERVICE_DEP_JARS) | tr ' ' ':') $(JVMCI_SERVICE_SRC)
+	
+	$(call process_options,$(TMP),True)
+	mkdir -p $$(dirname $(JVMCI_SERVICE_JAR))
+	$(JAR) cf $(JVMCI_SERVICE_JAR) -C $(TMP) .
+	rm -r $(TMP)
+
+$(JVMCI_HOTSPOT_JAR): $(JVMCI_HOTSPOT_SRC) $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR) $(JVMCI_OPTIONS_PROCESSOR_JAR) $(JVMCI_SERVICE_PROCESSOR_JAR) $(JVMCI_HOTSPOT_DEP_JARS)
 	$(eval TMP := $(shell mktemp -d JVMCI_HOTSPOT_XXXXX))
-	$(JAVAC) -d $(TMP) -processorpath $(COM_ORACLE_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR):$(COM_ORACLE_JVMCI_SERVICE_PROCESSOR_JAR):$(COM_ORACLE_JVMCI_OPTIONS_PROCESSOR_JAR) -bootclasspath $(JDK_BOOTCLASSPATH) -cp $(TARGET)/build/jvmci-service.jar:$(TARGET)/build/jvmci-api.jar:graal/findbugs-SuppressFBWarnings.jar $(JVMCI_HOTSPOT_SRC)
+	$(JAVAC) -d $(TMP) -processorpath $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR):$(JVMCI_OPTIONS_PROCESSOR_JAR):$(JVMCI_SERVICE_PROCESSOR_JAR) -bootclasspath $(JDK_BOOTCLASSPATH) -cp $(shell echo $(JVMCI_HOTSPOT_DEP_JARS) | tr ' ' ':') $(JVMCI_HOTSPOT_SRC)
 	
 	$(call process_options,$(TMP),True)
 	mkdir -p $$(dirname $(JVMCI_HOTSPOT_JAR))
 	$(JAR) cf $(JVMCI_HOTSPOT_JAR) -C $(TMP) .
 	rm -r $(TMP)
 
-$(JVMCI_SERVICE_JAR): $(JVMCI_SERVICE_SRC)  $(JVMCI_SERVICE_DEP_JARS)
-	$(eval TMP := $(shell mktemp -d JVMCI_SERVICE_XXXXX))
-	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH) -cp graal/findbugs-SuppressFBWarnings.jar $(JVMCI_SERVICE_SRC)
-	
-	$(call process_options,$(TMP),True)
-	mkdir -p $$(dirname $(JVMCI_SERVICE_JAR))
-	$(JAR) cf $(JVMCI_SERVICE_JAR) -C $(TMP) .
-	rm -r $(TMP)
-
-$(JVMCI_API_JAR): $(JVMCI_API_SRC)  $(JVMCI_API_DEP_JARS)
-	$(eval TMP := $(shell mktemp -d JVMCI_API_XXXXX))
-	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH) -cp $(TARGET)/build/jvmci-service.jar:graal/findbugs-SuppressFBWarnings.jar $(JVMCI_API_SRC)
-	
-	$(call process_options,$(TMP),True)
-	mkdir -p $$(dirname $(JVMCI_API_JAR))
-	$(JAR) cf $(JVMCI_API_JAR) -C $(TMP) .
-	rm -r $(TMP)
-
-default: $(JVMCI_HOTSPOT_JAR) $(JVMCI_SERVICE_JAR) $(JVMCI_API_JAR)
+default: $(JVMCI_API_JAR) $(JVMCI_SERVICE_JAR) $(JVMCI_HOTSPOT_JAR)
 .PHONY: default
\ No newline at end of file
--- a/make/linux/makefiles/vm.make	Tue Jun 09 18:48:06 2015 -0700
+++ b/make/linux/makefiles/vm.make	Tue Jun 09 19:07:39 2015 -0700
@@ -199,7 +199,7 @@
   JVMCI_SPECIFIC_FILES   := jvmci\* 
 else
   JVMCI_SPECIFIC_FILES   :=
-  Src_Dirs_I += $(HS_COMMON_SRC)/../graal/com.oracle.jvmci.hotspot/src_gen/hotspot
+  Src_Dirs_I += $(HS_COMMON_SRC)/../jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot
 endif
 
 # Always exclude these.
@@ -383,7 +383,10 @@
 DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)
 DEST_JVM_DIZ       = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
 
-install_jvm: $(LIBJVM)
+$(DEST_SUBDIR):
+	mkdir $(DEST_SUBDIR)
+
+install_jvm: $(LIBJVM) $(DEST_SUBDIR)
 	@echo "Copying $(LIBJVM) to $(DEST_JVM)"
 	$(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \
 	    cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)
--- a/make/solaris/makefiles/vm.make	Tue Jun 09 18:48:06 2015 -0700
+++ b/make/solaris/makefiles/vm.make	Tue Jun 09 19:07:39 2015 -0700
@@ -211,7 +211,7 @@
   JVMCI_SPECIFIC_FILES   := jvmci\* 
 else
   JVMCI_SPECIFIC_FILES   :=
-  Src_Dirs_I += $(HS_COMMON_SRC)/../graal/com.oracle.jvmci.hotspot/src_gen/hotspot
+  Src_Dirs_I += $(HS_COMMON_SRC)/../jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot
 endif
 
 # Always exclude these.
@@ -334,7 +334,10 @@
 DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)
 DEST_JVM_DIZ       = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
 
-install_jvm: $(LIBJVM)
+$(DEST_SUBDIR):
+	mkdir $(DEST_SUBDIR)
+
+install_jvm: $(LIBJVM) $(DEST_SUBDIR)
 	@echo "Copying $(LIBJVM) to $(DEST_JVM)"
 	$(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \
 	    cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)
--- a/make/windows/makefiles/projectcreator.make	Tue Jun 09 18:48:06 2015 -0700
+++ b/make/windows/makefiles/projectcreator.make	Tue Jun 09 19:07:39 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.jvmci.hotspot\src_gen\hotspot \
+        -relativeInclude jvmci\com.oracle.jvmci.hotspot\src_gen\hotspot \
         -absoluteInclude $(HOTSPOTBUILDSPACE)/%f/generated \
         -relativeSrcInclude src \
         -absoluteSrcInclude $(HOTSPOTBUILDSPACE) \
@@ -152,7 +152,7 @@
 
 ProjectCreatorIDEOptionsIgnoreJVMCI=\
  -ignorePath_TARGET src/share/vm/jvmci \
- -ignorePath_TARGET graal\com.oracle.jvmci.hotspot\src_gen\hotspot \
+ -ignorePath_TARGET jvmci\com.oracle.jvmci.hotspot\src_gen\hotspot \
  -ignorePath_TARGET vm/jvmci
 
 ProjectCreatorIDEOptionsIgnoreCompiler2=\
--- a/make/windows/projectfiles/graal/Makefile	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#
-# Copyright (c) 1999, 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 ../local.make
-
-!include $(HOTSPOTWORKSPACE)/make/windows/projectfiles/common/Makefile
--- a/make/windows/projectfiles/graal/vm.def	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-;
-; This .DEF file is a placeholder for one which is automatically
-; generated during the build process. See
-; make\windows\build_vm_def.sh and
-; make\windows\makefiles\projectcreator.make (esp. the "-prelink"
-; options).
-;
--- a/make/windows/projectfiles/graal/vm.dsw	Tue Jun 09 18:48:06 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "vm"=.\vm.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/windows/projectfiles/jvmci/Makefile	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 1999, 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 ../local.make
+
+!include $(HOTSPOTWORKSPACE)/make/windows/projectfiles/common/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/windows/projectfiles/jvmci/vm.def	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,7 @@
+;
+; This .DEF file is a placeholder for one which is automatically
+; generated during the build process. See
+; make\windows\build_vm_def.sh and
+; make\windows\makefiles\projectcreator.make (esp. the "-prelink"
+; options).
+;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/windows/projectfiles/jvmci/vm.dsw	Tue Jun 09 19:07:39 2015 -0700
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "vm"=.\vm.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
--- a/mx/FilterTypes.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/mx/FilterTypes.java	Tue Jun 09 19:07:39 2015 -0700
@@ -23,41 +23,46 @@
 
 public class FilterTypes {
 
-    /**
-     * Prints to {@link System#out} the values in {@code args[1 .. N]} that denote classes that are
-     * {@link Class#isAssignableFrom(Class) assignable} to the type denoted in {@code args[0]}. The
-     * values are separated by {@code "|"}.
-     */
     public static void main(String... args) throws Exception {
         Class<?> jvmciServiceInterface = Class.forName(args[0]);
-        boolean needSep = false;
         StringBuilder buf = new StringBuilder();
         for (int i = 1; i < args.length; ++i) {
-            String serviceName = args[i];
-            Class<?> service = lookupService(serviceName);
-            if (service != null && jvmciServiceInterface.isAssignableFrom(service)) {
+            String[] e = args[i].split("=");
+            String serviceName = e[0];
+            String implNames = e[1];
+
+            StringBuilder impls = new StringBuilder();
+            for (String implName : implNames.split(",")) {
+                Class<?> impl = lookup(implName);
+                if (impl != null && jvmciServiceInterface.isAssignableFrom(impl)) {
+                    if (impls.length() != 0) {
+                        impls.append(',');
+                    }
+                    impls.append(implName);
+                }
+            }
+            if (impls.length() != 0) {
                 if (buf.length() != 0) {
-                    buf.append('|');
+                    buf.append(' ');
                 }
-                buf.append(serviceName);
-                needSep = true;
+                buf.append(serviceName).append('=').append(impls);
             }
         }
         System.out.print(buf);
     }
-    
-    private static Class<?> lookupService(String serviceName) {
-    	try {
-    		// This can fail in the case of running against a JDK
-    		// with out of date JVMCI jars. In that case, just print
-    		// a warning sinc the expectation is that the jars will be
-    		// updated later on.
-    	    return Class.forName(serviceName, false, FilterTypes.class.getClassLoader());
-    	} catch (ClassNotFoundException e) {
-    		// Must be stderr to avoid polluting the result being
-    		// written to stdout.
-    		System.err.println(e);
-    		return null;
-    	}
+
+    private static Class<?> lookup(String name) {
+        try {
+            // This can fail in the case of running against a JDK
+            // with out of date JVMCI jars. In that case, just print
+            // a warning since the expectation is that the jars will be
+            // updated later on.
+            return Class.forName(name, false, FilterTypes.class.getClassLoader());
+        } catch (ClassNotFoundException e) {
+            // Must be stderr to avoid polluting the result being
+            // written to stdout.
+            System.err.println(e);
+            return null;
+        }
     }
 }
--- a/mx/mx_graal.py	Tue Jun 09 18:48:06 2015 -0700
+++ b/mx/mx_graal.py	Tue Jun 09 19:07:39 2015 -0700
@@ -550,18 +550,24 @@
         shutil.move(tmp, dstLib)
         os.chmod(dstLib, permissions)
 
-def _filterJVMCIServices(serviceImplNames, classpath):
+def _filterJVMCIServices(servicesMap, classpath):
     """
     Filters and returns the names in 'serviceImplNames' that denote
     types available in 'classpath' implementing or extending
     com.oracle.jvmci.service.Service.
     """
     _, binDir = mx._compile_mx_class('FilterTypes', os.pathsep.join(classpath), myDir=dirname(__file__))
-    cmd = [mx.java().java, '-cp', mx._cygpathU2W(os.pathsep.join([binDir] + classpath)), 'FilterTypes', 'com.oracle.jvmci.service.Service'] + serviceImplNames
-    services = subprocess.check_output(cmd)
-    if len(services) == 0:
-        return []
-    return services.split('|')
+    serialized = [k + '=' + ','.join(v) for k, v in servicesMap.iteritems()]
+    cmd = [mx.java().java, '-cp', mx._cygpathU2W(os.pathsep.join([binDir] + classpath)), 'FilterTypes', 'com.oracle.jvmci.service.Service'] + serialized
+    serialized = subprocess.check_output(cmd)
+    if len(serialized) == 0:
+        return {}
+    servicesMap = {}
+    for e in serialized.split(' '):
+        k, v = e.split('=')
+        impls = v.split(',')
+        servicesMap[k] = impls
+    return servicesMap
 
 def _extractJVMCIFiles(jdkJars, jvmciJars, servicesDir, optionsDir, cleanDestination=True):
     if cleanDestination:
@@ -602,9 +608,8 @@
                         with zf.open(member) as optionsFile, \
                              file(targetpath, "wb") as target:
                             shutil.copyfileobj(optionsFile, target)
-    jvmciServices = _filterJVMCIServices(servicesMap.keys(), jdkJars)
-    for serviceName in jvmciServices:
-        serviceImpls = servicesMap[serviceName]
+    servicesMap = _filterJVMCIServices(servicesMap, jdkJars)
+    for serviceName, serviceImpls in servicesMap.iteritems():
         fd, tmp = tempfile.mkstemp(prefix=serviceName)
         f = os.fdopen(fd, 'w+')
         for serviceImpl in serviceImpls:
@@ -614,7 +619,6 @@
         shutil.move(tmp, target)
         if mx.get_os() != 'windows':
             os.chmod(target, JDK_UNIX_PERMISSIONS_FILE)
-    return (jvmciServices, optionsFiles)
 
 def _updateJVMCIFiles(jdkDir):
     jreJVMCIDir = join(jdkDir, 'jre', 'lib', 'jvmci')
@@ -829,7 +833,7 @@
                 major, minor = map(int, most_recent_tag_version.split('.'))
                 cached_graal_version = str(major) + '.' + str(minor + 1) + '-' + dev_suffix
         else:
-            cached_graal_version = 'unknown-{0}-{1}'.format(platform.node(), time.strftime('%Y-%m-%d_%H-%M-%S_%Z'))
+            cached_graal_version = 'unknown-{0}'.format(platform.node())
 
     return cached_graal_version
 
@@ -838,12 +842,6 @@
 
     The global '--vm' and '--vmbuild' options select which VM type and build target to build."""
 
-    # Turn all jdk distributions into non HotSpot; this is only necessary as long we support building/exporting JVMCI with make and mx
-    if not ("-m" in args or "--use-make" in args):
-        for jdkDist in _jdkDeployedDists:
-            if jdkDist.partOfHotSpot:
-                jdkDist.partOfHotSpot = False
-
     # Override to fail quickly if extra arguments are given
     # at the end of the command line. This allows for a more
     # helpful error message.
@@ -860,52 +858,11 @@
 
     # Call mx.build to compile the Java sources
     parser = AP()
-    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')
-    parser.add_argument('-m', '--use-make', action='store_true', help='Use the jvmci.make file to build and export JVMCI')
+
     opts2 = mx.build(['--source', '1.7'] + args, parser=parser)
     assert len(opts2.remainder) == 0
 
-    if opts2.export_dir is not None:
-        if not exists(opts2.export_dir):
-            os.makedirs(opts2.export_dir)
-        else:
-            assert os.path.isdir(opts2.export_dir), '{0} is not a directory'.format(opts2.export_dir)
-
-        defsPath = join(_graal_home, 'make', 'defs.make')
-        with open(defsPath) as fp:
-            defs = fp.read()
-        jvmciJars = []
-        jdkJars = []
-        for jdkDist in _jdkDeployedDists:
-            dist = mx.distribution(jdkDist.name)
-            jdkJars.append(join(_graal_home, dist.path))
-            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.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 = _extractJVMCIFiles(jdkJars, jvmciJars, join(opts2.export_dir, 'services'), join(opts2.export_dir, 'options'))
-        if not opts2.use_make:
-            for service in services:
-                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_JVMCI_OPTIONS_DIR)/' + optionsFile
-                if defLine not in defs:
-                    mx.abort('Missing following line in ' + defsPath + ' for options from ' + dist.name + '\n' + defLine)
-        jvmciOptions = join(_graal_home, 'jvmci.options')
-        if exists(jvmciOptions):
-            shutil.copy(jvmciOptions, opts2.export_dir)
-
     if not _vmSourcesAvailable or not opts2.native:
         return
 
@@ -969,7 +926,7 @@
             mustBuild = False
             timestamp = os.path.getmtime(timestampFile)
             sources = []
-            for d in ['src', 'make', join('graal', 'com.oracle.jvmci.hotspot', 'src_gen', 'hotspot')]:
+            for d in ['src', 'make', join('jvmci', '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'):
@@ -1054,8 +1011,12 @@
                         setMakeVar('STRIP_POLICY', 'no_strip')
             # This removes the need to unzip the *.diz files before debugging in gdb
             setMakeVar('ZIP_DEBUGINFO_FILES', '0', env=env)
-            if opts2.use_make:
-                setMakeVar('JVMCI_USE_MAKE', '1')
+
+            if buildSuffix == "1":
+                setMakeVar("JVM_VARIANTS", "client")
+            elif buildSuffix == "":
+                setMakeVar("JVM_VARIANTS", "server")
+
             # Clear this variable as having it set can cause very confusing build problems
             env.pop('CLASSPATH', None)
 
@@ -1066,8 +1027,10 @@
             envPrefix = ' '.join([key + '=' + env[key] for key in env.iterkeys() if not os.environ.has_key(key) or env[key] != os.environ[key]])
             if len(envPrefix):
                 mx.log('env ' + envPrefix + ' \\')
-            makeTarget = "all_" + build + buildSuffix if opts2.use_make else build + buildSuffix
-            runCmd.append(makeTarget)
+
+            runCmd.append(build + buildSuffix)
+            runCmd.append("docs")
+            runCmd.append("export_" + build)
 
             if not mx._opts.verbose:
                 mx.log(' '.join(runCmd))
@@ -1178,9 +1141,11 @@
         if  len(ignoredArgs) > 0:
             mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs))
 
-    if vm == 'original':
-        truffle_jar = mx.archive(['@TRUFFLE'])[0]
-        args = ['-Xbootclasspath/p:' + truffle_jar] + args
+    # Unconditionally prepend Truffle to the boot class path.
+    # This used to be done by the VM itself but was removed to
+    # separate the VM from Truffle.
+    truffle_jar = mx.archive(['@TRUFFLE'])[0]
+    args = ['-Xbootclasspath/p:' + truffle_jar] + args
 
     args = mx.java().processArgs(args)
     return (pfx, exe, vm, args, cwd)
--- a/mx/mx_graal_makefile.py	Tue Jun 09 18:48:06 2015 -0700
+++ b/mx/mx_graal_makefile.py	Tue Jun 09 19:07:39 2015 -0700
@@ -48,17 +48,18 @@
     parser = ArgumentParser(prog='mx makefile')
     parser.add_argument('-o', action='store', dest='output', help='Write contents to this file.')
     parser.add_argument('selectedDists', help="Selected distribution names which are going to be built with make.", nargs=REMAINDER)
-    args = parser.parse_args(args)
+    opts = parser.parse_args(args)
 
-    if args.selectedDists == None or len(args.selectedDists) == 0:
-        args.selectedDists = [d.name for d in mx_graal._jdkDeployedDists if d.partOfHotSpot]
+    if opts.selectedDists == None or len(opts.selectedDists) == 0:
+        opts.selectedDists = [d.name for d in mx_graal._jdkDeployedDists if d.partOfHotSpot]
     mf = Makefile()
-    if do_build_makefile(mf, args.selectedDists):
+    commandline = " ".join(["mx.sh", "makefile"] + args)
+    if do_build_makefile(mf, opts.selectedDists, commandline):
         contents = mf.generate()
-        if args.output == None:
+        if opts.output == None:
             print contents
         else:
-            with open(args.output, "w") as f:
+            with open(opts.output, "w") as f:
                 f.write(contents)
 
 
@@ -72,13 +73,21 @@
 def get_jdk_deployed_dists():
     return [d.name for d in mx_graal._jdkDeployedDists]
 
+def update_list(li, elements):
+    for e in elements:
+        if e not in li:
+            li.append(e)
+
 def make_dist_rule(dist, mf, bootClassPath=None):
     def path_dist_relative(p):
         return os.path.relpath(p, dist.suite.dir)
+    def short_dist_name(name):
+        return name.replace("COM_ORACLE_", "")
+    shortName = short_dist_name(dist.name)
     jdkDeployedDists = get_jdk_deployed_dists()
     jarPath = path_dist_relative(dist.path)
-    sourcesVariableName = dist.name + "_SRC"
-    depJarVariableName = dist.name + "_DEP_JARS"
+    sourcesVariableName = shortName + "_SRC"
+    depJarVariableName = shortName + "_DEP_JARS"
     sources = []
     resources = []
     sortedDeps = dist.sorted_deps(True, transitive=False, includeAnnotationProcessors=True)
@@ -86,17 +95,17 @@
     targetPathPrefix = "$(TARGET)" + os.path.sep
     libraryDeps = [path_dist_relative(l.get_path(False)) for l in filter_projects(sortedDeps, mx.Library)]
 
-    annotationProcessorDeps = set()
+    annotationProcessorDeps = []
     distDeps = dist.get_dist_deps(includeSelf=False, transitive=True)
-    distDepProjects = set()
+    distDepProjects = []
     for d in distDeps:
-        distDepProjects.update(d.sorted_deps(includeLibs=False, transitive=True))
+        update_list(distDepProjects, d.sorted_deps(includeLibs=False, transitive=True))
 
     classPath = [targetPathPrefix + path_dist_relative(d.path) for d in distDeps] + libraryDeps \
         + [path_dist_relative(mx.dependency(name).path) for name in dist.excludedDependencies]
     for p in projects:
         if p.definedAnnotationProcessors != None and p.definedAnnotationProcessorsDist != dist:
-            annotationProcessorDeps.add(p)
+            update_list(annotationProcessorDeps, [p])
     for p in projects:
         projectDir = path_dist_relative(p.dir)
         if p not in distDepProjects and p not in annotationProcessorDeps:
@@ -104,7 +113,7 @@
 
             for d in p.srcDirs + generatedSource:
                 src = projectDir + os.path.sep + d
-                sources.append("$(shell find {} -type f -name *.java 2> /dev/null)".format(src))
+                sources.append("$(shell find {} -type f -name '*.java' 2> /dev/null)".format(src))
                 metaInf = src + os.path.sep + "META-INF"
                 if os.path.exists(metaInf):
                     resources.append(metaInf)
@@ -116,12 +125,12 @@
     apDistVariableNames = []
     for p in annotationProcessorDeps:
         apPaths.append(path_dist_relative(p.definedAnnotationProcessorsDist.path))
-        name = p.definedAnnotationProcessorsDist.name
+        name = short_dist_name(p.definedAnnotationProcessorsDist.name)
         apDistNames.append(name)
         apDistVariableNames.append("$(" + name + "_JAR)")
     shouldExport = dist.name in jdkDeployedDists
     props = {
-           "name": dist.name,
+           "name": shortName,
            "jarPath": targetPathPrefix + jarPath,
            "depends": "",
            "depJarsVariableAccess": "$(" + depJarVariableName + ")" if len(classPath) > 0 else "",
@@ -131,7 +140,7 @@
            "annotationProcessors": " ".join(apDistVariableNames),
            "cpAnnotationProcessors": "-processorpath " + ":".join(apDistVariableNames) if len(apDistVariableNames) > 0 else "",
            "bootCp": ("-bootclasspath " + bootClassPath) if bootClassPath != None else "",
-           "cpDeps": ("-cp " + ":".join(classPath)) if len(classPath) > 0 else "",
+           "cpDeps": ("-cp $(shell echo $(" + depJarVariableName + ") | tr ' ' ':')") if len(classPath) > 0 else "",
            "jarDeps": " ".join(classPath),
            "copyResources": "cp -r {} $(TMP)".format(" ".join(resources)) if len(resources) > 0 else "",
            "targetPathPrefix": targetPathPrefix,
@@ -154,56 +163,58 @@
 
 
 
-def do_build_makefile(mf, selectedDists):
+def do_build_makefile(mf, selectedDists, commandline):
     java = mx.java()
     bootClassPath = java.bootclasspath()
-    bootClassPath = bootClassPath.replace(java.jdk, "$(JDK)")
+    bootClassPath = bootClassPath.replace(java.jdk, "$(ABS_BOOTDIR)")
     jdkBootClassPathVariableName = "JDK_BOOTCLASSPATH"
 
-    mf.add_definition("""VERBOSE=
-TARGET=.
-JDK=
+    mf.add_definition("""# This Makefile is generated automatically, do not edit
+# This file was built with the command: """ + commandline + """
 
-WGET=wget
-JAVAC=$(JDK)/bin/javac -g -target """ + str(java.javaCompliance) + """
-JAR=$(JDK)/bin/jar
+TARGET=.
+# Bootstrap JDK to be used (for javac and jar)
+ABS_BOOTDIR=
 
-EXPORT_DIR=export
+JAVAC=$(ABS_BOOTDIR)/bin/javac -g -target """ + str(java.javaCompliance) + """
+JAR=$(ABS_BOOTDIR)/bin/jar
+
 EXPORTED_FILES_ADDITIONAL=$(TARGET)/options $(TARGET)/services
 HS_COMMON_SRC=.
-# where all other stuff built by mx (graal.jar) resides
-MX_TARGET=.
-PROVIDERS_INF=/META-INF/providers/
-SERVICES_INF=/META-INF/services/
-OPTIONS_INF=/META-INF/options/
 
-ifeq ($(JDK),)
-    $(error Variable JDK must be set to a JDK installation.)
-    endif
-    ifneq ($(VERBOSE),)
+# Directories, where the generated property-files reside within the JAR files
+PROVIDERS_INF=/META-INF/providers
+SERVICES_INF=/META-INF/services
+OPTIONS_INF=/META-INF/options
+
+ifeq ($(ABS_BOOTDIR),)
+    $(error Variable ABS_BOOTDIR must be set to a JDK installation.)
+endif
+ifneq ($(MAKE_VERBOSE),)
     SHELL=sh -x
 endif
 
-define process_options =
+define process_options
     $(eval providers=$(1)/$(PROVIDERS_INF))
     $(eval services=$(1)/$(SERVICES_INF))
     $(eval options=$(1)/$(OPTIONS_INF))
     test -d $(services) || mkdir -p $(services)
     test ! -d $(providers) || (cd $(providers) && for i in $$(ls); do c=$$(cat $$i); echo $$i >> $(abspath $(services))/$$c; rm $$i; done)
 
-    # We're building all projects together with one javac call; thus we cannot determine, from which project the generated file is thus we hardcode it for now
+    # Since all projects are built together with one javac call we cannot determine
+    # which project contains HotSpotVMConfig.inline.hpp so we hardcode it.
     $(eval vmconfig=$(1)/hotspot/HotSpotVMConfig.inline.hpp)
-    $(eval vmconfigDest=$(HS_COMMON_SRC)/../graal/com.oracle.jvmci.hotspot/src_gen/hotspot)
+    $(eval vmconfigDest=$(HS_COMMON_SRC)/../jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot)
     test ! -f $(vmconfig) || (mkdir -p $(vmconfigDest) && cp $(vmconfig) $(vmconfigDest))
 endef
 
-define extract =
+define extract
     $(eval TMP := $(shell mktemp -d $(1)_XXXXX))
-    mkdir -p $(2)
-    cd $(TMP) && $(JAR) xf $(abspath $(1)) && \
-        ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) &&  (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2))))
-    rm -r $(TMP)
-    cp $(1) $(2)
+    mkdir -p $(2);
+    cd $(TMP) && $(JAR) xf $(abspath $(1)) && \\
+        ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) &&  (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2))));
+    rm -r $(TMP);
+    cp $(1) $(2);
 endef
 
 
@@ -216,20 +227,20 @@
 
 """)
     s = mx.suite("graal")
-    dists = set()
-    ap = set()
-    projects = set()
+    dists = []
+    ap = []
+    projects = []
     for d in s.dists:
         if d.name in selectedDists:
-            dists.update(d.get_dist_deps(True, True))
-            projects.update(d.sorted_deps(includeLibs=False, transitive=True))
+            update_list(dists, d.get_dist_deps(True, True))
+            update_list(projects, d.sorted_deps(includeLibs=False, transitive=True))
 
     for p in projects:
         deps = p.all_deps([], False, includeSelf=True, includeJreLibs=False, includeAnnotationProcessors=True)
         for d in deps:
             if d.definedAnnotationProcessorsDist != None:
                 apd = d.definedAnnotationProcessorsDist
-                ap.add(apd)
+                update_list(ap, [apd])
 
     if len(dists) > 0:
         mf.add_definition(jdkBootClassPathVariableName + " = " + bootClassPath)
--- a/mx/suite.py	Tue Jun 09 18:48:06 2015 -0700
+++ b/mx/suite.py	Tue Jun 09 19:07:39 2015 -0700
@@ -83,7 +83,7 @@
     },
 
     "FINDBUGS" : {
-      "path" : "graal/findbugs-SuppressFBWarnings.jar",
+      "path" : "jvmci/findbugs-SuppressFBWarnings.jar",
       "sha1" : "fb78822d27c68fabf2cb2e5e573b3cdb5f9cae2d",
     },
 
@@ -159,7 +159,7 @@
     # ------------- JVMCI:Service -------------
 
     "com.oracle.jvmci.service" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
@@ -167,7 +167,7 @@
     },
 
     "com.oracle.jvmci.service.processor" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : ["com.oracle.jvmci.service"],
       "checkstyle" : "com.oracle.graal.graph",
@@ -178,7 +178,7 @@
     # ------------- JVMCI:API -------------
 
     "com.oracle.jvmci.common" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
@@ -186,7 +186,7 @@
     },
 
     "com.oracle.jvmci.meta" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
@@ -194,7 +194,7 @@
     },
 
     "com.oracle.jvmci.code" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : ["com.oracle.jvmci.meta"],
       "checkstyle" : "com.oracle.graal.graph",
@@ -203,7 +203,7 @@
     },
 
     "com.oracle.jvmci.runtime" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.jvmci.code"
@@ -214,7 +214,7 @@
     },
 
     "com.oracle.jvmci.runtime.test" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : [
         "JUNIT",
@@ -227,18 +227,21 @@
     },
 
     "com.oracle.jvmci.debug" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "checkstyle" : "com.oracle.graal.graph",
       "dependencies" : [
+        "com.oracle.jvmci.options",
+        "com.oracle.jvmci.code",
         "com.oracle.jvmci.service",
       ],
+      "annotationProcessors" : ["com.oracle.jvmci.options.processor"],
       "javaCompliance" : "1.8",
       "workingSets" : "JVMCI,Debug",
     },
 
     "com.oracle.jvmci.debug.test" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : [
         "JUNIT",
@@ -250,18 +253,27 @@
     },
 
     "com.oracle.jvmci.options" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
-      "dependencies" : [
-        "com.oracle.jvmci.service",
-      ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "JVMCI",
     },
 
+    "com.oracle.jvmci.compiler" : {
+      "subDir" : "jvmci",
+      "sourceDirs" : ["src"],
+      "dependencies" : [
+        "com.oracle.jvmci.debug",
+      ],
+      "checkstyle" : "com.oracle.graal.graph",
+      "annotationProcessors" : ["com.oracle.jvmci.options.processor"],
+      "javaCompliance" : "1.8",
+      "workingSets" : "JVMCI",
+    },
+
     "com.oracle.jvmci.options.processor" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.jvmci.options",
@@ -272,7 +284,7 @@
     },
 
     "com.oracle.jvmci.options.test" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.jvmci.options",
@@ -287,7 +299,7 @@
     # ------------- JVMCI:HotSpot -------------
 
     "com.oracle.jvmci.amd64" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : ["com.oracle.jvmci.code"],
       "checkstyle" : "com.oracle.graal.graph",
@@ -296,7 +308,7 @@
     },
 
     "com.oracle.jvmci.sparc" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : ["com.oracle.jvmci.code"],
       "checkstyle" : "com.oracle.graal.graph",
@@ -305,19 +317,19 @@
     },
 
     "com.oracle.jvmci.hotspot" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.jvmci.hotspotvmconfig",
-        "com.oracle.jvmci.options",
-        "com.oracle.jvmci.debug",
+        "FINDBUGS",
         "com.oracle.jvmci.runtime",
         "com.oracle.jvmci.common",
-        "FINDBUGS",
+        "com.oracle.jvmci.compiler",
       ],
       "annotationProcessors" : [
         "com.oracle.jvmci.hotspotvmconfig.processor",
         "com.oracle.jvmci.options.processor",
+        "com.oracle.jvmci.service.processor",
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
@@ -325,7 +337,7 @@
     },
 
     "com.oracle.jvmci.hotspotvmconfig" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
@@ -333,7 +345,7 @@
     },
 
     "com.oracle.jvmci.hotspotvmconfig.processor" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : ["com.oracle.jvmci.hotspotvmconfig", "com.oracle.jvmci.common"],
       "checkstyle" : "com.oracle.graal.graph",
@@ -342,7 +354,7 @@
     },
 
     "com.oracle.jvmci.hotspot.amd64" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.jvmci.amd64",
@@ -355,7 +367,7 @@
     },
 
     "com.oracle.jvmci.hotspot.sparc" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.jvmci.sparc",
@@ -368,7 +380,7 @@
     },
 
     "com.oracle.jvmci.hotspot.jfr" : {
-      "subDir" : "graal",
+      "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.jvmci.hotspot",
@@ -483,8 +495,8 @@
       "dependencies" : [
         "com.oracle.jvmci.hotspot",
         "com.oracle.graal.replacements",
-        "com.oracle.graal.printer",
         "com.oracle.graal.runtime",
+        "com.oracle.graal.code",
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "annotationProcessors" : [
@@ -734,9 +746,9 @@
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "dependencies" : [
-        "com.oracle.graal.compiler",
+        "com.oracle.graal.api.directives",
         "com.oracle.graal.java",
-        "com.oracle.graal.api.directives",
+        "com.oracle.graal.loop",
         "com.oracle.graal.word",
       ],
       "checkstyle" : "com.oracle.graal.graph",
@@ -754,6 +766,7 @@
       "dependencies" : [
           "com.oracle.graal.replacements",
           "com.oracle.graal.lir.amd64",
+          "com.oracle.graal.compiler",
           ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
@@ -766,6 +779,7 @@
       "sourceDirs" : ["src"],
       "dependencies" : [
           "com.oracle.graal.replacements",
+          "com.oracle.graal.compiler",
           ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
@@ -805,6 +819,7 @@
         "com.oracle.graal.api.replacements",
         "com.oracle.graal.lir",
         "com.oracle.graal.bytecode",
+        "com.oracle.jvmci.compiler",
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
@@ -965,7 +980,7 @@
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.graal.phases",
-        "com.oracle.graal.graphbuilderconf"
+        "com.oracle.graal.graphbuilderconf",
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "annotationProcessors" : ["com.oracle.jvmci.service.processor"],
@@ -988,10 +1003,8 @@
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "dependencies" : [
-        "com.oracle.jvmci.options",
         "com.oracle.jvmci.debug",
         "com.oracle.jvmci.common",
-        "com.oracle.jvmci.code",
       ],
       "annotationProcessors" : ["com.oracle.jvmci.options.processor"],
       "checkstyle" : "com.oracle.graal.graph",
@@ -1007,6 +1020,7 @@
         "com.oracle.graal.java",
         "com.oracle.graal.compiler",
       ],
+      "annotationProcessors" : ["com.oracle.jvmci.service.processor"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,Graph",
@@ -1028,9 +1042,9 @@
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "dependencies" : [
+        "com.oracle.graal.api.directives",
+        "com.oracle.graal.java",
         "com.oracle.graal.test",
-        "com.oracle.graal.api.directives",
-        "com.oracle.graal.printer",
         "com.oracle.graal.runtime",
         "JAVA_ALLOCATION_INSTRUMENTER",
       ],
@@ -1057,7 +1071,6 @@
     "com.oracle.truffle.api" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
-      "dependencies" : ["com.oracle.jvmci.service"],
       "javaCompliance" : "1.7",
       "workingSets" : "API,Truffle",
     },
@@ -1117,15 +1130,6 @@
       "workingSets" : "API,Truffle",
     },
 
-    "com.oracle.truffle.interop" : {
-      "subDir" : "graal",
-      "sourceDirs" : ["src"],
-      "dependencies" : ["com.oracle.truffle.api.interop"],
-      "javaCompliance" : "1.7",
-      "workingSets" : "Truffle",
-      "checkstyle" : "com.oracle.truffle.api",
-    },
-
     "com.oracle.truffle.api.object" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
@@ -1198,7 +1202,6 @@
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.truffle.api.dsl",
-        "com.oracle.truffle.interop",
         "com.oracle.truffle.api.object",
         "com.oracle.truffle.tools",
         "FINDBUGS"
@@ -1238,7 +1241,6 @@
       "dependencies" : [
         "com.oracle.truffle.api",
         "com.oracle.graal.runtime",
-        "com.oracle.graal.printer",
         "com.oracle.graal.replacements",
       ],
       "checkstyle" : "com.oracle.graal.graph",
@@ -1353,6 +1355,7 @@
         "com.oracle.graal.hotspot.amd64",
         "com.oracle.graal.hotspot.sparc",
         "com.oracle.graal.hotspot",
+        "com.oracle.graal.printer",
       ],
       "exclude" : ["FINDBUGS"],
       "distDependencies" : [
@@ -1369,7 +1372,6 @@
       "dependencies" : [
         "com.oracle.truffle.api.dsl",
         "com.oracle.nfi",
-        "com.oracle.truffle.interop",
         "com.oracle.truffle.object.basic",
         "com.oracle.truffle.tools"
       ],
--- a/mxtool/mx.py	Tue Jun 09 18:48:06 2015 -0700
+++ b/mxtool/mx.py	Tue Jun 09 19:07:39 2015 -0700
@@ -144,13 +144,18 @@
         self.update_listeners.add(listener)
 
     def get_dist_deps(self, includeSelf=True, transitive=False):
-        deps = set()
+        deps = []
         if includeSelf:
-            deps.add(self)
-        deps.update([distribution(name) for name in self.distDependencies])
+            deps.append(self)
+        for name in self.distDependencies:
+            dist = distribution(name)
+            if dist not in deps:
+                deps.append(dist)
         if transitive:
             for depName in self.distDependencies:
-                deps.update(distribution(depName).get_dist_deps(False, False))
+                for recDep in distribution(depName).get_dist_deps(False, True):
+                    if recDep not in deps:
+                        deps.append(recDep)
         return list(deps)
 
     """
@@ -646,8 +651,15 @@
         if canSymlink and 'symlink' in dir(os):
             if exists(path):
                 os.unlink(path)
-            print 'Path ' + cachePath + ' path: ' + path
-            os.symlink(cachePath, path)
+            try:
+                os.symlink(cachePath, path)
+            except OSError as e:
+                # When doing parallel building, the symlink can fail
+                # if another thread wins the race to create the symlink
+                if not exists(path):
+                    # It was some other error
+                    raise e
+
         else:
             shutil.copy(cachePath, path)
 
@@ -2824,7 +2836,7 @@
         nonjavafiletuples = []
         for sourceDir in sourceDirs:
             for root, _, files in os.walk(sourceDir):
-                javafiles = [join(root, name) for name in files if name.endswith('.java') and name != 'package-info.java']
+                javafiles = [join(root, name) for name in files if name.endswith('.java')]
                 javafilelist += javafiles
 
                 nonjavafiletuples += [(sourceDir, [join(root, name) for name in files if not name.endswith('.java')])]
@@ -2833,8 +2845,9 @@
                     for javafile in javafiles:
                         classfile = TimeStampFile(outputDir + javafile[len(sourceDir):-len('java')] + 'class')
                         if not classfile.exists() or classfile.isOlderThan(javafile):
-                            buildReason = 'class file(s) out of date'
-                            break
+                            if basename(classfile.path) != 'package-info.class':
+                                buildReason = 'class file(s) out of date'
+                                break
 
         apsOutOfDate = p.update_current_annotation_processors_file()
         if apsOutOfDate:
--- a/src/cpu/ppc/vm/jvmciGlobals_ppc.hpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/cpu/ppc/vm/jvmciGlobals_ppc.hpp	Tue Jun 09 19:07:39 2015 -0700
@@ -28,11 +28,11 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
 
-// Sets the default values for platform dependent flags used by the Graal compiler.
-// (see graalGlobals.hpp)
+// Sets the default values for platform dependent flags used by the JVMCI compiler.
+// (see jvmciGlobals.hpp)
 
-#ifdef COMPILERGRAAL
+#ifdef COMPILERJVMCI
 #error Unimplemented
-#endif // COMPILERGRAAL
+#endif // COMPILERJVMCI
 
-#endif // CPU_PPC_VM_GRAALGLOBALS_PPC_HPP
+#endif // CPU_PPC_VM_JVMCIGLOBALS_PPC_HPP
--- a/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp	Tue Jun 09 19:07:39 2015 -0700
@@ -630,8 +630,12 @@
 
 inline void MacroAssembler::ldf(FloatRegisterImpl::Width w, const Address& a, FloatRegister d, int offset) {
   relocate(a.rspec(offset));
-  if(a.has_index()) { assert(offset == 0, ""); ldf(w, a.base(), a.index(), d); }
-  else              { ldf(w, a.base(), a.disp() + offset, d); }
+  if (a.has_index()) {
+    assert(offset == 0, "");
+    ldf(w, a.base(), a.index(), d);
+  } else {
+    ldf(w, a.base(), a.disp() + offset, d);
+  }
 }
 
 // returns if membar generates anything, obviously this code should mirror
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Tue Jun 09 19:07:39 2015 -0700
@@ -208,7 +208,7 @@
   OopMap* map = new OopMap(frame_size_in_slots, 0);
 
 #define STACK_OFFSET(x) VMRegImpl::stack2reg((x) + additional_frame_slots)
-#define YMMHI_STACK_OFFSET(x) VMRegImpl::stack2reg((x) + ymmhi_offset)
+#define YMMHI_STACK_OFFSET(x) VMRegImpl::stack2reg((x / VMRegImpl::stack_slot_size) + ymmhi_offset)
 
   map->set_callee_saved(STACK_OFFSET( rax_off ), rax->as_VMReg());
   map->set_callee_saved(STACK_OFFSET( rcx_off ), rcx->as_VMReg());
@@ -247,22 +247,22 @@
 #if defined(COMPILER2) || defined(JVMCI)
   if (save_vectors) {
     assert(ymmhi_offset != -1, "save area must exist");
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm0_off ), xmm0->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm1_off ), xmm1->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm2_off ), xmm2->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm3_off ), xmm3->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm4_off ), xmm4->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm5_off ), xmm5->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm6_off ), xmm6->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm7_off ), xmm7->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm8_off ), xmm8->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm9_off ), xmm9->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm10_off), xmm10->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm11_off), xmm11->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm12_off), xmm12->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm13_off), xmm13->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm14_off), xmm14->as_VMReg()->next()->next()->next()->next());
-    map->set_callee_saved(YMMHI_STACK_OFFSET(xmm15_off), xmm15->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET(  0), xmm0->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET( 16), xmm1->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET( 32), xmm2->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET( 48), xmm3->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET( 64), xmm4->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET( 80), xmm5->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET( 96), xmm6->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET(112), xmm7->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET(128), xmm8->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET(144), xmm9->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET(160), xmm10->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET(176), xmm11->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET(192), xmm12->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET(208), xmm13->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET(224), xmm14->as_VMReg()->next()->next()->next()->next());
+    map->set_callee_saved(YMMHI_STACK_OFFSET(240), xmm15->as_VMReg()->next()->next()->next()->next());
   }
 #endif
 
--- a/src/share/tools/ProjectCreator/BuildConfig.java	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/tools/ProjectCreator/BuildConfig.java	Tue Jun 09 19:07:39 2015 -0700
@@ -75,8 +75,8 @@
                 outDir = outDir.substring(0, lastDirectorySeparator);
             }
             outDir += Util.sep + build + Util.sep + "jre" + Util.sep + "bin";
-            if (flavour.equals("graal")) {
-                outDir += Util.sep + "graal";
+            if (flavour.equals("jvmci")) {
+                outDir += Util.sep + "jvmci";
             } else if (flavour.equals("compiler1")) {
                 outDir += Util.sep + "client";
             } else {
@@ -559,7 +559,7 @@
     }
 
     GraalDebugConfig() {
-        initNames("graal", "debug", "jvm.dll");
+        initNames("jvmci", "debug", "jvm.dll");
         init(getIncludes(), getDefines());
     }
 }
@@ -570,7 +570,7 @@
     }
 
     GraalFastDebugConfig() {
-        initNames("graal", "fastdebug", "jvm.dll");
+        initNames("jvmci", "fastdebug", "jvm.dll");
         init(getIncludes(), getDefines());
     }
 }
@@ -655,7 +655,7 @@
 
 class GraalProductConfig extends ProductConfig {
     GraalProductConfig() {
-        initNames("graal", "product", "jvm.dll");
+        initNames("jvmci", "product", "jvm.dll");
         init(getIncludes(), getDefines());
     }
 }
--- a/src/share/vm/classfile/defaultMethods.cpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/vm/classfile/defaultMethods.cpp	Tue Jun 09 19:07:39 2015 -0700
@@ -731,10 +731,12 @@
     Method* m = iklass->find_method(_method_name, _method_signature);
     // private interface methods are not candidates for default methods
     // invokespecial to private interface methods doesn't use default method logic
+    // private class methods are not candidates for default methods,
+    // private methods do not override default methods, so need to perform
+    // default method inheritance without including private methods
     // The overpasses are your supertypes' errors, we do not include them
     // future: take access controls into account for superclass methods
-    if (m != NULL && !m->is_static() && !m->is_overpass() &&
-         (!iklass->is_interface() || m->is_public())) {
+    if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private()) {
       if (_family == NULL) {
         _family = new StatefulMethodFamily();
       }
@@ -745,6 +747,9 @@
       } else {
         // This is the rule that methods in classes "win" (bad word) over
         // methods in interfaces. This works because of single inheritance
+        // private methods in classes do not "win", they will be found
+        // first on searching, but overriding for invokevirtual needs
+        // to find default method candidates for the same signature
         _family->set_target_if_empty(m);
       }
     }
--- a/src/share/vm/jvmci/jvmciOptions.cpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/vm/jvmci/jvmciOptions.cpp	Tue Jun 09 19:07:39 2015 -0700
@@ -27,10 +27,10 @@
 #include "runtime/arguments.hpp"
 #include "utilities/hashtable.inline.hpp"
 
-class OptionsParseClosure : public ParseClosure {
-  OptionsTable* _table;
+class OptionDescParseClosure : public ParseClosure {
+  OptionDescsTable* _table;
 public:
-  OptionsParseClosure(OptionsTable* table) : _table(table) {}
+  OptionDescParseClosure(OptionDescsTable* table) : _table(table) {}
   void do_line(char* line) {
     char* idx = strchr(line, '\t');
     if (idx == NULL) {
@@ -118,13 +118,13 @@
   }
 };
 
-OptionsTable::~OptionsTable() {
+OptionDescsTable::~OptionDescsTable() {
   FreeNamesClosure closure;
   for_each(&closure);
 }
 
-OptionsTable* OptionsTable::load_options() {
-  OptionsTable* table = new OptionsTable();
+OptionDescsTable* OptionDescsTable::load_options() {
+  OptionDescsTable* table = new OptionDescsTable();
   // Add PrintFlags option manually
   OptionDesc printFlagsDesc;
   printFlagsDesc.name = PRINT_FLAGS_ARG;
@@ -142,7 +142,7 @@
   if (dir != NULL) {
     struct dirent *entry;
     char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(optionsDir), mtInternal);
-    OptionsParseClosure closure(table);
+    OptionDescParseClosure closure(table);
     while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL && !closure.is_aborted()) {
       const char* name = entry->d_name;
       char optionFilePath[JVM_MAXPATHLEN];
@@ -162,7 +162,7 @@
   return table;
 }
 
-OptionDesc* OptionsTable::get(const char* name, size_t arglen) {
+OptionDesc* OptionDescsTable::get(const char* name, size_t arglen) {
   char nameOnly[256];
   guarantee(arglen < 256, "Max supported option name len is 256");
   strncpy(nameOnly, name, arglen);
@@ -213,7 +213,7 @@
   }
 };
 
-OptionDesc * OptionsTable::fuzzy_match(const char* name, size_t length) {
+OptionDesc * OptionDescsTable::fuzzy_match(const char* name, size_t length) {
   FuzzyMatchClosure closure(name);
   for_each(&closure);
   return closure.get_match();
@@ -227,7 +227,7 @@
   }
 };
 
-OptionsValueTable::~OptionsValueTable() {
+OptionValuesTable::~OptionValuesTable() {
   FreeStringsClosure closure;
   for_each(&closure);
   delete _table;
@@ -235,7 +235,7 @@
 
 
 
-OptionValue* OptionsValueTable::get(const char* name, size_t arglen) {
+OptionValue* OptionValuesTable::get(const char* name, size_t arglen) {
   char nameOnly[256];
   guarantee(arglen < 256, "Max supported option name len is 256");
   strncpy(nameOnly, name, arglen);
--- a/src/share/vm/jvmci/jvmciOptions.hpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/vm/jvmci/jvmciOptions.hpp	Tue Jun 09 19:07:39 2015 -0700
@@ -56,20 +56,20 @@
   return val;
 }
 
-class OptionsTable : public JVMCIHashtable<const char*, OptionDesc> {
+class OptionDescsTable : public JVMCIHashtable<const char*, OptionDesc> {
 protected:
   unsigned int compute_hash(const char* key) { return compute_string_hash(key, (int)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();
+  OptionDescsTable() : JVMCIHashtable<const char*, OptionDesc>(100) {}
+  ~OptionDescsTable();
   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();
+  static OptionDescsTable* load_options();
 };
 
 struct OptionValue {
@@ -84,19 +84,19 @@
   };
 };
 
-class OptionsValueTable : public JVMCIHashtable<const char*, OptionValue> {
-  OptionsTable* _table;
+class OptionValuesTable : public JVMCIHashtable<const char*, OptionValue> {
+  OptionDescsTable* _table;
 protected:
   unsigned int compute_hash(const char* key) { return compute_string_hash(key, (int)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();
+  OptionValuesTable(OptionDescsTable* table) : _table(table), JVMCIHashtable<const char*, OptionValue>(100) {}
+  ~OptionValuesTable();
   using JVMCIHashtable<const char*, OptionValue>::get;
   OptionValue* get(const char* name, size_t arglen);
-  OptionsTable* options_table() { return _table; }
+  OptionDescsTable* options_table() { return _table; }
 };
 
 
--- a/src/share/vm/jvmci/jvmciRuntime.cpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/vm/jvmci/jvmciRuntime.cpp	Tue Jun 09 19:07:39 2015 -0700
@@ -729,13 +729,13 @@
   }
 }
 
-OptionsValueTable* JVMCIRuntime::parse_arguments() {
-  OptionsTable* table = OptionsTable::load_options();
+OptionValuesTable* JVMCIRuntime::parse_arguments() {
+  OptionDescsTable* table = OptionDescsTable::load_options();
   if (table == NULL) {
     return NULL;
   }
 
-  OptionsValueTable* options = new OptionsValueTable(table);
+  OptionValuesTable* options = new OptionValuesTable(table);
 
   // Process option overrides from jvmci.options first
   parse_jvmci_options_file(options);
@@ -752,7 +752,7 @@
   return options;
 }
 
-void not_found(OptionsTable* table, const char* argname, size_t namelen) {
+void not_found(OptionDescsTable* 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) {
@@ -764,8 +764,8 @@
   }
 }
 
-bool JVMCIRuntime::parse_argument(OptionsValueTable* options, const char* arg) {
-  OptionsTable* table = options->options_table();
+bool JVMCIRuntime::parse_argument(OptionValuesTable* options, const char* arg) {
+  OptionDescsTable* table = options->options_table();
   char first = arg[0];
   const char* name;
   size_t name_len;
@@ -862,9 +862,9 @@
 }
 
 class JVMCIOptionParseClosure : public ParseClosure {
-  OptionsValueTable* _options;
+  OptionValuesTable* _options;
 public:
-  JVMCIOptionParseClosure(OptionsValueTable* options) : _options(options) {}
+  JVMCIOptionParseClosure(OptionValuesTable* options) : _options(options) {}
   void do_line(char* line) {
     if (!JVMCIRuntime::parse_argument(_options, line)) {
       warn("There was an error parsing an argument. Skipping it.");
@@ -872,7 +872,7 @@
   }
 };
 
-void JVMCIRuntime::parse_jvmci_options_file(OptionsValueTable* options) {
+void JVMCIRuntime::parse_jvmci_options_file(OptionValuesTable* options) {
   const char* home = Arguments::get_java_home();
   size_t path_len = strlen(home) + strlen("/lib/jvmci.options") + 1;
   char path[JVM_MAXPATHLEN];
@@ -1010,7 +1010,7 @@
   }
 };
 
-void JVMCIRuntime::set_options(OptionsValueTable* options, TRAPS) {
+void JVMCIRuntime::set_options(OptionValuesTable* options, TRAPS) {
   ensure_jvmci_class_loader_is_initialized();
   {
     ResourceMark rm;
@@ -1181,7 +1181,7 @@
   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
+    char* implName = NEW_RESOURCE_ARRAY(char, lineLen + 1);
     // Turn all '.'s into '/'s
     for (size_t index = 0; index < lineLen; ++index) {
       if (line[index] == '.') {
--- a/src/share/vm/jvmci/jvmciRuntime.hpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/vm/jvmci/jvmciRuntime.hpp	Tue Jun 09 19:07:39 2015 -0700
@@ -67,7 +67,7 @@
    * 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);
+  static void parse_jvmci_options_file(OptionValuesTable* options);
 
   static void print_flags_helper(TRAPS);
 
@@ -84,11 +84,11 @@
    * Parses the JVMCI specific VM options that were presented by the launcher and sets
    * the relevants Java fields.
    */
-  static OptionsValueTable* parse_arguments();
+  static OptionValuesTable* parse_arguments();
 
-  static bool parse_argument(OptionsValueTable* options, const char* arg);
+  static bool parse_argument(OptionValuesTable* options, const char* arg);
 
-  static void set_options(OptionsValueTable* options, TRAPS);
+  static void set_options(OptionValuesTable* options, TRAPS);
 
   /**
    * Ensures that the JVMCI class loader is initialized and the well known JVMCI classes are loaded.
--- a/src/share/vm/memory/referenceProcessor.cpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/vm/memory/referenceProcessor.cpp	Tue Jun 09 19:07:39 2015 -0700
@@ -255,7 +255,7 @@
     // Cleaner references to be temporary, and don't want to deal with
     // possible incompatibilities arising from making it more visible.
     phantom_count +=
-      process_discovered_reflist(_discoveredCleanerRefs, NULL, false,
+      process_discovered_reflist(_discoveredCleanerRefs, NULL, true,
                                  is_alive, keep_alive, complete_gc, task_executor);
   }
 
--- a/src/share/vm/oops/klassVtable.cpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/vm/oops/klassVtable.cpp	Tue Jun 09 19:07:39 2015 -0700
@@ -401,13 +401,15 @@
       // get super_klass for method_holder for the found method
       InstanceKlass* super_klass =  super_method->method_holder();
 
-      if (is_default
+      // private methods are also never overridden
+      if (!super_method->is_private() &&
+          (is_default
           || ((super_klass->is_override(super_method, target_loader, target_classname, THREAD))
           || ((klass->major_version() >= VTABLE_TRANSITIVE_OVERRIDE_VERSION)
           && ((super_klass = find_transitive_override(super_klass,
                              target_method, i, target_loader,
                              target_classname, THREAD))
-                             != (InstanceKlass*)NULL))))
+                             != (InstanceKlass*)NULL)))))
         {
         // Package private methods always need a new entry to root their own
         // overriding. They may also override other methods.
@@ -689,9 +691,15 @@
 // check if a method is a miranda method, given a class's methods table,
 // its default_method table  and its super
 // Miranda methods are calculated twice:
-// first: before vtable size calculation: including abstract and default
+// first: before vtable size calculation: including abstract and superinterface default
+// We include potential default methods to give them space in the vtable.
+// During the first run, the default_methods list is empty
 // This is seen by default method creation
-// Second: recalculated during vtable initialization: only abstract
+// Second: recalculated during vtable initialization: only include abstract methods.
+// During the second run, default_methods is set up, so concrete methods from
+// superinterfaces with matching names/signatures to default_methods are already
+// in the default_methods list and do not need to be appended to the vtable
+// as mirandas
 // This is seen by link resolution and selection.
 // "miranda" means not static, not defined by this class.
 // private methods in interfaces do not belong in the miranda list.
@@ -706,8 +714,9 @@
   }
   Symbol* name = m->name();
   Symbol* signature = m->signature();
+  Method* mo;
 
-  if (InstanceKlass::find_instance_method(class_methods, name, signature) == NULL) {
+  if ((mo = InstanceKlass::find_instance_method(class_methods, name, signature)) == NULL) {
     // did not find it in the method table of the current class
     if ((default_methods == NULL) ||
         InstanceKlass::find_method(default_methods, name, signature) == NULL) {
@@ -716,7 +725,7 @@
         return true;
       }
 
-      Method* mo = InstanceKlass::cast(super)->lookup_method(name, signature);
+      mo = InstanceKlass::cast(super)->lookup_method(name, signature);
       while (mo != NULL && mo->access_flags().is_static()
              && mo->method_holder() != NULL
              && mo->method_holder()->super() != NULL)
@@ -728,6 +737,18 @@
         return true;
       }
     }
+  } else {
+     // if the local class has a private method, the miranda will not
+     // override it, so a vtable slot is needed
+     if (mo->access_flags().is_private()) {
+
+       // Second round, weed out any superinterface methods that turned
+       // into default methods, i.e. were concrete not abstract in the end
+       if ((default_methods == NULL) ||
+         InstanceKlass::find_method(default_methods, name, signature) == NULL) {
+         return true;
+       }
+    }
   }
 
   return false;
--- a/src/share/vm/runtime/arguments.cpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/vm/runtime/arguments.cpp	Tue Jun 09 19:07:39 2015 -0700
@@ -2319,7 +2319,7 @@
                                         "G1ConcMarkStepDurationMillis");
     status = status && verify_interval(G1ConcRSHotCardLimit, 0, max_jubyte,
                                        "G1ConcRSHotCardLimit");
-    status = status && verify_interval(G1ConcRSLogCacheSize, 0, 31,
+    status = status && verify_interval(G1ConcRSLogCacheSize, 0, 27,
                                        "G1ConcRSLogCacheSize");
     status = status && verify_interval(StringDeduplicationAgeThreshold, 1, markOopDesc::max_age,
                                        "StringDeduplicationAgeThreshold");
--- a/src/share/vm/runtime/os.cpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/vm/runtime/os.cpp	Tue Jun 09 19:07:39 2015 -0700
@@ -1192,9 +1192,6 @@
 #ifdef JVMCI
         "%/lib/jvmci-service.jar:"
 #endif
-#ifndef NO_TRUFFLE_JAR
-        "%/lib/truffle.jar:"
-#endif
         "%/classes";
     char* sysclasspath = format_boot_path(classpath_format, home, home_len, fileSep, pathSep);
     if (sysclasspath == NULL) return false;
--- a/src/share/vm/runtime/thread.cpp	Tue Jun 09 18:48:06 2015 -0700
+++ b/src/share/vm/runtime/thread.cpp	Tue Jun 09 19:07:39 2015 -0700
@@ -3396,7 +3396,7 @@
   if (parse_result != JNI_OK) return parse_result;
 
 #ifdef JVMCI
-  OptionsValueTable* options = JVMCIRuntime::parse_arguments();
+  OptionValuesTable* options = JVMCIRuntime::parse_arguments();
   if (options == NULL) {
     return JNI_ERR;
   }