# HG changeset patch # User Thomas Wuerthinger # Date 1303932130 -7200 # Node ID c58a301eb2d78c9867474e914e3ea71623c87bcc # Parent 0f9eeb15e636ced4f6abad440a6e44c558377f10 Clean up on canTrap. diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java --- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Wed Apr 27 21:22:10 2011 +0200 @@ -1597,7 +1597,7 @@ } public boolean requiresNullCheck() { - return current == null || current.canTrap(); + return current == null || current instanceof InstanceOf || current instanceof CheckCast;//current.canTrap(); } public boolean requiresBoundsCheck() { diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java --- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Wed Apr 27 21:22:10 2011 +0200 @@ -1272,7 +1272,7 @@ if (x instanceof StateSplit) { StateSplit stateSplit = (StateSplit) x; - if (!stateSplit.isStateCleared() && stateSplit.stateBefore() == null) { + if (stateSplit.stateBefore() == null) { stateSplit.setStateBefore(curState.immutableCopy(bci)); } } diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java Wed Apr 27 21:22:10 2011 +0200 @@ -93,16 +93,6 @@ return isLoaded() && Modifier.isVolatile(field.accessFlags()); } - /** - * Checks whether this field access may cause a trap or an exception, which - * is if it either requires a null check or needs patching. - * @return {@code true} if this field access can cause a trap - */ - @Override - public boolean canTrap() { - return true; - } - @Override public void inputValuesDo(ValueClosure closure) { object = closure.apply(object); diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java Wed Apr 27 21:22:10 2011 +0200 @@ -77,15 +77,6 @@ return elementType; } - /** - * Checks whether this instruction can cause a trap. - * @return {@code true} if this instruction can cause a trap - */ - @Override - public boolean canTrap() { - return true; - } - @Override public void inputValuesDo(ValueClosure closure) { super.inputValuesDo(closure); diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java Wed Apr 27 21:22:10 2011 +0200 @@ -44,15 +44,6 @@ super(CiKind.Int, array, newFrameState); } - /** - * Checks whether this instruction can cause a trap. - * @return {@code true} if this instruction can cause a trap - */ - @Override - public boolean canTrap() { - return true; - } - @Override public void accept(ValueVisitor v) { v.visitArrayLength(this); diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java Wed Apr 27 21:22:10 2011 +0200 @@ -105,15 +105,6 @@ } /** - * Checks whether this instruction can trap. - * @return {@code true}, conservatively assuming the called method may throw an exception - */ - @Override - public boolean canTrap() { - return true; - } - - /** * Checks whether this invocation has a receiver object. * @return {@code true} if this invocation has a receiver object; {@code false} otherwise, if this is a * static call diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java Wed Apr 27 21:22:10 2011 +0200 @@ -46,15 +46,6 @@ super(object, lockAddress, stateBefore, lockNumber); } - /** - * Checks whether this instruction can trap. - * @return {@code true} if this instruction may raise a {@link NullPointerException} - */ - @Override - public boolean canTrap() { - return true; - } - @Override public void accept(ValueVisitor v) { v.visitMonitorEnter(this); diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java Wed Apr 27 21:22:10 2011 +0200 @@ -45,11 +45,6 @@ } @Override - public boolean canTrap() { - return true; - } - - @Override public void accept(ValueVisitor v) { v.visitMonitorExit(this); } diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java Wed Apr 27 21:22:10 2011 +0200 @@ -54,16 +54,6 @@ } /** - * Checks whether this instruction can trap. - * @return true, conservatively assuming that this instruction can throw such - * exceptions as {@code OutOfMemoryError} - */ - @Override - public boolean canTrap() { - return true; - } - - /** * Applies the specified closure to all input values of this instruction. * @param closure the closure to apply */ diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java Wed Apr 27 21:22:10 2011 +0200 @@ -61,15 +61,6 @@ } /** - * Checks whether this instruction can trap. - * @return {@code true}, assuming that allocation can cause OutOfMemory or other exceptions - */ - @Override - public boolean canTrap() { - return true; - } - - /** * Gets the exact type produced by this instruction. For allocations of instance classes, this is * always the class allocated. * @return the exact type produced by this instruction diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java Wed Apr 27 21:22:10 2011 +0200 @@ -54,15 +54,6 @@ return object; } - /** - * Checks whether this instruction can cause a trap. - * @return {@code true} if this instruction can cause a trap - */ - @Override - public boolean canTrap() { - return true; - } - @Override public void inputValuesDo(ValueClosure closure) { object = closure.apply(object); diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java Wed Apr 27 21:22:10 2011 +0200 @@ -51,11 +51,6 @@ } @Override - public boolean canTrap() { - return true; - } - - @Override public void print(LogStream out) { out.print("register finalizer ").print(object); } diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/ResolveClass.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ResolveClass.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ResolveClass.java Wed Apr 27 21:22:10 2011 +0200 @@ -52,11 +52,6 @@ } @Override - public boolean canTrap() { - return true; - } - - @Override public int valueNumber() { return 0x50000000 | type.hashCode(); } diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java Wed Apr 27 21:22:10 2011 +0200 @@ -49,21 +49,9 @@ this.stateBefore = stateBefore; } - /** - * Determines if the state for this instruction has explicitly - * been cleared (as opposed to never initialized). Once explicitly - * cleared, an instruction must not have it state (re)set. - */ - public boolean isStateCleared() { - return stateBefore == CLEARED_STATE; - } - - /** - * Clears the state for this instruction. Once explicitly - * cleared, an instruction must not have it state (re)set. - */ - protected void clearState() { - stateBefore = CLEARED_STATE; + @Override + public boolean canTrap() { + return stateBefore != null; } /** @@ -82,6 +70,6 @@ */ @Override public final FrameState stateBefore() { - return stateBefore == CLEARED_STATE ? null : stateBefore; + return stateBefore; } } diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java Wed Apr 27 21:22:10 2011 +0200 @@ -61,15 +61,6 @@ return value; } - /** - * Checks whether this instruction can cause a trap. - * @return {@code true} if this instruction can cause a trap - */ - @Override - public boolean canTrap() { - return true; - } - @Override public void inputValuesDo(ValueClosure closure) { super.inputValuesDo(closure); diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java Wed Apr 27 21:22:10 2011 +0200 @@ -84,15 +84,6 @@ } /** - * Checks whether this instruction can trap. - * @return {@code true}, conservatively assuming the cast may fail - */ - @Override - public boolean canTrap() { - return true; - } - - /** * Iterates over the input values to this instruction. * @param closure the closure to apply */ diff -r 0f9eeb15e636 -r c58a301eb2d7 graal/GraalRuntime/src/com/oracle/graal/runtime/HotSpotXirGenerator.java --- a/graal/GraalRuntime/src/com/oracle/graal/runtime/HotSpotXirGenerator.java Wed Apr 27 20:58:01 2011 +0200 +++ b/graal/GraalRuntime/src/com/oracle/graal/runtime/HotSpotXirGenerator.java Wed Apr 27 21:22:10 2011 +0200 @@ -1056,6 +1056,7 @@ valueHub = asm.createTemp("valueHub", CiKind.Object); compHub = asm.createTemp("compHub", CiKind.Object); if (implicitNullException) { + asm.nop(1); asm.mark(MARK_IMPLICIT_NULL); } asm.pload(CiKind.Object, compHub, array, asm.i(config.hubOffset), implicitNullException); @@ -1069,6 +1070,7 @@ int elemSize = target.sizeInBytes(kind); if (implicitNullException) { + asm.nop(1); asm.mark(MARK_IMPLICIT_NULL); } int disp = config.getArrayOffset(kind);