# HG changeset patch # User Stefan Anzinger # Date 1431694098 -7200 # Node ID cfc632ba768981db82723bbf6f26298641ab44cc # Parent 0c70dca70eeb36397d20e0e9b09d2f996a1afc63# Parent 7ea471ed17e41ce2e46aaebf566ba00b03515e16 Merge diff -r 0c70dca70eeb -r cfc632ba7689 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 14:47:51 2015 +0200 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java Fri May 15 14:48:18 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 0c70dca70eeb -r cfc632ba7689 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 14:47:51 2015 +0200 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractPointerStamp.java Fri May 15 14:48:18 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 0c70dca70eeb -r cfc632ba7689 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 14:47:51 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java Fri May 15 14:48:18 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 0c70dca70eeb -r cfc632ba7689 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 14:47:51 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MetaspacePointerStamp.java Fri May 15 14:48:18 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 0c70dca70eeb -r cfc632ba7689 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 14:47:51 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java Fri May 15 14:48:18 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; diff -r 0c70dca70eeb -r cfc632ba7689 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Fri May 15 14:47:51 2015 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Fri May 15 14:48:18 2015 +0200 @@ -462,11 +462,6 @@ } /** - * Cache to speed up preprocessing of replacement graphs. - */ - final ConcurrentMap graphCache = new ConcurrentHashMap<>(); - - /** * Creates and preprocesses a graph for a replacement. */ public static class GraphMaker { @@ -493,12 +488,8 @@ public StructuredGraph makeGraph(Object[] args) { try (Scope s = Debug.scope("BuildSnippetGraph", method)) { - StructuredGraph graph = parseGraph(method, args); - - if (args == null) { - // Cannot have a finalized version of a graph in the cache - graph = graph.copy(); - } + assert method.hasBytecodes() : method; + StructuredGraph graph = buildInitialGraph(method, args); finalizeGraph(graph); @@ -551,21 +542,6 @@ return false; } - private StructuredGraph parseGraph(final ResolvedJavaMethod methodToParse, Object[] args) { - assert methodToParse.hasBytecodes() : methodToParse; - if (args != null) { - return buildInitialGraph(methodToParse, args); - } - StructuredGraph graph = replacements.graphCache.get(methodToParse); - if (graph == null) { - StructuredGraph newGraph = buildInitialGraph(methodToParse, args); - replacements.graphCache.putIfAbsent(methodToParse, newGraph); - graph = replacements.graphCache.get(methodToParse); - assert graph != null; - } - return graph; - } - /** * Builds the initial graph for a snippet. */