# HG changeset patch # User Roland Schatz # Date 1431690766 -7200 # Node ID 7ea471ed17e41ce2e46aaebf566ba00b03515e16 # Parent 33d3be2548d6a19eab6cc227a72ee233f9b070ef Fix handling of null flags in MetaspacePointerStamp operations. diff -r 33d3be2548d6 -r 7ea471ed17e4 graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java Fri May 15 13:45:06 2015 +0200 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java Fri May 15 13:52:46 2015 +0200 @@ -43,6 +43,11 @@ protected abstract AbstractObjectStamp copyWith(ResolvedJavaType newType, boolean newExactType, boolean newNonNull, boolean newAlwaysNull); @Override + protected final AbstractPointerStamp copyWith(boolean newNonNull, boolean newAlwaysNull) { + return copyWith(type, exactType, newNonNull, newAlwaysNull); + } + + @Override public Stamp unrestricted() { return copyWith(null, false, false, false); } diff -r 33d3be2548d6 -r 7ea471ed17e4 graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractPointerStamp.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractPointerStamp.java Fri May 15 13:45:06 2015 +0200 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractPointerStamp.java Fri May 15 13:52:46 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,6 +45,8 @@ return alwaysNull; } + protected abstract AbstractPointerStamp copyWith(boolean newNonNull, boolean newAlwaysNull); + @Override public int hashCode() { final int prime = 31; @@ -55,6 +57,32 @@ } @Override + public Stamp join(Stamp stamp) { + AbstractPointerStamp other = (AbstractPointerStamp) stamp; + boolean joinNonNull = this.nonNull || other.nonNull; + boolean joinAlwaysNull = this.alwaysNull || other.alwaysNull; + return copyWith(joinNonNull, joinAlwaysNull); + } + + @Override + public Stamp improveWith(Stamp other) { + return join(other); + } + + @Override + public Stamp meet(Stamp stamp) { + AbstractPointerStamp other = (AbstractPointerStamp) stamp; + boolean meetNonNull = this.nonNull && other.nonNull; + boolean meetAlwaysNull = this.alwaysNull && other.alwaysNull; + return copyWith(meetNonNull, meetAlwaysNull); + } + + @Override + public Stamp unrestricted() { + return copyWith(false, false); + } + + @Override public boolean equals(Object obj) { if (this == obj) { return true; diff -r 33d3be2548d6 -r 7ea471ed17e4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java Fri May 15 13:45:06 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java Fri May 15 13:52:46 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,6 +58,11 @@ } @Override + protected AbstractPointerStamp copyWith(boolean newNonNull, boolean newAlwaysNull) { + return new KlassPointerStamp(newNonNull, newAlwaysNull, encoding); + } + + @Override public boolean isCompatible(Stamp otherStamp) { if (this == otherStamp) { return true; diff -r 33d3be2548d6 -r 7ea471ed17e4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MetaspacePointerStamp.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MetaspacePointerStamp.java Fri May 15 13:45:06 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MetaspacePointerStamp.java Fri May 15 13:52:46 2015 +0200 @@ -39,28 +39,6 @@ } @Override - public Stamp meet(Stamp other) { - assert isCompatible(other); - return this; - } - - @Override - public Stamp improveWith(Stamp other) { - return this; - } - - @Override - public Stamp join(Stamp other) { - assert isCompatible(other); - return this; - } - - @Override - public Stamp unrestricted() { - return this; - } - - @Override public Stamp empty() { // there is no empty pointer stamp return this; diff -r 33d3be2548d6 -r 7ea471ed17e4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java Fri May 15 13:45:06 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java Fri May 15 13:52:46 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,18 @@ } @Override + protected AbstractPointerStamp copyWith(boolean newNonNull, boolean newAlwaysNull) { + if (newNonNull) { + assert !newAlwaysNull; + return METHOD_NON_NULL; + } else if (newAlwaysNull) { + return METHOD_ALWAYS_NULL; + } else { + return METHOD; + } + } + + @Override public boolean isCompatible(Stamp otherStamp) { if (this == otherStamp) { return true;