changeset 19344:83b35b97959c

Merge with f7b121b82697c3c3adcce9f9ea3fcc241c2eb968
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Thu, 12 Feb 2015 16:57:30 -0800
parents e8022bfd311d (current diff) f7b121b82697 (diff)
children 0d85421cb5d6
files graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineControlFlowGraph.java graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineFrameStateBuilder.java graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineLoop.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsAssignableFromNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInstanceNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java test/whitelist_baseline.txt
diffstat 45 files changed, 567 insertions(+), 1789 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java	Thu Feb 12 16:55:40 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,788 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.baseline;
-
-import static com.oracle.graal.compiler.common.GraalOptions.*;
-
-import java.util.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.compiler.common.alloc.*;
-import com.oracle.graal.compiler.common.calc.*;
-import com.oracle.graal.compiler.gen.*;
-import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.BciBlockMapping.BciBlock;
-import com.oracle.graal.java.BciBlockMapping.LocalLiveness;
-import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.StandardOp.BlockEndOp;
-import com.oracle.graal.lir.framemap.*;
-import com.oracle.graal.lir.gen.*;
-import com.oracle.graal.lir.phases.*;
-import com.oracle.graal.phases.*;
-
-public class BaselineBytecodeParser extends AbstractBytecodeParser<Value, BaselineFrameStateBuilder> implements BytecodeParserTool {
-    private Backend backend;
-    protected LIRGeneratorTool gen;
-    private LIRGenerationResult lirGenRes;
-    private BytecodeLIRBuilder lirBuilder;
-    @SuppressWarnings("unused") private BciBlock[] loopHeaders;
-    private LocalLiveness liveness;
-    private BciBlockBitMap blockVisited;
-
-    private static class BciBlockBitMap {
-        BitSet bitSet;
-
-        public BciBlockBitMap(BciBlockMapping blockMap) {
-            bitSet = new BitSet(blockMap.getBlocks().length);
-        }
-
-        public boolean get(BciBlock block) {
-            return bitSet.get(block.getId());
-        }
-
-        public void set(BciBlock block) {
-            bitSet.set(block.getId());
-        }
-    }
-
-    public BaselineBytecodeParser(MetaAccessProvider metaAccess, ResolvedJavaMethod method, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts,
-                    BaselineFrameStateBuilder frameState, Backend backend) {
-
-        super(metaAccess, method, graphBuilderConfig, optimisticOpts);
-        this.backend = backend;
-        this.setCurrentFrameState(frameState);
-    }
-
-    protected LIRGenerationResult build() {
-        if (PrintProfilingInformation.getValue()) {
-            TTY.println("Profiling info for " + method.format("%H.%n(%p)"));
-            TTY.println(MetaUtil.indent(profilingInfo.toString(method, CodeUtil.NEW_LINE), "  "));
-        }
-
-        try (Indent indent = Debug.logAndIndent("build graph for %s", method)) {
-
-            BciBlockMapping blockMap;
-            try (Scope ds = Debug.scope("BciBlockMapping")) {
-                // compute the block map, setup exception handlers and get the entrypoint(s)
-                blockMap = BciBlockMapping.create(method, graphBuilderConfig.doLivenessAnalysis(), false);
-            } catch (Throwable e) {
-                throw Debug.handle(e);
-            }
-
-            loopHeaders = blockMap.getLoopHeaders();
-            liveness = blockMap.liveness;
-            blockVisited = new BciBlockBitMap(blockMap);
-
-            if (method.isSynchronized()) {
-                throw GraalInternalError.unimplemented("Handle synchronized methods");
-            }
-
-            frameState = new BaselineFrameStateBuilder(method);
-            frameState.clearNonLiveLocals(blockMap.startBlock, liveness, true);
-
-            currentBlock = blockMap.startBlock;
-            blockMap.startBlock.setEntryState(0, frameState);
-            if (blockMap.startBlock.isLoopHeader) {
-                throw GraalInternalError.unimplemented("Handle start block as loop header");
-            }
-
-            // add loops ? how do we add looks when we haven't parsed the bytecode?
-
-            // create the control flow graph
-            BaselineControlFlowGraph cfg = BaselineControlFlowGraph.compute(blockMap);
-
-            // create the LIR
-            List<BciBlock> linearScanOrder = ComputeBlockOrder.computeLinearScanOrder(blockMap.getBlocks().length, blockMap.startBlock);
-            List<BciBlock> codeEmittingOrder = ComputeBlockOrder.computeCodeEmittingOrder(blockMap.getBlocks().length, blockMap.startBlock);
-            LIR lir = new LIR(cfg, linearScanOrder, codeEmittingOrder);
-
-            RegisterConfig registerConfig = null;
-            FrameMapBuilder frameMapBuilder = backend.newFrameMapBuilder(registerConfig);
-            TargetDescription target = backend.getTarget();
-            CallingConvention cc = CodeUtil.getCallingConvention(backend.getProviders().getCodeCache(), CallingConvention.Type.JavaCallee, method, false);
-            this.lirGenRes = backend.newLIRGenerationResult(lir, frameMapBuilder, method, null);
-            this.gen = backend.newLIRGenerator(cc, lirGenRes);
-            this.lirBuilder = backend.newBytecodeLIRBuilder(gen, this);
-
-            try (Scope ds = Debug.scope("BackEnd", lir)) {
-                try (Scope s = Debug.scope("LIRGen", gen)) {
-
-                    // possibly add all the arguments to slots in the local variable array
-
-                    for (BciBlock block : blockMap.getBlocks()) {
-                        emitBlock(block);
-                    }
-
-                    gen.beforeRegisterAllocation();
-                    Debug.dump(lir, "After LIR generation");
-                } catch (Throwable e) {
-                    throw Debug.handle(e);
-                }
-
-                try (Scope s = Debug.scope("LIRTier", this)) {
-                    LIRSuites lirSuites = backend.getSuites().getDefaultLIRSuites();
-                    return GraalCompiler.emitLowLevel(target, codeEmittingOrder, linearScanOrder, lirGenRes, gen, lirSuites);
-                } catch (Throwable e) {
-                    throw Debug.handle(e);
-                }
-
-            } catch (Throwable e) {
-                throw Debug.handle(e);
-            }
-        } catch (Throwable e) {
-            throw Debug.handle(e);
-        }
-    }
-
-    private void emitBlock(BciBlock b) {
-        if (lirGenRes.getLIR().getLIRforBlock(b) == null) {
-            for (BciBlock pred : b.getPredecessors()) {
-                if (!b.isLoopHeader() || !pred.isLoopEnd()) {
-                    emitBlock(pred);
-                }
-            }
-            processBlock(b);
-        }
-    }
-
-    @Override
-    protected void handleUnresolvedLoadConstant(JavaType type) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void handleUnresolvedCheckCast(JavaType type, Value object) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void handleUnresolvedInstanceOf(JavaType type, Value object) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void handleUnresolvedNewInstance(JavaType type) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void handleUnresolvedNewObjectArray(JavaType type, Value length) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void handleUnresolvedNewMultiArray(JavaType type, List<Value> dims) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void handleUnresolvedLoadField(JavaField field, Value receiver) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void handleUnresolvedStoreField(JavaField field, Value value, Value receiver) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void handleUnresolvedExceptionType(JavaType type) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genLoadIndexed(Value index, Value array, Kind kind) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genStoreIndexed(Value array, Value index, Kind kind, Value value) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genIntegerAdd(Kind kind, Value x, Value y) {
-        return gen.emitAdd(x, y, false);
-    }
-
-    @Override
-    protected Value genIntegerSub(Kind kind, Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genIntegerMul(Kind kind, Value x, Value y) {
-        return gen.emitMul(x, y, false);
-    }
-
-    @Override
-    protected Value genFloatAdd(Kind kind, Value x, Value y, boolean isStrictFP) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genFloatSub(Kind kind, Value x, Value y, boolean isStrictFP) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genFloatMul(Kind kind, Value x, Value y, boolean isStrictFP) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genFloatDiv(Kind kind, Value x, Value y, boolean isStrictFP) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genFloatRem(Kind kind, Value x, Value y, boolean isStrictFP) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genIntegerDiv(Kind kind, Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genIntegerRem(Kind kind, Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genNegateOp(Value x) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genLeftShift(Kind kind, Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genRightShift(Kind kind, Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genUnsignedRightShift(Kind kind, Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genAnd(Kind kind, Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genOr(Kind kind, Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genXor(Kind kind, Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genNormalizeCompare(Value x, Value y, boolean isUnorderedLess) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genFloatConvert(FloatConvert op, Value input) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genNarrow(Value input, int bitCount) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genSignExtend(Value input, int bitCount) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genZeroExtend(Value input, int bitCount) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genObjectEquals(Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genIntegerEquals(Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genIf(Value x, Condition cond, Value y) {
-        assert currentBlock.getSuccessors().size() == 2;
-        BciBlock trueBlock = currentBlock.getSuccessors().get(0);
-        BciBlock falseBlock = currentBlock.getSuccessors().get(1);
-        if (trueBlock == falseBlock) {
-            genGoto();
-            return;
-        }
-
-        double probability = branchProbability();
-
-        LabelRef trueDestination = getSuccessor(0);
-        LabelRef falseDestination = getSuccessor(1);
-
-        gen.emitCompareBranch(x.getKind(), x, y, cond, false, trueDestination, falseDestination, probability);
-    }
-
-    @Override
-    protected Value genIntegerLessThan(Value x, Value y) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genUnique(Value x) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genThrow() {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value createCheckCast(ResolvedJavaType type, Value object, JavaTypeProfile profileForTypeCheck, boolean b) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value createInstanceOf(ResolvedJavaType type, Value object, JavaTypeProfile profileForTypeCheck) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genConditional(Value x) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value createNewInstance(ResolvedJavaType type, boolean fillContents) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value createNewArray(ResolvedJavaType elementType, Value length, boolean fillContents) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value createNewMultiArray(ResolvedJavaType type, List<Value> dims) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genLoadField(Value receiver, ResolvedJavaField field) {
-        if (field.isStatic()) {
-            Value classRef = lirBuilder.getClassConstant(field.getDeclaringClass());
-            long displacement = lirBuilder.getFieldOffset(field);
-            Value address = gen.emitAddress(classRef, displacement, Value.ILLEGAL, 0);
-            LIRKind readKind = backend.getTarget().getLIRKind(field.getKind());
-            LIRFrameState state = createFrameState(frameState);
-            return gen.emitLoad(readKind, address, state);
-        }
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void emitNullCheck(Value receiver) {
-        gen.emitNullCheck(receiver, createFrameState(frameState));
-    }
-
-    @Override
-    protected void emitBoundsCheck(Value index, Value length) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genArrayLength(Value array) {
-        emitNullCheck(array);
-        long displacement = lirBuilder.getArrayLengthOffset();
-        Value address = gen.emitAddress(array, displacement, Value.ILLEGAL, 0);
-        LIRKind readKind = backend.getTarget().getLIRKind(Kind.Int);
-        LIRFrameState state = createFrameState(frameState);
-        return gen.emitLoad(readKind, address, state);
-    }
-
-    private LIRFrameState createFrameState(BaselineFrameStateBuilder state) {
-        LabelRef exceptionEdge = null;
-        BytecodeFrame caller = null;
-        boolean duringCall = false;
-        int numLocals = state.localsSize();
-        int numStack = state.stackSize();
-        int numLocks = state.lockDepth();
-        JavaValue[] values = new JavaValue[numLocals + numStack + numLocks];
-
-        for (int i = 0; i < numLocals; i++) {
-            values[i] = (JavaValue) state.localAt(i);
-        }
-
-        for (int i = 0; i < numStack; i++) {
-            values[numLocals + i] = (JavaValue) state.stackAt(i);
-        }
-
-        for (int i = 0; i < numStack; i++) {
-            values[numLocals + numStack + i] = (JavaValue) state.lockAt(i);
-        }
-
-        BytecodeFrame frame = new BytecodeFrame(caller, method, bci(), state.rethrowException(), duringCall, values, numLocals, numStack, numLocks);
-        return new LIRFrameState(frame, null, exceptionEdge);
-    }
-
-    @Override
-    protected Value genStoreField(Value receiver, ResolvedJavaField field, Value value) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genInvokeStatic(JavaMethod target) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genInvokeInterface(JavaMethod target) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genInvokeDynamic(JavaMethod target) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genInvokeVirtual(JavaMethod target) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genInvokeSpecial(JavaMethod target) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genReturn(Value x) {
-        gen.emitReturn(x);
-    }
-
-    @Override
-    protected Value genMonitorEnter(Value x) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value genMonitorExit(Value x, Value returnValue) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genJsr(int dest) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genRet(int localIndex) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected void genIntegerSwitch(Value value, ArrayList<BciBlock> actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors) {
-        // TODO Auto-generated method stub
-        throw GraalInternalError.unimplemented("Auto-generated method stub");
-    }
-
-    @Override
-    protected Value appendConstant(JavaConstant constant) {
-        return gen.emitLoadConstant(constant.getLIRKind(), constant);
-    }
-
-    @Override
-    protected Value append(Value v) {
-        return v;
-    }
-
-    private void createTarget(BciBlock block) {
-        assert block != null && frameState != null;
-        assert !block.isExceptionEntry || frameState.stackSize() == 1;
-
-        if (!blockVisited.get(block)) {
-            /*
-             * This is the first time we see this block as a branch target. Create and return a
-             * placeholder that later can be replaced with a MergeNode when we see this block again.
-             */
-            blockVisited.set(block);
-            if (block.getPredecessorCount() > 1) {
-                /*
-                 * If there are more than one predecessors we have to ensure that we are not passing
-                 * constants to the new framestate otherwise we will get interfacing problems.
-                 */
-                moveConstantsToVariables();
-            }
-            block.setEntryState(0, frameState.copy());
-            block.getEntryState(0).clearNonLiveLocals(block, liveness, true);
-
-            Debug.log("createTarget %s: first visit", block);
-            return;
-        }
-
-        // We already saw this block before, so we have to merge states.
-        if (!((BaselineFrameStateBuilder) block.getEntryState(0)).isCompatibleWith(frameState)) {
-            throw new BailoutException("stacks do not match; bytecodes would not verify");
-        }
-
-        if (block.isLoopHeader) {
-            assert currentBlock == null || currentBlock.getId() >= block.getId() : "must be backward branch";
-            if (currentBlock != null && currentBlock.numNormalSuccessors() == 1) {
-                // this is the only successor of the current block so we can adjust
-                adaptFramestate((BaselineFrameStateBuilder) block.getEntryState(0));
-                return;
-            }
-            GraalInternalError.unimplemented("Loops not yet supported");
-        }
-        assert currentBlock == null || currentBlock.getId() < block.getId() : "must not be backward branch";
-
-        /*
-         * This is the second time we see this block. Create the actual MergeNode and the End Node
-         * for the already existing edge. For simplicity, we leave the placeholder in the graph and
-         * just append the new nodes after the placeholder.
-         */
-        if (currentBlock != null && currentBlock.numNormalSuccessors() == 1) {
-            // this is the only successor of the current block so we can adjust
-            adaptFramestate((BaselineFrameStateBuilder) block.getEntryState(0));
-            return;
-        }
-        GraalInternalError.unimplemented("second block visit not yet implemented");
-
-        // merge frame states e.g. block.entryState.merge(mergeNode, target.state);
-
-        Debug.log("createTarget %s: merging state", block);
-    }
-
-    private void moveConstantsToVariables() {
-        Debug.log("moveConstantsToVariables: framestate before: %s", frameState);
-        for (int i = 0; i < frameState.stackSize(); i++) {
-            Value src = frameState.stackAt(i);
-            if (src instanceof JavaConstant) {
-                AllocatableValue dst = gen.newVariable(src.getLIRKind());
-                gen.emitMove(dst, src);
-                frameState.storeStack(i, dst);
-                Debug.log("introduce new variabe %s for stackslot %d (end of block %s", dst, i, currentBlock);
-            }
-        }
-        for (int i = 0; i < frameState.localsSize(); i++) {
-            Value src = frameState.localAt(i);
-            if (src instanceof JavaConstant) {
-                AllocatableValue dst = gen.newVariable(src.getLIRKind());
-                gen.emitMove(dst, src);
-                frameState.storeLocal(i, dst);
-                Debug.log("introduce new variabe %s for local %d (end of block %s", dst, i, currentBlock);
-            }
-        }
-        Debug.log("moveConstantsToVariables: framestate after: %s", frameState);
-    }
-
-    private static void adaptValues(Value dst, Value src, PhiResolver resolver) {
-        if (dst == null) {
-            return;
-        }
-        assert src != null : "Source is null but Destination is not!";
-
-        if (!dst.equals(src)) {
-            resolver.move(dst, src);
-        }
-    }
-
-    private void adaptFramestate(BaselineFrameStateBuilder other) {
-        assert frameState.isCompatibleWith(other) : "framestates not compatible!";
-        PhiResolver resolver = new PhiResolver(gen);
-        for (int i = 0; i < frameState.stackSize(); i++) {
-            Value src = frameState.stackAt(i);
-            Value dst = other.stackAt(i);
-            adaptValues(dst, src, resolver);
-        }
-        for (int i = 0; i < frameState.localsSize(); i++) {
-            Value src = frameState.localAt(i);
-            Value dst = other.localAt(i);
-            adaptValues(dst, src, resolver);
-        }
-        resolver.dispose();
-    }
-
-    protected void processBlock(BciBlock block) {
-        frameState = (BaselineFrameStateBuilder) block.getEntryState(0);
-        setCurrentFrameState(frameState);
-        currentBlock = block;
-        iterateBytecodesForBlock(block);
-    }
-
-    private boolean isBlockEnd() {
-        List<LIRInstruction> l = gen.getResult().getLIR().getLIRforBlock(currentBlock);
-        if (l.isEmpty()) {
-            return false;
-        }
-        return l.get(l.size() - 1) instanceof BlockEndOp;
-    }
-
-    @Override
-    protected void iterateBytecodesForBlock(BciBlock block) {
-        gen.doBlockStart(block);
-
-        if (block == gen.getResult().getLIR().getControlFlowGraph().getStartBlock()) {
-            assert block.getPredecessorCount() == 0;
-            lirBuilder.emitPrologue(method);
-        } else {
-            assert block.getPredecessorCount() > 0;
-        }
-
-        if (block.isLoopHeader) {
-            /*
-             * We need to preserve the frame state builder of the loop header so that we can merge
-             * values for phi functions, so make a copy of it.
-             */
-            block.setEntryState(0, frameState.copy());
-
-        }
-        int endBCI = stream.endBCI();
-
-        stream.setBCI(block.startBci);
-        int bci = block.startBci;
-        BytecodesParsed.add(block.endBci - bci);
-
-        while (bci < endBCI) {
-
-            // read the opcode
-            int opcode = stream.currentBC();
-            // traceState();
-            traceInstruction(bci, opcode, bci == block.startBci);
-
-            processBytecode(bci, opcode);
-
-            stream.next();
-            bci = stream.currentBCI();
-
-            if (isBlockEnd()) {
-                break;
-            }
-
-            if (bci < endBCI) {
-                if (bci > block.endBci) {
-                    if (block.numNormalSuccessors() == 1) {
-                        assert !block.getSuccessor(0).isExceptionEntry;
-                        // we fell through to the next block, add a goto and break
-                        genGoto();
-                    }
-                    break;
-                }
-            }
-        }
-
-        assert LIR.verifyBlock(gen.getResult().getLIR(), block);
-        gen.doBlockEnd(block);
-    }
-
-    public void storeLocal(int i, Value x) {
-        frameState.storeLocal(i, x);
-    }
-
-    LabelRef getSuccessor(int index) {
-        createTarget(currentBlock.getSuccessor(index));
-        return LabelRef.forSuccessor(lirGenRes.getLIR(), currentBlock, index);
-    }
-
-    @Override
-    protected void genGoto() {
-        gen.emitJump(getSuccessor(0));
-    }
-
-}
--- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java	Thu Feb 12 16:55:40 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.baseline;
-
-import static com.oracle.graal.compiler.common.GraalOptions.*;
-
-import java.util.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.*;
-import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.java.*;
-import com.oracle.graal.lir.asm.*;
-import com.oracle.graal.lir.gen.*;
-import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.phases.*;
-
-/**
- * The {@code GraphBuilder} class parses the bytecode of a method and builds the IR graph.
- */
-public class BaselineCompiler {
-
-    public BaselineCompiler(GraphBuilderConfiguration graphBuilderConfig, MetaAccessProvider metaAccess) {
-        this.graphBuilderConfig = graphBuilderConfig;
-        this.metaAccess = metaAccess;
-    }
-
-    private final MetaAccessProvider metaAccess;
-
-    private final GraphBuilderConfiguration graphBuilderConfig;
-
-    public CompilationResult generate(ResolvedJavaMethod method, @SuppressWarnings("unused") int entryBCI, Backend backend, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner,
-                    CompilationResultBuilderFactory factory, OptimisticOptimizations optimisticOpts, @SuppressWarnings("unused") Replacements replacements) {
-        assert method.getCode() != null : "method must contain bytecodes: " + method;
-        TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method);
-
-        BaselineFrameStateBuilder frameState = new BaselineFrameStateBuilder(method);
-
-        BaselineBytecodeParser parser = new BaselineBytecodeParser(metaAccess, method, graphBuilderConfig, optimisticOpts, frameState, backend);
-
-        // build blocks and LIR instructions
-        final LIRGenerationResult res;
-        try {
-            res = parser.build();
-        } finally {
-            filter.remove();
-        }
-
-        // emitCode
-        Assumptions assumptions = OptAssumptions.getValue() ? new Assumptions() : null;
-        GraalCompiler.emitCode(backend, assumptions, Collections.emptySet(), res, compilationResult, installedCodeOwner, factory);
-
-        return compilationResult;
-    }
-}
--- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineControlFlowGraph.java	Thu Feb 12 16:55:40 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.baseline;
-
-import java.util.*;
-
-import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.BciBlockMapping.BciBlock;
-
-public final class BaselineControlFlowGraph implements AbstractControlFlowGraph<BciBlock> {
-
-    private BciBlock[] blocks;
-    private Collection<Loop<BciBlock>> loops;
-
-    public static BaselineControlFlowGraph compute(BciBlockMapping blockMap) {
-        try (Scope ds = Debug.scope("BaselineCFG", blockMap)) {
-            BaselineControlFlowGraph cfg = new BaselineControlFlowGraph(blockMap);
-            cfg.computePredecessors();
-            cfg.computeLoopInformation(blockMap);
-            AbstractControlFlowGraph.computeDominators(cfg);
-
-            assert CFGVerifier.verify(cfg);
-
-            return cfg;
-        } catch (Throwable e) {
-            throw Debug.handle(e);
-        }
-    }
-
-    private BaselineControlFlowGraph(BciBlockMapping blockMap) {
-        blocks = blockMap.getBlocks();
-        loops = new ArrayList<>();
-    }
-
-    public List<BciBlock> getBlocks() {
-        return Arrays.asList(blocks);
-    }
-
-    public Collection<Loop<BciBlock>> getLoops() {
-        return loops;
-    }
-
-    public BciBlock getStartBlock() {
-        if (blocks.length > 0) {
-            return blocks[0];
-        }
-        return null;
-    }
-
-    /**
-     * Create and populate the predecessor list.
-     */
-    private void computePredecessors() {
-        // set predecessors
-        for (BciBlock block : blocks) {
-            block.setPredecessors(new ArrayList<>(4));
-        }
-        // calculate predecessors
-        for (BciBlock block : blocks) {
-            for (BciBlock succ : block.getSuccessors()) {
-                succ.getPredecessors().add(block);
-            }
-        }
-    }
-
-    private void computeLoopInformation(BciBlockMapping blockMap) {
-        try (Indent indent = Debug.logAndIndent("computeLoopInformation")) {
-            for (BciBlock block : blocks) {
-                calcLoop(block, blockMap);
-                Debug.log("Block: %s, Loop: %s", block, block.getLoop());
-            }
-        }
-    }
-
-    private Loop<BciBlock> getLoop(int index, BciBlockMapping blockMap) {
-        BciBlock header = blockMap.getLoopHeader(index);
-        assert header.getLoopDepth() > 0;
-        Loop<BciBlock> loop = header.getLoop();
-
-        if (loop == null) {
-            Loop<BciBlock> parent = null;
-
-            if (header.getLoopDepth() > 1) {
-                // Recursively create out loops.
-                Iterator<Integer> i = header.loopIdIterable().iterator();
-                assert i.hasNext() : "BciBlock.loopIdIterable() must return exactly BciBlock.getLoopDepth() elements!";
-                int outerLoopId = i.next();
-                assert index == outerLoopId : "The first loopId must be the id of the loop that is started by this header!";
-                assert i.hasNext() : "BciBlock.loopIdIterable() must return exactly BciBlock.getLoopDepth() elements!";
-                outerLoopId = i.next();
-                parent = getLoop(outerLoopId, blockMap);
-            }
-
-            loop = new BaselineLoop(parent, index, header);
-            loops.add(loop);
-            header.setLoop(loop);
-        }
-        return loop;
-    }
-
-    private void calcLoop(BciBlock block, BciBlockMapping blockMap) {
-        int loopId = block.getLoopId();
-        if (loopId != -1) {
-            block.setLoop(getLoop(loopId, blockMap));
-
-        }
-    }
-
-}
--- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineFrameStateBuilder.java	Thu Feb 12 16:55:40 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.oracle.graal.baseline;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.java.*;
-
-public class BaselineFrameStateBuilder extends AbstractFrameStateBuilder<Value, BaselineFrameStateBuilder> {
-
-    private static final Value[] EMPTY_ARRAY = new Value[0];
-
-    public BaselineFrameStateBuilder(ResolvedJavaMethod method) {
-        // we always need at least one stack slot (for exceptions)
-        super(method);
-    }
-
-    protected BaselineFrameStateBuilder(BaselineFrameStateBuilder other) {
-        super(other);
-    }
-
-    @Override
-    protected Value[] allocateArray(int length) {
-        return length == 0 ? EMPTY_ARRAY : new Value[length];
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("[locals: [");
-        for (int i = 0; i < locals.length; i++) {
-            sb.append(i == 0 ? "" : ",").append(locals[i] == null ? "_" : locals[i].toString());
-        }
-        sb.append("] stack: [");
-        for (int i = 0; i < stackSize; i++) {
-            sb.append(i == 0 ? "" : ",").append(stack[i] == null ? "_" : stack[i].toString());
-        }
-        sb.append("] locks: [");
-        for (int i = 0; i < lockedObjects.length; i++) {
-            sb.append(i == 0 ? "" : ",").append(lockedObjects[i].toString());
-        }
-        sb.append("]");
-        if (rethrowException) {
-            sb.append(" rethrowException");
-        }
-        sb.append("]");
-        return sb.toString();
-    }
-
-    @Override
-    public BaselineFrameStateBuilder copy() {
-        return new BaselineFrameStateBuilder(this);
-    }
-
-    private static boolean isCompatible(Value x, Value y) {
-        if (x == null && y == null) {
-            return true;
-        }
-        if ((x == null || y == null) || (x.getKind() != y.getKind())) {
-            return false;
-        }
-        return true;
-
-    }
-
-    @Override
-    public boolean isCompatibleWith(BaselineFrameStateBuilder other) {
-        assert method.equals(other.method) && localsSize() == other.localsSize() : "Can only compare frame states of the same method";
-
-        if (stackSize() != other.stackSize()) {
-            return false;
-        }
-        for (int i = 0; i < stackSize(); i++) {
-            if (!isCompatible(stackAt(i), other.stackAt(i))) {
-                return false;
-            }
-        }
-        if (lockedObjects.length != other.lockedObjects.length) {
-            return false;
-        }
-        return true;
-    }
-}
--- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineLoop.java	Thu Feb 12 16:55:40 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.oracle.graal.baseline;
-
-import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.java.BciBlockMapping.BciBlock;
-
-public class BaselineLoop extends Loop<BciBlock> {
-
-    protected BaselineLoop(Loop<BciBlock> parent, int index, BciBlock header) {
-        super(parent, index, header);
-    }
-
-    @Override
-    public long numBackedges() {
-        // currently only loops with one backedge are supported
-        return 1;
-    }
-
-}
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Thu Feb 12 16:57:30 2015 -0800
@@ -30,9 +30,6 @@
 // @formatter:off
 public final class GraalOptions {
 
-    @Option(help = "Use experimental baseline compiler configuration.", type = OptionType.Debug)
-    public static final OptionValue<Boolean> UseBaselineCompiler = new OptionValue<>(false);
-
     @Option(help = "Use compiler intrinsifications.", type = OptionType.Debug)
     public static final OptionValue<Boolean> Intrinsify = new OptionValue<>(true);
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Thu Feb 12 16:57:30 2015 -0800
@@ -40,7 +40,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.baseline.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.GraalCompiler.Request;
 import com.oracle.graal.compiler.common.*;
@@ -482,12 +481,7 @@
 
         checkArgs(method, executeArgs);
 
-        InstalledCode compiledMethod = null;
-        if (UseBaselineCompiler.getValue()) {
-            compiledMethod = getCodeBaseline(method);
-        } else {
-            compiledMethod = getCode(method);
-        }
+        InstalledCode compiledMethod = getCode(method);
         try {
             return new Result(compiledMethod.executeVarargs(executeArgs), null);
         } catch (Throwable e) {
@@ -497,73 +491,6 @@
         }
     }
 
-    protected InstalledCode getCodeBaseline(ResolvedJavaMethod javaMethod) {
-        return getCodeBaseline(javaMethod, false);
-    }
-
-    protected InstalledCode getCodeBaseline(ResolvedJavaMethod javaMethod, boolean forceCompile) {
-        assert javaMethod.getAnnotation(Test.class) == null : "shouldn't parse method with @Test annotation: " + javaMethod;
-
-        try (Scope bds = Debug.scope("Baseline")) {
-            Debug.log("getCodeBaseline()");
-        } catch (Throwable e) {
-            throw Debug.handle(e);
-        }
-
-        if (!forceCompile) {
-            InstalledCode cached = cache.get(javaMethod);
-            if (cached != null) {
-                if (cached.isValid()) {
-                    return cached;
-                }
-            }
-        }
-
-        final int id = compilationId.incrementAndGet();
-
-        InstalledCode installedCode = null;
-        try (Scope ds = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true))) {
-            final boolean printCompilation = PrintCompilation.getValue() && !TTY.isSuppressed();
-
-            if (printCompilation) {
-                TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s ...", id, javaMethod.getDeclaringClass().getName(), javaMethod.getName(), javaMethod.getSignature()));
-            }
-            long start = System.currentTimeMillis();
-
-            CompilationResult compResult = compileBaseline(javaMethod);
-
-            if (printCompilation) {
-                TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s | %4dms %5dB", id, "", "", "", System.currentTimeMillis() - start, compResult.getTargetCodeSize()));
-            }
-
-            try (Scope s = Debug.scope("CodeInstall", getCodeCache(), javaMethod)) {
-                installedCode = addMethod(javaMethod, compResult);
-                if (installedCode == null) {
-                    throw new GraalInternalError("Could not install code for " + javaMethod.format("%H.%n(%p)"));
-                }
-            } catch (Throwable e) {
-                throw Debug.handle(e);
-            }
-        } catch (Throwable e) {
-            throw Debug.handle(e);
-        }
-
-        if (!forceCompile) {
-            cache.put(javaMethod, installedCode);
-        }
-        return installedCode;
-    }
-
-    private CompilationResult compileBaseline(ResolvedJavaMethod javaMethod) {
-        try (Scope bds = Debug.scope("CompileBaseline", javaMethod, providers.getCodeCache())) {
-            BaselineCompiler baselineCompiler = new BaselineCompiler(GraphBuilderConfiguration.getDefault(), providers.getMetaAccess());
-            OptimisticOptimizations optimisticOpts = OptimisticOptimizations.ALL;
-            return baselineCompiler.generate(javaMethod, -1, getBackend(), new CompilationResult(), javaMethod, CompilationResultBuilderFactory.Default, optimisticOpts, getReplacements());
-        } catch (Throwable e) {
-            throw Debug.handle(e);
-        }
-    }
-
     protected void checkArgs(ResolvedJavaMethod method, Object[] args) {
         JavaType[] sig = method.toParameterTypes();
         Assert.assertEquals(sig.length, args.length);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu Feb 12 16:57:30 2015 -0800
@@ -265,6 +265,7 @@
             graph.maybeCompress();
 
             SchedulePhase schedule = new SchedulePhase();
+            schedule.setScheduleConstants(true);
             schedule.apply(graph);
             Debug.dump(schedule, "Final HIR schedule");
             return schedule;
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java	Thu Feb 12 16:57:30 2015 -0800
@@ -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
@@ -33,25 +33,20 @@
  */
 public class HotSpotMethodSubstitutionTest extends MethodSubstitutionTest {
 
-    /*
-     * We have to ignore this test for now because currently there is no way to read uncompressed
-     * pointers in a compressed world via JNI.
-     */
-    @Ignore
     @Test
     public void testObjectSubstitutions() {
+        TestClassA obj = new TestClassA();
+
         test("getClass0");
         test("objectHashCode");
 
-        Object obj = new Object();
-
-        assertDeepEquals("a string".getClass(), ObjectSubstitutions.getClass("a string"));
-        assertDeepEquals(obj.hashCode(), ObjectSubstitutions.hashCode(obj));
+        test("getClass0", "a string");
+        test("objectHashCode", obj);
     }
 
     @SuppressWarnings("all")
-    public static boolean getClass0(Object obj, Class<?> clazz) {
-        return obj.getClass() == clazz;
+    public static Class<?> getClass0(Object obj) {
+        return obj.getClass();
     }
 
     @SuppressWarnings("all")
@@ -59,15 +54,9 @@
         return obj.hashCode();
     }
 
-    /*
-     * We have to ignore this test for now because currently there is no way to read uncompressed
-     * pointers in a compressed world via JNI.
-     */
-    @Ignore
     @Test
     public void testClassSubstitutions() {
         test("getModifiers");
-        test("isInstance");
         test("isInterface");
         test("isArray");
         test("isPrimitive");
@@ -75,15 +64,12 @@
         test("getComponentType");
 
         for (Class<?> c : new Class[]{getClass(), Cloneable.class, int[].class, String[][].class}) {
-            assertDeepEquals(c.getModifiers(), ClassSubstitutions.getModifiers(c));
-            assertDeepEquals(c.isInterface(), ClassSubstitutions.isInterface(c));
-            assertDeepEquals(c.isArray(), ClassSubstitutions.isArray(c));
-            assertDeepEquals(c.isPrimitive(), ClassSubstitutions.isPrimitive(c));
-            assertDeepEquals(c.getSuperclass(), ClassSubstitutions.getSuperclass(c));
-            assertDeepEquals(c.getComponentType(), ClassSubstitutions.getComponentType(c));
-            for (Object o : new Object[]{this, new int[5], new String[2][], new Object()}) {
-                assertDeepEquals(c.isInstance(o), ClassSubstitutions.isInstance(c, o));
-            }
+            test("getModifiers", c);
+            test("isInterface", c);
+            test("isArray", c);
+            test("isPrimitive", c);
+            test("getSuperClass", c);
+            test("getComponentType", c);
         }
     }
 
@@ -93,11 +79,6 @@
     }
 
     @SuppressWarnings("all")
-    public static boolean isInstance(Class<?> clazz) {
-        return clazz.isInstance(Number.class);
-    }
-
-    @SuppressWarnings("all")
     public static boolean isInterface(Class<?> clazz) {
         return clazz.isInterface();
     }
@@ -122,11 +103,6 @@
         return clazz.getComponentType();
     }
 
-    /*
-     * We have to ignore this test for now because currently there is no way to read uncompressed
-     * pointers in a compressed world via JNI.
-     */
-    @Ignore
     @Test
     public void testThreadSubstitutions() {
         test("currentThread");
@@ -134,13 +110,13 @@
         test("threadInterrupted");
 
         Thread currentThread = Thread.currentThread();
-        assertDeepEquals(currentThread, ThreadSubstitutions.currentThread());
-        assertDeepEquals(currentThread.isInterrupted(), ThreadSubstitutions.isInterrupted(currentThread, false));
+        test("currentThread", currentThread);
+        test("threadIsInterrupted", currentThread);
     }
 
     @SuppressWarnings("all")
-    public static Thread currentThread() {
-        return Thread.currentThread();
+    public static boolean currentThread(Thread other) {
+        return Thread.currentThread() == other;
     }
 
     @SuppressWarnings("all")
@@ -161,7 +137,7 @@
         SystemSubstitutions.currentTimeMillis();
         SystemSubstitutions.nanoTime();
         for (Object o : new Object[]{this, new int[5], new String[2][], new Object()}) {
-            assertDeepEquals(System.identityHashCode(o), SystemSubstitutions.identityHashCode(o));
+            test("systemIdentityHashCode", o);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Feb 12 16:57:30 2015 -0800
@@ -42,7 +42,6 @@
 import com.oracle.graal.api.code.CallingConvention.Type;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.baseline.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
@@ -53,7 +52,6 @@
 import com.oracle.graal.hotspot.events.EventProvider.CompilerFailureEvent;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.phases.*;
-import com.oracle.graal.java.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.nodes.*;
@@ -197,52 +195,45 @@
                 // Begin the compilation event.
                 compilationEvent.begin();
 
-                if (UseBaselineCompiler.getValue() == true) {
-                    HotSpotProviders providers = backend.getProviders();
-                    BaselineCompiler baselineCompiler = new BaselineCompiler(GraphBuilderConfiguration.getDefault(), providers.getMetaAccess());
-                    OptimisticOptimizations optimisticOpts = OptimisticOptimizations.ALL;
-                    result = baselineCompiler.generate(method, -1, backend, new CompilationResult(), method, CompilationResultBuilderFactory.Default, optimisticOpts, providers.getReplacements());
-                } else {
-                    Map<ResolvedJavaMethod, StructuredGraph> graphCache = null;
-                    if (GraalOptions.CacheGraphs.getValue()) {
-                        graphCache = new HashMap<>();
-                    }
+                Map<ResolvedJavaMethod, StructuredGraph> graphCache = null;
+                if (GraalOptions.CacheGraphs.getValue()) {
+                    graphCache = new HashMap<>();
+                }
 
-                    boolean recordEvolMethodDeps = graalEnv == 0 || unsafe.getByte(graalEnv + config.graalEnvJvmtiCanHotswapOrPostBreakpointOffset) != 0;
+                boolean recordEvolMethodDeps = graalEnv == 0 || unsafe.getByte(graalEnv + config.graalEnvJvmtiCanHotswapOrPostBreakpointOffset) != 0;
 
-                    HotSpotProviders providers = backend.getProviders();
-                    Replacements replacements = providers.getReplacements();
-                    graph = replacements.getMethodSubstitution(method);
-                    if (graph == null || entryBCI != INVOCATION_ENTRY_BCI) {
-                        graph = new StructuredGraph(method, entryBCI, AllowAssumptions.from(OptAssumptions.getValue()));
-                        if (!recordEvolMethodDeps) {
-                            graph.disableMethodRecording();
-                        }
-                    } else {
-                        // Compiling method substitution - must clone the graph
-                        graph = graph.copy(graph.name, method, AllowAssumptions.from(OptAssumptions.getValue()), recordEvolMethodDeps);
+                HotSpotProviders providers = backend.getProviders();
+                Replacements replacements = providers.getReplacements();
+                graph = replacements.getMethodSubstitution(method);
+                if (graph == null || entryBCI != INVOCATION_ENTRY_BCI) {
+                    graph = new StructuredGraph(method, entryBCI, AllowAssumptions.from(OptAssumptions.getValue()));
+                    if (!recordEvolMethodDeps) {
+                        graph.disableMethodRecording();
                     }
-                    InlinedBytecodes.add(method.getCodeSize());
-                    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(), graphCache, getGraphBuilderSuite(providers), optimisticOpts, profilingInfo,
-                                    method.getSpeculationLog(), suites, lirSuites, new CompilationResult(), CompilationResultBuilderFactory.Default);
+                } else {
+                    // Compiling method substitution - must clone the graph
+                    graph = graph.copy(graph.name, method, AllowAssumptions.from(OptAssumptions.getValue()), recordEvolMethodDeps);
                 }
+                InlinedBytecodes.add(method.getCodeSize());
+                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(), graphCache, getGraphBuilderSuite(providers), optimisticOpts, profilingInfo,
+                                method.getSpeculationLog(), suites, lirSuites, new CompilationResult(), CompilationResultBuilderFactory.Default);
                 result.setId(getId());
                 result.setEntryBCI(entryBCI);
             } catch (Throwable e) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java	Thu Feb 12 16:57:30 2015 -0800
@@ -119,6 +119,10 @@
             if (graph.getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS) {
                 instanceofSnippets.lower((InstanceOfDynamicNode) n, tool);
             }
+        } else if (n instanceof ClassIsAssignableFromNode) {
+            if (graph.getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS) {
+                instanceofSnippets.lower((ClassIsAssignableFromNode) n, tool);
+            }
         } else if (n instanceof NewInstanceNode) {
             if (graph.getGuardsStage().areFrameStatesAtDeopts()) {
                 newObjectSnippets.lower((NewInstanceNode) n, registers, tool);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Thu Feb 12 16:57:30 2015 -0800
@@ -32,7 +32,9 @@
 import com.oracle.graal.java.GraphBuilderPlugins.Registration;
 import com.oracle.graal.java.GraphBuilderPlugins.Registration.Receiver;
 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.spi.*;
 import com.oracle.graal.options.*;
 
@@ -73,6 +75,20 @@
                 return false;
             }
         });
+        r.register2("isInstance", Receiver.class, Object.class, new InvocationPlugin() {
+            public boolean apply(GraphBuilderContext builder, ValueNode rcvr, ValueNode object) {
+                if (rcvr.isConstant() && !rcvr.isNullConstant()) {
+                    ResolvedJavaType type = builder.getConstantReflection().asJavaType(rcvr.asConstant());
+                    if (type != null && !type.isPrimitive()) {
+                        LogicNode node = builder.append(InstanceOfNode.create(type, object, null));
+                        builder.push(Kind.Boolean.getStackKind(), builder.append(ConditionalNode.create(node)));
+                        return true;
+                    }
+                }
+                return false;
+            }
+        });
+
         // StableOptionValue.class
         r = new Registration(plugins, metaAccess, StableOptionValue.class);
         r.register1("getValue", Receiver.class, new InvocationPlugin() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java	Thu Feb 12 16:57:30 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#cast(Object)}.
  *
- * @see ClassSubstitutions#cast(Class, Object)
+ * @see HotSpotClassSubstitutions#cast(Class, Object)
  */
 @NodeInfo
 public final class ClassCastNode extends MacroStateSplitNode implements Canonicalizable.Binary<ValueNode> {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetClassLoader0Node.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetClassLoader0Node.java	Thu Feb 12 16:57:30 2015 -0800
@@ -34,7 +34,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#getClassLoader0()}.
  *
- * @see ClassSubstitutions#getClassLoader0(Class)
+ * @see HotSpotClassSubstitutions#getClassLoader0(Class)
  */
 @SuppressWarnings("javadoc")
 @NodeInfo
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java	Thu Feb 12 16:57:30 2015 -0800
@@ -34,7 +34,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#getComponentType()}.
  *
- * @see ClassSubstitutions#getComponentType(Class)
+ * @see HotSpotClassSubstitutions#getComponentType(Class)
  */
 @NodeInfo
 public final class ClassGetComponentTypeNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java	Thu Feb 12 16:57:30 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#getModifiers()}.
  *
- * @see ClassSubstitutions#getModifiers(Class)
+ * @see HotSpotClassSubstitutions#getModifiers(Class)
  */
 @NodeInfo
 public final class ClassGetModifiersNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java	Thu Feb 12 16:57:30 2015 -0800
@@ -34,7 +34,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#getSuperclass()}.
  *
- * @see ClassSubstitutions#getSuperclass(Class)
+ * @see HotSpotClassSubstitutions#getSuperclass(Class)
  */
 @NodeInfo
 public final class ClassGetSuperclassNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java	Thu Feb 12 16:57:30 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#isArray()}.
  *
- * @see ClassSubstitutions#isArray(Class)
+ * @see HotSpotClassSubstitutions#isArray(Class)
  */
 @NodeInfo
 public final class ClassIsArrayNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsAssignableFromNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.nodes;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.graph.spi.*;
-import com.oracle.graal.hotspot.replacements.*;
-import com.oracle.graal.nodeinfo.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.replacements.nodes.*;
-
-/**
- * {@link MacroNode Macro node} for {@link Class#isAssignableFrom(Class)}.
- *
- * @see ClassSubstitutions#isAssignableFrom(Class, Class)
- */
-@NodeInfo
-public final class ClassIsAssignableFromNode extends MacroStateSplitNode implements Canonicalizable {
-    public ClassIsAssignableFromNode(Invoke invoke) {
-        super(invoke);
-    }
-
-    private ValueNode getJavaClass() {
-        return arguments.get(0);
-    }
-
-    private ValueNode getOtherClass() {
-        return arguments.get(1);
-    }
-
-    @Override
-    public Node canonical(CanonicalizerTool tool) {
-        ValueNode javaClass = getJavaClass();
-        ValueNode otherClass = getOtherClass();
-        if (javaClass.isConstant() && otherClass.isConstant()) {
-            ConstantReflectionProvider constantReflection = tool.getConstantReflection();
-            ResolvedJavaType thisType = constantReflection.asJavaType(javaClass.asJavaConstant());
-            ResolvedJavaType otherType = constantReflection.asJavaType(otherClass.asJavaConstant());
-            if (thisType != null && otherType != null) {
-                return ConstantNode.forBoolean(thisType.isAssignableFrom(otherType));
-            }
-        }
-        return this;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInstanceNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.nodes;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.graph.spi.*;
-import com.oracle.graal.hotspot.replacements.*;
-import com.oracle.graal.nodeinfo.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.java.*;
-import com.oracle.graal.replacements.nodes.*;
-
-/**
- * {@link MacroNode Macro node} for {@link Class#isInstance(Object)}.
- *
- * @see ClassSubstitutions#isInstance(Class, Object)
- */
-@NodeInfo
-public final class ClassIsInstanceNode extends MacroNode implements Canonicalizable {
-
-    public ClassIsInstanceNode(Invoke invoke) {
-        super(invoke);
-    }
-
-    private ValueNode getJavaClass() {
-        return arguments.get(0);
-    }
-
-    private ValueNode getObject() {
-        return arguments.get(1);
-    }
-
-    @Override
-    public Node canonical(CanonicalizerTool tool) {
-        ValueNode javaClass = getJavaClass();
-        if (javaClass.isConstant()) {
-            ValueNode object = getObject();
-            ConstantReflectionProvider constantReflection = tool.getConstantReflection();
-            ResolvedJavaType type = constantReflection.asJavaType(javaClass.asConstant());
-            if (type != null) {
-                if (type.isPrimitive()) {
-                    return ConstantNode.forBoolean(false);
-                }
-                if (object.isConstant()) {
-                    JavaConstant c = object.asJavaConstant();
-                    return ConstantNode.forBoolean(c.isNonNull() && type.isInstance(c));
-                }
-                InstanceOfNode instanceOf = new InstanceOfNode(type, object, null);
-                return new ConditionalNode(instanceOf, ConstantNode.forBoolean(true), ConstantNode.forBoolean(false));
-            }
-        }
-        return this;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java	Thu Feb 12 16:57:30 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#isInterface()}.
  *
- * @see ClassSubstitutions#isInterface(Class)
+ * @see HotSpotClassSubstitutions#isInterface(Class)
  */
 @NodeInfo
 public final class ClassIsInterfaceNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java	Thu Feb 12 16:57:30 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#isPrimitive()}.
  *
- * @see ClassSubstitutions#isPrimitive(Class)
+ * @see HotSpotClassSubstitutions#isPrimitive(Class)
  */
 @NodeInfo
 public final class ClassIsPrimitiveNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java	Thu Feb 12 16:55:40 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +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.hotspot.replacements;
-
-import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
-import static com.oracle.graal.nodes.PiNode.*;
-
-import java.lang.reflect.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.hotspot.nodes.*;
-import com.oracle.graal.hotspot.word.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.word.*;
-
-/**
- * Substitutions for {@link java.lang.Class} methods.
- */
-@ClassSubstitution(java.lang.Class.class)
-public class ClassSubstitutions {
-
-    @MacroSubstitution(macro = ClassGetModifiersNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static int getModifiers(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        if (klass.isNull()) {
-            // Class for primitive type
-            return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC;
-        } else {
-            return klass.readInt(klassModifierFlagsOffset(), KLASS_MODIFIER_FLAGS_LOCATION);
-        }
-    }
-
-    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
-    @MacroSubstitution(macro = ClassIsInterfaceNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static boolean isInterface(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        if (klass.isNull()) {
-            return false;
-        } else {
-            int accessFlags = klass.readInt(klassAccessFlagsOffset(), KLASS_ACCESS_FLAGS_LOCATION);
-            return (accessFlags & Modifier.INTERFACE) != 0;
-        }
-    }
-
-    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
-    @MacroSubstitution(macro = ClassIsArrayNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static boolean isArray(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        if (klass.isNull()) {
-            return false;
-        } else {
-            return klassIsArray(klass);
-        }
-    }
-
-    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
-    @MacroSubstitution(macro = ClassIsPrimitiveNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static boolean isPrimitive(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        return klass.isNull();
-    }
-
-    @MacroSubstitution(macro = ClassGetClassLoader0Node.class, isStatic = false)
-    public static native ClassLoader getClassLoader0(Class<?> thisObj);
-
-    @MacroSubstitution(macro = ClassGetSuperclassNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false)
-    public static Class<?> getSuperclass(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        if (!klass.isNull()) {
-            int accessFlags = klass.readInt(klassAccessFlagsOffset(), KLASS_ACCESS_FLAGS_LOCATION);
-            if ((accessFlags & Modifier.INTERFACE) == 0) {
-                if (klassIsArray(klass)) {
-                    return Object.class;
-                } else {
-                    Word superKlass = klass.readWord(klassSuperKlassOffset(), KLASS_SUPER_KLASS_LOCATION);
-                    if (superKlass.equal(0)) {
-                        return null;
-                    } else {
-                        return readJavaMirror(superKlass);
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    public static Class<?> readJavaMirror(Word klass) {
-        return piCastExactNonNull(klass.readObject(classMirrorOffset(), CLASS_MIRROR_LOCATION), Class.class);
-    }
-
-    @MacroSubstitution(macro = ClassGetComponentTypeNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false)
-    public static Class<?> getComponentType(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        if (!klass.isNull()) {
-            if (klassIsArray(klass)) {
-                return piCastExactNonNull(klass.readObject(arrayKlassComponentMirrorOffset(), ARRAY_KLASS_COMPONENT_MIRROR), Class.class);
-            }
-        }
-        return null;
-    }
-
-    @MacroSubstitution(macro = ClassIsInstanceNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false)
-    public static boolean isInstance(Class<?> thisObj, Object obj) {
-        return ConditionalNode.materializeIsInstance(thisObj, obj);
-    }
-
-    @MacroSubstitution(macro = ClassIsAssignableFromNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false)
-    public static boolean isAssignableFrom(Class<?> thisClass, Class<?> otherClass) {
-        if (BranchProbabilityNode.probability(BranchProbabilityNode.NOT_LIKELY_PROBABILITY, otherClass == null)) {
-            DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException);
-            return false;
-        }
-        GuardingNode anchorNode = SnippetAnchorNode.anchor();
-        KlassPointer thisHub = ClassGetHubNode.readClass(thisClass, anchorNode);
-        KlassPointer otherHub = ClassGetHubNode.readClass(otherClass, anchorNode);
-        if (thisHub.isNull() || otherHub.isNull()) {
-            // primitive types, only true if equal.
-            return thisClass == otherClass;
-        }
-        if (!TypeCheckSnippetUtils.checkUnknownSubType(thisHub, otherHub)) {
-            return false;
-        }
-        return true;
-    }
-
-    @MacroSubstitution(macro = ClassCastNode.class, isStatic = false)
-    public static native Object cast(final Class<?> thisObj, Object obj);
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java	Thu Feb 12 16:57:30 2015 -0800
@@ -34,6 +34,6 @@
 
     @MethodSubstitution(isStatic = false)
     public static Class<?> getJavaMirror(@SuppressWarnings("unused") CompilerToVMImpl impl, long metaspaceklass) {
-        return ClassSubstitutions.readJavaMirror(Word.unsigned(metaspaceklass));
+        return HotSpotClassSubstitutions.readJavaMirror(Word.unsigned(metaspaceklass));
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotClassSubstitutions.java	Thu Feb 12 16:57:30 2015 -0800
@@ -0,0 +1,130 @@
+/*
+ * 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.hotspot.replacements;
+
+import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
+import static com.oracle.graal.nodes.PiNode.*;
+
+import java.lang.reflect.*;
+
+import com.oracle.graal.api.replacements.*;
+import com.oracle.graal.hotspot.nodes.*;
+import com.oracle.graal.hotspot.word.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.word.*;
+
+/**
+ * Substitutions for {@link java.lang.Class} methods.
+ */
+@ClassSubstitution(java.lang.Class.class)
+public class HotSpotClassSubstitutions {
+
+    @MacroSubstitution(macro = ClassGetModifiersNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false, forced = true)
+    public static int getModifiers(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        if (klass.isNull()) {
+            // Class for primitive type
+            return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC;
+        } else {
+            return klass.readInt(klassModifierFlagsOffset(), KLASS_MODIFIER_FLAGS_LOCATION);
+        }
+    }
+
+    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
+    @MacroSubstitution(macro = ClassIsInterfaceNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false, forced = true)
+    public static boolean isInterface(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        if (klass.isNull()) {
+            return false;
+        } else {
+            int accessFlags = klass.readInt(klassAccessFlagsOffset(), KLASS_ACCESS_FLAGS_LOCATION);
+            return (accessFlags & Modifier.INTERFACE) != 0;
+        }
+    }
+
+    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
+    @MacroSubstitution(macro = ClassIsArrayNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false, forced = true)
+    public static boolean isArray(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        if (klass.isNull()) {
+            return false;
+        } else {
+            return klassIsArray(klass);
+        }
+    }
+
+    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
+    @MacroSubstitution(macro = ClassIsPrimitiveNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false, forced = true)
+    public static boolean isPrimitive(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        return klass.isNull();
+    }
+
+    @MacroSubstitution(macro = ClassGetClassLoader0Node.class, isStatic = false)
+    public static native ClassLoader getClassLoader0(Class<?> thisObj);
+
+    @MacroSubstitution(macro = ClassGetSuperclassNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false)
+    public static Class<?> getSuperclass(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        if (!klass.isNull()) {
+            int accessFlags = klass.readInt(klassAccessFlagsOffset(), KLASS_ACCESS_FLAGS_LOCATION);
+            if ((accessFlags & Modifier.INTERFACE) == 0) {
+                if (klassIsArray(klass)) {
+                    return Object.class;
+                } else {
+                    Word superKlass = klass.readWord(klassSuperKlassOffset(), KLASS_SUPER_KLASS_LOCATION);
+                    if (superKlass.equal(0)) {
+                        return null;
+                    } else {
+                        return readJavaMirror(superKlass);
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    public static Class<?> readJavaMirror(Word klass) {
+        return piCastExactNonNull(klass.readObject(classMirrorOffset(), CLASS_MIRROR_LOCATION), Class.class);
+    }
+
+    @MacroSubstitution(macro = ClassGetComponentTypeNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false)
+    public static Class<?> getComponentType(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        if (!klass.isNull()) {
+            if (klassIsArray(klass)) {
+                return piCastExactNonNull(klass.readObject(arrayKlassComponentMirrorOffset(), ARRAY_KLASS_COMPONENT_MIRROR), Class.class);
+            }
+        }
+        return null;
+    }
+
+    @MacroSubstitution(macro = ClassCastNode.class, isStatic = false)
+    public static native Object cast(final Class<?> thisObj, Object obj);
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java	Thu Feb 12 16:57:30 2015 -0800
@@ -60,7 +60,7 @@
         replacements.registerSubstitutions(System.class, SystemSubstitutions.class);
         replacements.registerSubstitutions(Thread.class, ThreadSubstitutions.class);
         replacements.registerSubstitutions(Unsafe.class, UnsafeSubstitutions.class);
-        replacements.registerSubstitutions(Class.class, ClassSubstitutions.class);
+        replacements.registerSubstitutions(Class.class, HotSpotClassSubstitutions.class);
         replacements.registerSubstitutions(CRC32.class, CRC32Substitutions.class);
         replacements.registerSubstitutions(Reflection.class, ReflectionSubstitutions.class);
         replacements.registerSubstitutions(NodeClass.class, HotSpotNodeClassSubstitutions.class);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java	Thu Feb 12 16:57:30 2015 -0800
@@ -32,6 +32,7 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.ProfilingInfo.TriState;
+import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
@@ -194,6 +195,25 @@
         return trueValue;
     }
 
+    @Snippet
+    public static Object isAssignableFrom(Class<?> thisClass, Class<?> otherClass, Object trueValue, Object falseValue) {
+        if (BranchProbabilityNode.probability(BranchProbabilityNode.NOT_FREQUENT_PROBABILITY, otherClass == null)) {
+            DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException);
+            return false;
+        }
+        GuardingNode anchorNode = SnippetAnchorNode.anchor();
+        KlassPointer thisHub = ClassGetHubNode.readClass(thisClass, anchorNode);
+        KlassPointer otherHub = ClassGetHubNode.readClass(otherClass, anchorNode);
+        if (thisHub.isNull() || otherHub.isNull()) {
+            // primitive types, only true if equal.
+            return thisClass == otherClass ? trueValue : falseValue;
+        }
+        if (!TypeCheckSnippetUtils.checkUnknownSubType(thisHub, otherHub)) {
+            return falseValue;
+        }
+        return trueValue;
+    }
+
     static class Options {
 
         // @formatter:off
@@ -214,6 +234,7 @@
         private final SnippetInfo instanceofPrimary = snippet(InstanceOfSnippets.class, "instanceofPrimary");
         private final SnippetInfo instanceofSecondary = snippet(InstanceOfSnippets.class, "instanceofSecondary");
         private final SnippetInfo instanceofDynamic = snippet(InstanceOfSnippets.class, "instanceofDynamic");
+        private final SnippetInfo isAssignableFrom = snippet(InstanceOfSnippets.class, "isAssignableFrom");
         private final long compilationThreshold;
 
         public Templates(HotSpotProviders providers, TargetDescription target, long compilationThreshold) {
@@ -264,8 +285,7 @@
                 }
                 return args;
 
-            } else {
-                assert replacer.instanceOf instanceof InstanceOfDynamicNode;
+            } else if (replacer.instanceOf instanceof InstanceOfDynamicNode) {
                 InstanceOfDynamicNode instanceOf = (InstanceOfDynamicNode) replacer.instanceOf;
                 ValueNode object = instanceOf.object();
 
@@ -275,6 +295,16 @@
                 args.add("trueValue", replacer.trueValue);
                 args.add("falseValue", replacer.falseValue);
                 return args;
+            } else if (replacer.instanceOf instanceof ClassIsAssignableFromNode) {
+                ClassIsAssignableFromNode isAssignable = (ClassIsAssignableFromNode) replacer.instanceOf;
+                Arguments args = new Arguments(isAssignableFrom, isAssignable.graph().getGuardsStage(), tool.getLoweringStage());
+                args.add("thisClass", isAssignable.getThisClass());
+                args.add("otherClass", isAssignable.getOtherClass());
+                args.add("trueValue", replacer.trueValue);
+                args.add("falseValue", replacer.falseValue);
+                return args;
+            } else {
+                throw GraalInternalError.shouldNotReachHere();
             }
         }
     }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java	Thu Feb 12 16:57:30 2015 -0800
@@ -842,9 +842,9 @@
 
         Map<Integer, SuccessorInfo> bciToBlockSuccessorIndex = new HashMap<>();
         for (int i = 0; i < currentBlock.getSuccessorCount(); i++) {
-            assert !bciToBlockSuccessorIndex.containsKey(currentBlock.getSuccessors().get(i).startBci);
-            if (!bciToBlockSuccessorIndex.containsKey(currentBlock.getSuccessors().get(i).startBci)) {
-                bciToBlockSuccessorIndex.put(currentBlock.getSuccessors().get(i).startBci, new SuccessorInfo(i));
+            assert !bciToBlockSuccessorIndex.containsKey(currentBlock.getSuccessor(i).startBci);
+            if (!bciToBlockSuccessorIndex.containsKey(currentBlock.getSuccessor(i).startBci)) {
+                bciToBlockSuccessorIndex.put(currentBlock.getSuccessor(i).startBci, new SuccessorInfo(i));
             }
         }
 
@@ -869,7 +869,7 @@
                 SuccessorInfo info = bciToBlockSuccessorIndex.get(targetBci);
                 if (info.actualIndex < 0) {
                     info.actualIndex = nextSuccessorIndex++;
-                    actualSuccessors.add(currentBlock.getSuccessors().get(info.blockIndex));
+                    actualSuccessors.add(currentBlock.getSuccessor(info.blockIndex));
                 }
                 keySuccessors[i] = info.actualIndex;
             }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Thu Feb 12 16:57:30 2015 -0800
@@ -31,7 +31,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.bytecode.*;
 import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.nodes.*;
@@ -75,20 +74,16 @@
  */
 public final class BciBlockMapping {
 
-    public static class BciBlock extends AbstractBlockBase<BciBlock> implements Cloneable {
+    public static class BciBlock implements Cloneable {
 
+        protected int id;
         public int startBci;
         public int endBci;
         public boolean isExceptionEntry;
         public boolean isLoopHeader;
         public int loopId;
         public int loopEnd;
-
-        /**
-         * XXX to be removed - currently only used by baseline compiler.
-         */
-        public Loop<BciBlock> loop;
-        public boolean isLoopEnd;
+        protected List<BciBlock> successors;
 
         private FixedWithNextNode firstInstruction;
         private AbstractFrameStateBuilder<?, ?> entryState;
@@ -128,6 +123,10 @@
             return null;
         }
 
+        public int getId() {
+            return id;
+        }
+
         public int numNormalSuccessors() {
             if (exceptionDispatchBlock() != null) {
                 return successors.size() - 1;
@@ -165,14 +164,6 @@
             return sb.toString();
         }
 
-        public Loop<BciBlock> getLoop() {
-            return loop;
-        }
-
-        public void setLoop(Loop<BciBlock> loop) {
-            this.loop = loop;
-        }
-
         public int getLoopDepth() {
             return Long.bitCount(loops);
         }
@@ -181,10 +172,6 @@
             return isLoopHeader;
         }
 
-        public boolean isLoopEnd() {
-            return isLoopEnd;
-        }
-
         public boolean isExceptionEntry() {
             return isExceptionEntry;
         }
@@ -392,6 +379,18 @@
                 entryStateArray[dimension - 1] = entryState;
             }
         }
+
+        public int getSuccessorCount() {
+            return successors.size();
+        }
+
+        public List<BciBlock> getSuccessors() {
+            return successors;
+        }
+
+        public void setId(int i) {
+            this.id = i;
+        }
     }
 
     public static class ExceptionDispatchBlock extends BciBlock {
@@ -976,7 +975,6 @@
             loops |= computeBlockOrder(successor);
             if (successor.active) {
                 // Reached block via backward branch.
-                block.isLoopEnd = true;
                 loops |= (1L << successor.loopId);
             }
         }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Thu Feb 12 16:57:30 2015 -0800
@@ -665,7 +665,7 @@
 
             @Override
             protected ValueNode createCheckCast(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck, boolean forStoreCheck) {
-                return CheckCastNode.create(type, object, profileForTypeCheck, forStoreCheck);
+                return CheckCastNode.create(type, object, profileForTypeCheck, forStoreCheck, currentGraph.getAssumptions());
             }
 
             @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java	Thu Feb 12 16:57:30 2015 -0800
@@ -60,6 +60,18 @@
         this.falseValue = falseValue;
     }
 
+    public static ValueNode create(LogicNode condition) {
+        return create(condition, ConstantNode.forInt(1, condition.graph()), ConstantNode.forInt(0, condition.graph()));
+    }
+
+    public static ValueNode create(LogicNode condition, ValueNode trueValue, ValueNode falseValue) {
+        ValueNode synonym = findSynonym(condition, trueValue, falseValue);
+        if (synonym != null) {
+            return synonym;
+        }
+        return new ConditionalNode(condition, trueValue, falseValue);
+    }
+
     @Override
     public boolean inferStamp() {
         return updateStamp(trueValue.stamp().meet(falseValue.stamp()));
@@ -75,9 +87,9 @@
 
     @Override
     public ValueNode canonical(CanonicalizerTool tool) {
-        if (condition instanceof LogicNegationNode) {
-            LogicNegationNode negated = (LogicNegationNode) condition;
-            return new ConditionalNode(negated.getValue(), falseValue(), trueValue());
+        ValueNode synonym = findSynonym(condition, trueValue(), falseValue());
+        if (synonym != null) {
+            return synonym;
         }
 
         // this optimizes the case where a value that can only be 0 or 1 is materialized to 0 or 1
@@ -92,14 +104,6 @@
                 }
             }
         }
-        if (condition instanceof LogicConstantNode) {
-            LogicConstantNode c = (LogicConstantNode) condition;
-            if (c.getValue()) {
-                return trueValue();
-            } else {
-                return falseValue();
-            }
-        }
         if (condition instanceof CompareNode && ((CompareNode) condition).condition() == Condition.EQ) {
             // optimize the pattern (x == y) ? x : y
             CompareNode compare = (CompareNode) condition;
@@ -114,6 +118,22 @@
         return this;
     }
 
+    private static ValueNode findSynonym(ValueNode condition, ValueNode trueValue, ValueNode falseValue) {
+        if (condition instanceof LogicNegationNode) {
+            LogicNegationNode negated = (LogicNegationNode) condition;
+            return ConditionalNode.create(negated.getValue(), falseValue, trueValue);
+        }
+        if (condition instanceof LogicConstantNode) {
+            LogicConstantNode c = (LogicConstantNode) condition;
+            if (c.getValue()) {
+                return trueValue;
+            } else {
+                return falseValue;
+            }
+        }
+        return null;
+    }
+
     @Override
     public void generate(NodeLIRBuilderTool generator) {
         generator.emitConditional(this);
@@ -137,4 +157,24 @@
     public static boolean materializeIsInstance(Class<?> mirror, Object object) {
         return mirror.isInstance(object);
     }
+
+    /**
+     * @param thisClass
+     * @param otherClass
+     * @param dummy a marker to make this constructor unique for the
+     *            {@link #materializeIsAssignableFrom(Class, Class, int)} NodeIntrinsic
+     */
+    public ConditionalNode(ValueNode thisClass, ValueNode otherClass, int dummy) {
+        this(thisClass.graph().unique(new ClassIsAssignableFromNode(thisClass, otherClass)));
+    }
+
+    @SuppressWarnings("unused")
+    @NodeIntrinsic
+    private static boolean materializeIsAssignableFrom(Class<?> thisClass, Class<?> otherClass, @ConstantNodeParameter int dummy) {
+        return thisClass.isAssignableFrom(otherClass);
+    }
+
+    public static boolean materializeIsAssignableFrom(Class<?> thisClass, Class<?> otherClass) {
+        return materializeIsAssignableFrom(thisClass, otherClass, 0);
+    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Thu Feb 12 16:57:30 2015 -0800
@@ -118,42 +118,39 @@
         return loops;
     }
 
-    public void clearNodeToBlock() {
-        nodeToBlock.clear();
-        for (Block block : reversePostOrder) {
-            identifyBlock(block);
-        }
-    }
-
     private void identifyBlock(Block block) {
-        Node cur = block.getBeginNode();
-        Node last;
+        AbstractBeginNode start = block.getBeginNode();
 
         // assign proxies of a loop exit to this block
-        if (cur instanceof AbstractBeginNode) {
-            for (Node usage : cur.usages()) {
+        if (start instanceof LoopExitNode) {
+            for (Node usage : start.usages()) {
                 if (usage instanceof ProxyNode) {
                     nodeToBlock.set(usage, block);
                 }
             }
+        } else if (start instanceof AbstractMergeNode) {
+            for (PhiNode phi : ((AbstractMergeNode) start).phis()) {
+                nodeToBlock.set(phi, block);
+            }
         }
 
-        do {
+        FixedWithNextNode cur = start;
+        while (true) {
             assert !cur.isDeleted();
-
             assert nodeToBlock.get(cur) == null;
             nodeToBlock.set(cur, block);
-            if (cur instanceof AbstractMergeNode) {
-                for (PhiNode phi : ((AbstractMergeNode) cur).phis()) {
-                    nodeToBlock.set(phi, block);
-                }
+            FixedNode next = cur.next();
+            if (next instanceof AbstractBeginNode) {
+                block.endNode = cur;
+                return;
+            } else if (next instanceof FixedWithNextNode) {
+                cur = (FixedWithNextNode) next;
+            } else {
+                nodeToBlock.set(next, block);
+                block.endNode = next;
+                return;
             }
-
-            last = cur;
-            cur = cur.successors().first();
-        } while (cur != null && !(cur instanceof AbstractBeginNode));
-
-        block.endNode = (FixedNode) last;
+        }
     }
 
     private void identifyBlocks() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Thu Feb 12 16:57:30 2015 -0800
@@ -63,11 +63,19 @@
         this.forStoreCheck = forStoreCheck;
     }
 
-    public static ValueNode create(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile, boolean forStoreCheck) {
+    public static ValueNode create(ResolvedJavaType inputType, ValueNode object, JavaTypeProfile profile, boolean forStoreCheck, Assumptions assumptions) {
+        ResolvedJavaType type = inputType;
         ValueNode synonym = findSynonym(type, object);
         if (synonym != null) {
             return synonym;
         }
+        if (assumptions != null) {
+            ResolvedJavaType uniqueConcreteType = type.findUniqueConcreteSubtype();
+            if (uniqueConcreteType != null && !uniqueConcreteType.equals(type)) {
+                assumptions.recordConcreteSubtype(type, uniqueConcreteType);
+                type = uniqueConcreteType;
+            }
+        }
         return new CheckCastNode(type, object, profile, forStoreCheck);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ClassIsAssignableFromNode.java	Thu Feb 12 16:57:30 2015 -0800
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.nodes.java;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.graph.spi.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.*;
+
+/**
+ * The {@code ClassIsAssignableFromNode} represents a type check against {@link Class} instead of
+ * against instances. This is used, for instance, to intrinsify
+ * {@link Class#isAssignableFrom(Class)} .
+ */
+@NodeInfo
+public final class ClassIsAssignableFromNode extends LogicNode implements Canonicalizable.Binary<ValueNode>, Lowerable {
+    @Input ValueNode thisClass;
+    @Input ValueNode otherClass;
+
+    public ClassIsAssignableFromNode(ValueNode thisClass, ValueNode otherClass) {
+        this.thisClass = thisClass;
+        this.otherClass = otherClass;
+    }
+
+    public Object getThisClass() {
+        return thisClass;
+    }
+
+    public Object getOtherClass() {
+        return otherClass;
+    }
+
+    @Override
+    public ValueNode getX() {
+        return thisClass;
+    }
+
+    @Override
+    public ValueNode getY() {
+        return otherClass;
+    }
+
+    @Override
+    public Node canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
+        if (forX.isConstant() && forY.isConstant()) {
+            ConstantReflectionProvider constantReflection = tool.getConstantReflection();
+            ResolvedJavaType thisType = constantReflection.asJavaType(forX.asJavaConstant());
+            ResolvedJavaType otherType = constantReflection.asJavaType(forY.asJavaConstant());
+            if (thisType != null && otherType != null) {
+                return LogicConstantNode.forBoolean(thisType.isAssignableFrom(otherType));
+            }
+        }
+        return this;
+    }
+
+    @Override
+    public void lower(LoweringTool tool) {
+        tool.getLowerer().lower(this, tool);
+    }
+
+}
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Thu Feb 12 16:57:30 2015 -0800
@@ -33,7 +33,6 @@
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.extended.*;
@@ -306,6 +305,7 @@
     private BlockMap<List<ValueNode>> blockToNodesMap;
     private BlockMap<LocationSet> blockToKillSet;
     private final SchedulingStrategy selectedStrategy;
+    private boolean scheduleConstants;
 
     public SchedulePhase() {
         this(OptScheduleOutOfLoops.getValue() ? SchedulingStrategy.LATEST_OUT_OF_LOOPS : SchedulingStrategy.LATEST);
@@ -315,6 +315,10 @@
         this.selectedStrategy = strategy;
     }
 
+    public void setScheduleConstants(boolean value) {
+        scheduleConstants = value;
+    }
+
     @Override
     protected void run(StructuredGraph graph) {
         assert GraphOrder.assertNonCyclicGraph(graph);
@@ -450,6 +454,12 @@
         if (cfg.getNodeToBlock().containsKey(node)) {
             return;
         }
+        if (!scheduleConstants && node instanceof ConstantNode) {
+            return;
+        }
+        if (node instanceof VirtualObjectNode) {
+            return;
+        }
         // PhiNodes, ProxyNodes and FixedNodes should already have been placed in blocks by
         // ControlFlowGraph.identifyBlocks
         if (node instanceof PhiNode || node instanceof ProxyNode || node instanceof FixedNode) {
@@ -473,7 +483,7 @@
                     assert dominates(earliestBlock, block) : String.format("%s (%s) cannot be scheduled before earliest schedule (%s). location: %s", read, block, earliestBlock,
                                     read.getLocationIdentity());
                 } else {
-                    block = latestBlock(node, strategy);
+                    block = latestBlock(node, strategy, earliestBlock);
                 }
                 if (block == null) {
                     // handle nodes without usages
@@ -484,16 +494,7 @@
                     block = scheduleOutOfLoops(node, block, earliestBlock);
                 }
 
-                if (assertionEnabled()) {
-                    if (scheduleRead) {
-                        FloatingReadNode read = (FloatingReadNode) node;
-                        MemoryNode lastLocationAccess = read.getLastLocationAccess();
-                        Block upperBound = blockForMemoryNode(lastLocationAccess);
-                        assert dominates(upperBound, block) : String.format(
-                                        "out of loop movement voilated memory semantics for %s (location %s). moved to %s but upper bound is %s (earliest: %s, latest: %s)", read,
-                                        read.getLocationIdentity(), block, upperBound, earliestBlock, latest);
-                    }
-                }
+                assert assertReadSchedule(node, earliestBlock, block, latest, scheduleRead);
                 break;
             default:
                 throw new GraalInternalError("unknown scheduling strategy");
@@ -505,11 +506,15 @@
         blockToNodesMap.get(block).add(node);
     }
 
-    @SuppressWarnings("all")
-    private static boolean assertionEnabled() {
-        boolean enabled = false;
-        assert enabled = true;
-        return enabled;
+    private boolean assertReadSchedule(ValueNode node, Block earliestBlock, Block block, Block latest, boolean scheduleRead) {
+        if (scheduleRead) {
+            FloatingReadNode read = (FloatingReadNode) node;
+            MemoryNode lastLocationAccess = read.getLastLocationAccess();
+            Block upperBound = blockForMemoryNode(lastLocationAccess);
+            assert dominates(upperBound, block) : String.format("out of loop movement voilated memory semantics for %s (location %s). moved to %s but upper bound is %s (earliest: %s, latest: %s)",
+                            read, read.getLocationIdentity(), block, upperBound, earliestBlock, latest);
+        }
+        return true;
     }
 
     /**
@@ -540,7 +545,7 @@
         Block earliestBlock = earliestBlock(n);
         assert dominates(upperBoundBlock, earliestBlock) : "upper bound (" + upperBoundBlock + ") should dominate earliest (" + earliestBlock + ")";
 
-        Block latestBlock = latestBlock(n, strategy);
+        Block latestBlock = latestBlock(n, strategy, earliestBlock);
         assert latestBlock != null && dominates(earliestBlock, latestBlock) : "earliest (" + earliestBlock + ") should dominate latest block (" + latestBlock + ")";
 
         Debug.log("processing %s (accessing %s): latest %s, earliest %s, upper bound %s (%s)", n, locid, latestBlock, earliestBlock, upperBoundBlock, n.getLastLocationAccess());
@@ -613,26 +618,27 @@
      * dominator of all usages. To do so all usages are also assigned to blocks.
      *
      * @param strategy
+     * @param earliestBlock
      */
-    private Block latestBlock(ValueNode node, SchedulingStrategy strategy) {
+    private Block latestBlock(ValueNode node, SchedulingStrategy strategy, Block earliestBlock) {
         CommonDominatorBlockClosure cdbc = new CommonDominatorBlockClosure(null);
-        for (Node succ : node.successors().nonNull()) {
-            if (cfg.getNodeToBlock().get(succ) == null) {
-                throw new SchedulingError();
-            }
-            cdbc.apply(cfg.getNodeToBlock().get(succ));
-        }
         ensureScheduledUsages(node, strategy);
         for (Node usage : node.usages()) {
             blocksForUsage(node, usage, cdbc, strategy);
+            if (cdbc.block == earliestBlock) {
+                break;
+            }
         }
 
-        if (assertionEnabled()) {
-            if (cdbc.block != null && !dominates(earliestBlock(node), cdbc.block)) {
-                throw new SchedulingError("failed to find correct latest schedule for %s. cdbc: %s, earliest: %s", node, cdbc.block, earliestBlock(node));
-            }
+        assert assertLatestBlockResult(node, cdbc);
+        return cdbc.block;
+    }
+
+    private boolean assertLatestBlockResult(ValueNode node, CommonDominatorBlockClosure cdbc) throws SchedulingError {
+        if (cdbc.block != null && !dominates(earliestBlock(node), cdbc.block)) {
+            throw new SchedulingError("failed to find correct latest schedule for %s. cdbc: %s, earliest: %s", node, cdbc.block, earliestBlock(node));
         }
-        return cdbc.block;
+        return true;
     }
 
     /**
@@ -744,10 +750,8 @@
      * @param usage the usage whose blocks need to be considered
      * @param closure the closure that will be called for each block
      */
-    private void blocksForUsage(ValueNode node, Node usage, BlockClosure closure, SchedulingStrategy strategy) {
-        if (node instanceof PhiNode) {
-            throw new SchedulingError(node.toString());
-        }
+    private void blocksForUsage(ValueNode node, Node usage, CommonDominatorBlockClosure closure, SchedulingStrategy strategy) {
+        assert !(node instanceof PhiNode);
 
         if (usage instanceof PhiNode) {
             // An input to a PhiNode is used at the end of the predecessor block that corresponds to
@@ -757,19 +761,8 @@
             PhiNode phi = (PhiNode) usage;
             AbstractMergeNode merge = phi.merge();
             Block mergeBlock = cfg.getNodeToBlock().get(merge);
-            if (mergeBlock == null) {
-                throw new SchedulingError("no block for merge %s", merge.toString(Verbosity.Id));
-            }
             for (int i = 0; i < phi.valueCount(); ++i) {
                 if (phi.valueAt(i) == node) {
-                    if (mergeBlock.getPredecessorCount() <= i) {
-                        TTY.println(merge.toString());
-                        TTY.println(phi.toString());
-                        TTY.println(merge.cfgPredecessors().toString());
-                        TTY.println(mergeBlock.getPredecessors().toString());
-                        TTY.println(phi.inputs().toString());
-                        TTY.println("value count: " + phi.valueCount());
-                    }
                     closure.apply(mergeBlock.getPredecessors().get(i));
                 }
             }
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java	Thu Feb 12 16:57:30 2015 -0800
@@ -177,4 +177,25 @@
     public static double longBitsToDouble(long value) {
         return Double.longBitsToDouble(value);
     }
+
+    @SuppressWarnings("all")
+    public static boolean isInstance(Class<?> clazz) {
+        return clazz.isInstance(Number.class);
+    }
+
+    @SuppressWarnings("all")
+    public static boolean isAssignableFrom(Class<?> clazz) {
+        return clazz.isInstance(Number.class);
+    }
+
+    @Test
+    public void testClassSubstitutions() {
+        test("isInstance");
+        for (Class<?> c : new Class[]{getClass(), Cloneable.class, int[].class, String[][].class}) {
+            for (Object o : new Object[]{this, new int[5], new String[2][], new Object()}) {
+                assertDeepEquals(c.isInstance(o), ClassSubstitutions.isInstance(c, o));
+                assertDeepEquals(c.isAssignableFrom(o.getClass()), ClassSubstitutions.isAssignableFrom(c, o.getClass()));
+            }
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ClassSubstitutions.java	Thu Feb 12 16:57:30 2015 -0800
@@ -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.graal.replacements;
+
+import com.oracle.graal.api.replacements.*;
+import com.oracle.graal.nodes.calc.*;
+
+/**
+ * Substitutions for {@link java.lang.Class} methods.
+ */
+@ClassSubstitution(java.lang.Class.class)
+public class ClassSubstitutions {
+
+    @MethodSubstitution(isStatic = false)
+    public static boolean isInstance(Class<?> thisObj, Object obj) {
+        return ConditionalNode.materializeIsInstance(thisObj, obj);
+    }
+
+    @MethodSubstitution(isStatic = false)
+    public static boolean isAssignableFrom(Class<?> thisClass, Class<?> otherClass) {
+        return ConditionalNode.materializeIsAssignableFrom(thisClass, otherClass);
+    }
+}
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java	Thu Feb 12 16:57:30 2015 -0800
@@ -62,6 +62,7 @@
             replacements.registerSubstitutions(Short.class, ShortSubstitutions.class);
             replacements.registerSubstitutions(UnsignedMath.class, UnsignedMathSubstitutions.class);
             replacements.registerSubstitutions(Edges.class, EdgesSubstitutions.class);
+            replacements.registerSubstitutions(Class.class, ClassSubstitutions.class);
         }
         if (Options.UseBlackholeSubstitution.getValue()) {
             replacements.registerSubstitutions(new Type() {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java	Thu Feb 12 16:57:30 2015 -0800
@@ -65,7 +65,7 @@
     protected abstract Arguments makeArguments(InstanceOfUsageReplacer replacer, LoweringTool tool);
 
     public void lower(FloatingNode instanceOf, LoweringTool tool) {
-        assert instanceOf instanceof InstanceOfNode || instanceOf instanceof InstanceOfDynamicNode;
+        assert instanceOf instanceof InstanceOfNode || instanceOf instanceof InstanceOfDynamicNode || instanceOf instanceof ClassIsAssignableFromNode;
         List<Node> usages = instanceOf.usages().snapshot();
 
         Instantiation instantiation = new Instantiation();
@@ -176,7 +176,7 @@
         public final ValueNode falseValue;
 
         public InstanceOfUsageReplacer(Instantiation instantiation, FloatingNode instanceOf, ValueNode trueValue, ValueNode falseValue) {
-            assert instanceOf instanceof InstanceOfNode || instanceOf instanceof InstanceOfDynamicNode;
+            assert instanceOf instanceof InstanceOfNode || instanceOf instanceof InstanceOfDynamicNode || instanceOf instanceof ClassIsAssignableFromNode;
             this.instantiation = instantiation;
             this.instanceOf = instanceOf;
             this.trueValue = trueValue;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Thu Feb 12 16:57:30 2015 -0800
@@ -162,7 +162,6 @@
         });
         r.register4("unsafeCast", Object.class, Class.class, boolean.class, boolean.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext builder, ValueNode object, ValueNode clazz, ValueNode condition, ValueNode nonNull) {
-                System.out.println("unsafe cast with cond: " + condition + " clazz: " + clazz + " nonNull: " + nonNull);
                 if (clazz.isConstant() && nonNull.isConstant()) {
                     ConstantReflectionProvider constantReflection = builder.getConstantReflection();
                     ResolvedJavaType javaType = constantReflection.asJavaType(clazz.asConstant());
--- a/graal/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/DynamicObject.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/DynamicObject.java	Thu Feb 12 16:57:30 2015 -0800
@@ -27,11 +27,11 @@
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.interop.*;
 
-public interface DynamicObject extends TypedObject, TruffleObject {
+public abstract class DynamicObject implements TypedObject, TruffleObject {
     /**
      * Get the object's current shape.
      */
-    Shape getShape();
+    public abstract Shape getShape();
 
     /**
      * Get property value.
@@ -40,7 +40,7 @@
      * @param defaultValue return value if property is not found
      * @return property value or defaultValue if object has no such property
      */
-    Object get(Object key, Object defaultValue);
+    public abstract Object get(Object key, Object defaultValue);
 
     /**
      * Set value of existing property.
@@ -49,7 +49,7 @@
      * @param value value to be set
      * @return {@code true} if successful or {@code false} if property not found
      */
-    boolean set(Object key, Object value);
+    public abstract boolean set(Object key, Object value);
 
     /**
      * Define new property or redefine existing property.
@@ -58,7 +58,7 @@
      * @param value value to be set
      * @param flags flags to be set
      */
-    void define(Object key, Object value, int flags);
+    public abstract void define(Object key, Object value, int flags);
 
     /**
      * Define new property with a static location or change existing property.
@@ -68,7 +68,7 @@
      * @param flags flags to be set
      * @param locationFactory factory function that creates a location for a given shape and value
      */
-    void define(Object key, Object value, int flags, LocationFactory locationFactory);
+    public abstract void define(Object key, Object value, int flags, LocationFactory locationFactory);
 
     /**
      * Change property flags.
@@ -77,7 +77,7 @@
      * @param newFlags flags to be set
      * @return {@code true} if successful or {@code false} if property not found
      */
-    boolean changeFlags(Object key, int newFlags);
+    public abstract boolean changeFlags(Object key, int newFlags);
 
     /**
      * Change property flags.
@@ -86,7 +86,7 @@
      * @param flagsUpdateFunction function updating old flags to new flags
      * @return {@code true} if successful or {@code false} if property not found
      */
-    boolean changeFlags(Object key, FlagsFunction flagsUpdateFunction);
+    public abstract boolean changeFlags(Object key, FlagsFunction flagsUpdateFunction);
 
     /**
      * Delete property.
@@ -94,17 +94,17 @@
      * @param key property identifier
      * @return {@code true} if successful or {@code false} if property not found
      */
-    boolean delete(Object key);
+    public abstract boolean delete(Object key);
 
     /**
      * Returns the number of properties in this object.
      */
-    int size();
+    public abstract int size();
 
     /**
      * Returns {@code true} if this object contains no properties.
      */
-    boolean isEmpty();
+    public abstract boolean isEmpty();
 
     /**
      * Set object shape and grow storage if necessary.
@@ -112,7 +112,7 @@
      * @param oldShape the object's current shape (must equal {@link #getShape()})
      * @param newShape the new shape to be set
      */
-    void setShapeAndGrow(Shape oldShape, Shape newShape);
+    public abstract void setShapeAndGrow(Shape oldShape, Shape newShape);
 
     /**
      * Set object shape and resize storage if necessary.
@@ -120,14 +120,14 @@
      * @param oldShape the object's current shape (must equal {@link #getShape()})
      * @param newShape the new shape to be set
      */
-    void setShapeAndResize(Shape oldShape, Shape newShape);
+    public abstract void setShapeAndResize(Shape oldShape, Shape newShape);
 
     /**
      * Ensure object shape is up-to-date.
      *
      * @return {@code true} if shape has changed
      */
-    boolean updateShape();
+    public abstract boolean updateShape();
 
     public interface FlagsFunction {
         int apply(int t);
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectImpl.java	Thu Feb 12 16:55:40 2015 -0800
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectImpl.java	Thu Feb 12 16:57:30 2015 -0800
@@ -30,7 +30,7 @@
 import com.oracle.truffle.object.Locations.ValueLocation;
 import com.oracle.truffle.object.debug.*;
 
-public abstract class DynamicObjectImpl implements DynamicObject, Cloneable {
+public abstract class DynamicObjectImpl extends DynamicObject implements Cloneable {
     private ShapeImpl shape;
 
     public static final DebugCounter reshapeCount = DebugCounter.create("Reshape count");
@@ -49,6 +49,7 @@
         return getShape();
     }
 
+    @Override
     public ShapeImpl getShape() {
         return shape;
     }
@@ -64,6 +65,7 @@
         setShapeAndResize(getShape(), newShape);
     }
 
+    @Override
     public final void setShapeAndResize(Shape oldShape, Shape newShape) {
         assert getShape() == oldShape : "wrong old shape";
         if (oldShape != newShape) {
@@ -81,6 +83,7 @@
      *
      * @see #setShapeAndResize(Shape, Shape)
      */
+    @Override
     public final void setShapeAndGrow(Shape oldShape, Shape newShape) {
         assert getShape() == oldShape : "wrong old shape";
         if (oldShape != newShape) {
@@ -183,6 +186,7 @@
         }
     }
 
+    @Override
     @TruffleBoundary
     public boolean changeFlags(Object id, int newFlags) {
         Shape oldShape = getShape();
@@ -199,6 +203,7 @@
         }
     }
 
+    @Override
     @TruffleBoundary
     public boolean changeFlags(Object id, FlagsFunction updateFunction) {
         Shape oldShape = getShape();
@@ -271,6 +276,7 @@
         return getShape().getObjectType().hashCode(this);
     }
 
+    @Override
     @TruffleBoundary
     public Object get(Object id, Object defaultValue) {
         Property existing = getShape().getProperty(id);
@@ -281,6 +287,7 @@
         }
     }
 
+    @Override
     @TruffleBoundary
     public boolean set(Object id, Object value) {
         Property existing = getShape().getProperty(id);
@@ -292,6 +299,7 @@
         }
     }
 
+    @Override
     @TruffleBoundary
     public void define(Object id, Object value, int flags) {
         ShapeImpl oldShape = getShape();
@@ -318,6 +326,7 @@
         }
     }
 
+    @Override
     @TruffleBoundary
     public void define(Object id, Object value, int flags, LocationFactory locationFactory) {
         ShapeImpl oldShape = getShape();
@@ -333,6 +342,7 @@
         }
     }
 
+    @Override
     @TruffleBoundary
     public boolean delete(Object id) {
         ShapeImpl oldShape = getShape();
@@ -347,14 +357,17 @@
         }
     }
 
+    @Override
     public int size() {
         return getShape().getPropertyCount();
     }
 
+    @Override
     public boolean isEmpty() {
         return size() == 0;
     }
 
+    @Override
     public final boolean updateShape() {
         return getShape().getLayout().getStrategy().updateShape(this);
     }
--- a/mx/mx_graal.py	Thu Feb 12 16:55:40 2015 -0800
+++ b/mx/mx_graal.py	Thu Feb 12 16:57:30 2015 -0800
@@ -1490,11 +1490,6 @@
         with Task('UnitTests:hosted-product', tasks):
             unittest(['--enable-timing', '--verbose', '--fail-fast'])
 
-    # Run baseline unit tests on server-hosted-graal
-    with VM('server', 'product'):
-        with Task('UnitTests-BaselineCompiler:hosted-product', tasks):
-            unittest(['--enable-timing', '--verbose', '--whitelist', 'test/whitelist_baseline.txt', '-G:+UseBaselineCompiler'])
-
     # Build the other VM flavors
     with Task('BuildHotSpotGraalOthers: fastdebug,product', tasks):
         buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product'])
--- a/mx/suite.py	Thu Feb 12 16:55:40 2015 -0800
+++ b/mx/suite.py	Thu Feb 12 16:57:30 2015 -0800
@@ -343,7 +343,6 @@
         "com.oracle.graal.replacements",
         "com.oracle.graal.runtime",
         "com.oracle.graal.printer",
-        "com.oracle.graal.baseline",
         "com.oracle.graal.hotspotvmconfig",
         "com.oracle.nfi",
       ],
@@ -824,18 +823,6 @@
       "workingSets" : "Graal,Java",
     },
 
-    "com.oracle.graal.baseline" : {
-      "subDir" : "graal",
-      "sourceDirs" : ["src"],
-      "dependencies" : [
-        "com.oracle.graal.compiler",
-        "com.oracle.graal.java",
-      ],
-      "checkstyle" : "com.oracle.graal.graph",
-      "javaCompliance" : "1.8",
-      "workingSets" : "Graal,Java",
-    },
-
     "com.oracle.graal.printer" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
@@ -867,7 +854,6 @@
         "com.oracle.graal.test",
         "com.oracle.graal.printer",
         "com.oracle.graal.runtime",
-        "com.oracle.graal.baseline",
         "JAVA_ALLOCATION_INSTRUMENTER",
       ],
       "checkstyle" : "com.oracle.graal.graph",
--- a/test/whitelist_baseline.txt	Thu Feb 12 16:55:40 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-com.oracle.graal.jtt.loop.Loop03
-com.oracle.graal.jtt.loop.Loop04
-com.oracle.graal.jtt.loop.Loop08
-com.oracle.graal.jtt.loop.Loop11
-com.oracle.graal.jtt.bytecode.BC_iadd
-com.oracle.graal.jtt.bytecode.BC_iadd2
-com.oracle.graal.jtt.bytecode.BC_iadd3
-com.oracle.graal.jtt.bytecode.BC_ifeq_2
-com.oracle.graal.jtt.bytecode.BC_ifeq_3
-com.oracle.graal.jtt.bytecode.BC_ifeq
-com.oracle.graal.jtt.bytecode.BC_aload_3
-com.oracle.graal.jtt.bytecode.BC_aload_2
-com.oracle.graal.jtt.bytecode.BC_aload_1
-com.oracle.graal.jtt.bytecode.BC_aload_0
-com.oracle.graal.jtt.bytecode.BC_areturn
-com.oracle.graal.jtt.bytecode.BC_freturn
-com.oracle.graal.jtt.bytecode.BC_iconst
-com.oracle.graal.jtt.bytecode.BC_ireturn
-com.oracle.graal.jtt.bytecode.BC_lreturn
-com.oracle.graal.jtt.bytecode.BC_getstatic_b
-com.oracle.graal.jtt.bytecode.BC_getstatic_c
-com.oracle.graal.jtt.bytecode.BC_getstatic_d
-com.oracle.graal.jtt.bytecode.BC_getstatic_f
-com.oracle.graal.jtt.bytecode.BC_getstatic_i
-com.oracle.graal.jtt.bytecode.BC_getstatic_l
-com.oracle.graal.jtt.bytecode.BC_getstatic_s
-com.oracle.graal.jtt.bytecode.BC_getstatic_z
-com.oracle.graal.jtt.bytecode.BC_arraylength