# HG changeset patch # User Josef Eisl # Date 1398190598 -7200 # Node ID 7e0563f0d2490a9f4f4052df8a8e4fa82c576c31 # Parent ed3aa5bd08f0f0ffae75efe095507adfb975836d Rename LIRFrameStateBuilder to BaselineFrameStateBuilder. diff -r ed3aa5bd08f0 -r 7e0563f0d249 graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java --- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java Tue Apr 22 20:14:37 2014 +0200 +++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java Tue Apr 22 20:16:38 2014 +0200 @@ -48,7 +48,7 @@ import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.phases.*; -public class BaselineBytecodeParser extends AbstractBytecodeParser implements BytecodeParserTool { +public class BaselineBytecodeParser extends AbstractBytecodeParser implements BytecodeParserTool { private Backend backend; protected LIRGenerator gen; private LIRGenerationResult lirGenRes; @@ -74,7 +74,7 @@ } public BaselineBytecodeParser(MetaAccessProvider metaAccess, ResolvedJavaMethod method, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts, - LIRFrameStateBuilder frameState, BytecodeStream stream, ProfilingInfo profilingInfo, ConstantPool constantPool, int entryBCI, Backend backend) { + BaselineFrameStateBuilder frameState, BytecodeStream stream, ProfilingInfo profilingInfo, ConstantPool constantPool, int entryBCI, Backend backend) { super(metaAccess, method, graphBuilderConfig, optimisticOpts, frameState, stream, profilingInfo, constantPool, entryBCI); this.backend = backend; @@ -109,7 +109,7 @@ throw GraalInternalError.unimplemented("Handle synchronized methods"); } - frameState = new LIRFrameStateBuilder(method); + frameState = new BaselineFrameStateBuilder(method); frameState.clearNonLiveLocals(blockMap.startBlock, liveness, true); currentBlock = blockMap.startBlock; @@ -608,7 +608,7 @@ } // We already saw this block before, so we have to merge states. - if (!((LIRFrameStateBuilder) block.entryState).isCompatibleWith(frameState)) { + if (!((BaselineFrameStateBuilder) block.entryState).isCompatibleWith(frameState)) { throw new BailoutException("stacks do not match; bytecodes would not verify"); } @@ -616,7 +616,7 @@ 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((LIRFrameStateBuilder) block.entryState); + adaptFramestate((BaselineFrameStateBuilder) block.entryState); return; } GraalInternalError.unimplemented("Loops not yet supported"); @@ -630,7 +630,7 @@ */ if (currentBlock != null && currentBlock.numNormalSuccessors() == 1) { // this is the only successor of the current block so we can adjust - adaptFramestate((LIRFrameStateBuilder) block.entryState); + adaptFramestate((BaselineFrameStateBuilder) block.entryState); return; } GraalInternalError.unimplemented("second block visit not yet implemented"); @@ -674,7 +674,7 @@ } } - private void adaptFramestate(LIRFrameStateBuilder other) { + 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++) { @@ -692,7 +692,7 @@ @Override protected void processBlock(BciBlock block) { - frameState = (LIRFrameStateBuilder) block.entryState; + frameState = (BaselineFrameStateBuilder) block.entryState; setCurrentFrameState(frameState); currentBlock = block; iterateBytecodesForBlock(block); diff -r ed3aa5bd08f0 -r 7e0563f0d249 graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java --- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java Tue Apr 22 20:14:37 2014 +0200 +++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java Tue Apr 22 20:16:38 2014 +0200 @@ -57,7 +57,7 @@ ConstantPool constantPool = method.getConstantPool(); TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method); - LIRFrameStateBuilder frameState = new LIRFrameStateBuilder(method); + BaselineFrameStateBuilder frameState = new BaselineFrameStateBuilder(method); BaselineBytecodeParser parser = new BaselineBytecodeParser(metaAccess, method, graphBuilderConfig, optimisticOpts, frameState, stream, profilingInfo, constantPool, entryBCI, backend); diff -r ed3aa5bd08f0 -r 7e0563f0d249 graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineFrameStateBuilder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineFrameStateBuilder.java Tue Apr 22 20:16:38 2014 +0200 @@ -0,0 +1,103 @@ +/* + * 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 { + + 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, new Value[method.getMaxLocals()], new Value[Math.max(1, method.getMaxStackSize())], EMPTY_ARRAY); + } + + protected BaselineFrameStateBuilder(BaselineFrameStateBuilder other) { + super(other); + } + + @Override + protected Value[] getEmtpyArray() { + return EMPTY_ARRAY; + } + + @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; + } +} diff -r ed3aa5bd08f0 -r 7e0563f0d249 graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/LIRFrameStateBuilder.java --- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/LIRFrameStateBuilder.java Tue Apr 22 20:14:37 2014 +0200 +++ /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 LIRFrameStateBuilder extends AbstractFrameStateBuilder { - - private static final Value[] EMPTY_ARRAY = new Value[0]; - - public LIRFrameStateBuilder(ResolvedJavaMethod method) { - // we always need at least one stack slot (for exceptions) - super(method, new Value[method.getMaxLocals()], new Value[Math.max(1, method.getMaxStackSize())], EMPTY_ARRAY); - } - - protected LIRFrameStateBuilder(LIRFrameStateBuilder other) { - super(other); - } - - @Override - protected Value[] getEmtpyArray() { - return EMPTY_ARRAY; - } - - @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 LIRFrameStateBuilder copy() { - return new LIRFrameStateBuilder(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(LIRFrameStateBuilder 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; - } -}