# HG changeset patch # User Thomas Wuerthinger # Date 1422412111 -3600 # Node ID e7b6e7f19fd0acb46007d5a6e5acb1910abf9ab1 # Parent 43baadc1913ab9c0f2efe4fb26aa31dc304ccce0# Parent 9470dcef2d5930fb857c085db120581600f6a3b6 Merge. diff -r 9470dcef2d59 -r e7b6e7f19fd0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java diff -r 9470dcef2d59 -r e7b6e7f19fd0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java diff -r 9470dcef2d59 -r e7b6e7f19fd0 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InlineEverythingPolicy.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InlineEverythingPolicy.java Wed Jan 28 02:58:22 2015 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InlineEverythingPolicy.java Wed Jan 28 03:28:31 2015 +0100 @@ -29,7 +29,7 @@ import static com.oracle.graal.compiler.common.GraalOptions.MaximumDesiredSize; -public final class InlineEverythingPolicy implements InliningPolicy { +public class InlineEverythingPolicy implements InliningPolicy { public boolean continueInlining(StructuredGraph graph) { if (graph.getNodeCount() >= MaximumDesiredSize.getValue()) { diff -r 9470dcef2d59 -r e7b6e7f19fd0 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InlineMethodSubstitutionsPolicy.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InlineMethodSubstitutionsPolicy.java Wed Jan 28 03:28:31 2015 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.phases.common.inlining.policy; + +import com.oracle.graal.api.meta.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.java.*; +import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.phases.common.inlining.walker.*; + +/** + * Inline every method which would be replaced by a substitution. Useful for testing purposes. + */ +public final class InlineMethodSubstitutionsPolicy extends InlineEverythingPolicy { + + @Override + public boolean isWorthInlining(Replacements replacements, MethodInvocation invocation, int inliningDepth, boolean fullyProcessed) { + CallTargetNode callTarget = invocation.callee().invoke().callTarget(); + if (callTarget instanceof MethodCallTargetNode) { + ResolvedJavaMethod calleeMethod = ((MethodCallTargetNode) callTarget).targetMethod(); + if (replacements.getMethodSubstitution(calleeMethod) != null) { + return true; + } + } + return false; + } +} diff -r 9470dcef2d59 -r e7b6e7f19fd0 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/EdgesTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/EdgesTest.java Wed Jan 28 02:58:22 2015 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/EdgesTest.java Wed Jan 28 03:28:31 2015 +0100 @@ -38,6 +38,7 @@ import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; +import com.oracle.graal.phases.common.inlining.policy.*; import com.oracle.graal.phases.tiers.*; public class EdgesTest extends GraalCompilerTest { @@ -115,7 +116,7 @@ StructuredGraph g = parseProfiled(javaMethod); Assumptions assumptions = new Assumptions(false); HighTierContext context = new HighTierContext(getProviders(), assumptions, null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); - new InliningPhase(new CanonicalizerPhase(true)).apply(g, context); + new InliningPhase(new InlineMethodSubstitutionsPolicy(), new CanonicalizerPhase(true)).apply(g, context); new CanonicalizerPhase(false).apply(g, context); Assert.assertTrue(g.getNodes().filter(CheckCastNode.class).isEmpty()); } diff -r 9470dcef2d59 -r e7b6e7f19fd0 mx/mx_graal.py --- a/mx/mx_graal.py Wed Jan 28 02:58:22 2015 +0100 +++ b/mx/mx_graal.py Wed Jan 28 03:28:31 2015 +0100 @@ -1726,6 +1726,8 @@ if not exists(nbplatform): mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]') + # make the jar for Batik 1.7 available. + env['IGV_BATIK_JAR'] = mx.library('BATIK').get_path(True) if mx.run(['ant', '-f', mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')), '-l', mx._cygpathU2W(fp.name), 'run'], env=env, nonZeroIsFatal=False): mx.abort("IGV ant build & launch failed. Check '" + logFile + "'. You can also try to delete 'src/share/tools/IdealGraphVisualizer/nbplatform'.") diff -r 9470dcef2d59 -r e7b6e7f19fd0 mx/suite.py --- a/mx/suite.py Wed Jan 28 02:58:22 2015 +0100 +++ b/mx/suite.py Wed Jan 28 03:28:31 2015 +0100 @@ -176,8 +176,14 @@ "sha1" : "f44bffaf237305512002303a306fc5ce3fa63f76", "urls" : ["http://lafo.ssw.uni-linz.ac.at/jmh/jmh-runner-1.4.2.jar"], "annotationProcessor" : "true" + }, + + "BATIK" : { + "path" : "lib/batik-all-1.7.jar", + "sha1" : "122b87ca88e41a415cf8b523fd3d03b4325134a3", + "urls" : ["http://lafo.ssw.uni-linz.ac.at/graal-external-deps/batik-all-1.7.jar"], } - }, +}, "jrelibraries" : { "JFR" : { diff -r 9470dcef2d59 -r e7b6e7f19fd0 src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/BatikSVG.java --- a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/BatikSVG.java Wed Jan 28 02:58:22 2015 +0100 +++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/BatikSVG.java Wed Jan 28 03:28:31 2015 +0100 @@ -25,9 +25,13 @@ import java.awt.Graphics2D; import java.io.Writer; +import java.io.File; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; import org.w3c.dom.DOMImplementation; /** @@ -53,7 +57,13 @@ public static Graphics2D createGraphicsObject() { try { if (SVGGraphics2DConstructor == null) { - ClassLoader cl = BatikSVG.class.getClassLoader(); + String batikJar = System.getenv().get("IGV_BATIK_JAR"); + if (batikJar == null) { + return null; + } + // Load batik in it's own class loader since some it's support jars interfere with the JDK + URL url = new File(batikJar).toURI().toURL(); + ClassLoader cl = new URLClassLoader(new URL[] { url }); Class classGenericDOMImplementation = cl.loadClass("org.apache.batik.dom.GenericDOMImplementation"); Class classSVGGeneratorContext = cl.loadClass("org.apache.batik.svggen.SVGGeneratorContext"); classSVGGraphics2D = cl.loadClass("org.apache.batik.svggen.SVGGraphics2D"); @@ -79,6 +89,8 @@ return null; } catch (InstantiationException e) { return null; + } catch (MalformedURLException e) { + return null; } }