Mercurial > hg > graal-compiler
changeset 21401:7ea471ed17e4
Fix handling of null flags in MetaspacePointerStamp operations.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Fri, 15 May 2015 13:52:46 +0200 |
parents | 33d3be2548d6 |
children | cfc632ba7689 |
files | graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractPointerStamp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MetaspacePointerStamp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java |
diffstat | 5 files changed, 53 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- 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); }
--- 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;
--- 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;
--- 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;
--- 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;