diff --git a/src/share/tools/MakeDeps/Database.java b/src/share/tools/MakeDeps/Database.java index c26ef1d6fc3b3ca37ddfd5d4d7a933f6051ecb30..5cec93b7d03b3dc43b8d60c3d1a9c2a2d3c75e66 100644 --- a/src/share/tools/MakeDeps/Database.java +++ b/src/share/tools/MakeDeps/Database.java @@ -36,6 +36,7 @@ public class Database { private FileList outerFiles; private FileList indivIncludes; private FileList grandInclude; // the results for the grand include file + private HashMap platformDepFiles; private long threshold; private int nOuterFiles; private int nPrecompiledFiles; @@ -57,6 +58,7 @@ public class Database { outerFiles = new FileList("outerFiles", plat); indivIncludes = new FileList("IndivIncludes", plat); grandInclude = new FileList(plat.getGIFileTemplate().nameOfList(), plat); + platformDepFiles = new HashMap(); threshold = t; nOuterFiles = 0; @@ -209,6 +211,10 @@ public class Database { FileList p = allFiles.listForFile(includer); p.setPlatformDependentInclude(pdName.dirPreStemSuff()); + // Record the implicit include of this file so that the + // dependencies for precompiled headers can mention it. + platformDepFiles.put(newIncluder, includer); + // Add an implicit dependency on platform // specific file for the generic file @@ -408,6 +414,12 @@ public class Database { for (Iterator iter = grandInclude.iterator(); iter.hasNext(); ) { FileList list = (FileList) iter.next(); gd.println(list.getName() + " \\"); + String platformDep = platformDepFiles.get(list.getName()); + if (platformDep != null) { + // make sure changes to the platform dependent file will + // cause regeneration of the pch file. + gd.println(platformDep + " \\"); + } } gd.println(); gd.println(); diff --git a/src/share/vm/opto/subnode.cpp b/src/share/vm/opto/subnode.cpp index 53413dfbfeb8528ae7d6c1f1e5c425f77926e75a..6a530b3a7e50159781d12db8d3b4c36f633cb290 100644 --- a/src/share/vm/opto/subnode.cpp +++ b/src/share/vm/opto/subnode.cpp @@ -45,10 +45,13 @@ Node *SubNode::Identity( PhaseTransform *phase ) { return in(2)->in(2); } - // Convert "(X+Y) - Y" into X + // Convert "(X+Y) - Y" into X and "(X+Y) - X" into Y if( in(1)->Opcode() == Op_AddI ) { if( phase->eqv(in(1)->in(2),in(2)) ) return in(1)->in(1); + if (phase->eqv(in(1)->in(1),in(2))) + return in(1)->in(2); + // Also catch: "(X + Opaque2(Y)) - Y". In this case, 'Y' is a loop-varying // trip counter and X is likely to be loop-invariant (that's how O2 Nodes // are originally used, although the optimizer sometimes jiggers things).