nashorn/make/build-benchmark.xml
author sundar
Thu, 24 Mar 2016 17:36:21 +0530
changeset 36697 665335352bb7
parent 34732 6605efbe8447
child 36764 298caeee3757
permissions -rw-r--r--
8152646: disable ant octane target to avoid hudson build failure notifications Reviewed-by: jlaskey

<?xml version="1.0" encoding="UTF-8"?>

<!--
    Copyright (c) 2010, 2014, 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.
-->


<project
    name="nashorn-benchmarks"
    default="all"
    basedir=".."
    xmlns:if="ant:if">

  <!--
       Below are the octane benchmarks that should be run.
       The ones that are excluded, as Nashorn currently has
       some issues with them (functionality or performance)
       are commented out
  -->

  <!-- box2d -->
  <target name="octane-box2d" depends="octane-box2d-nashorn"/>
  <target name="octane-box2d-nashorn" depends="jar">
    <run-one cond="octane.benchmark.box2d" runtime="nashorn"/>
  </target>
  <target name="octane-box2d-v8" depends="jar">
    <run-one cond="octane.benchmark.box2d" runtime="v8"/>
  </target>
  <target name="octane-box2d-rhino" depends="jar">
    <run-one cond="octane.benchmark.box2d" runtime="rhino"/>
  </target>

  <!-- code-load -->
  <target name="octane-code-load" depends="octane-code-load-nashorn"/>
  <target name="octane-code-load-nashorn" depends="jar">
    <run-one cond="octane.benchmark.code-load" runtime="nashorn"/>
  </target>
  <target name="octane-code-load-v8" depends="jar">
    <run-one cond="octane.benchmark.code-load" runtime="v8"/>
  </target>
  <target name="octane-code-load-rhino" depends="jar">
    <run-one cond="octane.benchmark.code-load" runtime="rhino"/>
  </target>

  <!-- crypto -->
  <target name="octane-crypto" depends="octane-crypto-nashorn"/>
  <target name="octane-crypto-nashorn" depends="jar">
    <run-one cond="octane.benchmark.crypto" runtime="nashorn"/>
  </target>
  <target name="octane-crypto-v8" depends="jar">
    <run-one cond="octane.benchmark.crypto" runtime="v8"/>
  </target>
  <target name="octane-crypto-rhino" depends="jar">
    <run-one cond="octane.benchmark.crypto" runtime="rhino"/>
  </target>

  <!-- deltablue -->
  <target name="octane-deltablue" depends="octane-deltablue-nashorn"/>
  <target name="octane-deltablue-nashorn" depends="jar">
    <run-one cond="octane.benchmark.deltablue" runtime="nashorn"/>
  </target>
  <target name="octane-deltablue-v8" depends="jar">
    <run-one cond="octane.benchmark.deltablue" runtime="v8"/>
  </target>
  <target name="octane-deltablue-rhino" depends="jar">
    <run-one cond="octane.benchmark.deltablue" runtime="rhino"/>
  </target>

  <!-- earley-boyer -->
  <target name="octane-earley-boyer" depends="octane-earley-boyer-nashorn"/>
  <target name="octane-earley-boyer-nashorn" depends="jar">
    <run-one cond="octane.benchmark.earley-boyer" runtime="nashorn"/>
  </target>
  <target name="octane-earley-boyer-v8" depends="jar">
    <run-one cond="octane.benchmark.earley-boyer" runtime="v8"/>
  </target>
  <target name="octane-earley-boyer-rhino" depends="jar">
    <run-one cond="octane.benchmark.earley-boyer" runtime="rhino"/>
  </target>
  
  <!-- gbemu -->
  <target name="octane-gbemu" depends="octane-gbemu-nashorn"/>
  <target name="octane-gbemu-nashorn" depends="jar">
    <run-one cond="octane.benchmark.gbemu" runtime="nashorn"/>
  </target>
  <target name="octane-gbemu-v8" depends="jar">
    <run-one cond="octane.benchmark.gbemu" runtime="v8"/>
  </target>
  <target name="octane-gbemu-rhino" depends="jar">
    <run-one cond="octane.benchmark.gbemu" runtime="rhino"/>
  </target>

  <!-- mandreel -->
  <target name="octane-mandreel" depends="octane-mandreel-nashorn"/>
  <target name="octane-mandreel-nashorn" depends="jar">
    <run-one cond="octane.benchmark.mandreel" runtime="nashorn"/>
  </target>
  <target name="octane-mandreel-v8" depends="jar">
    <run-one cond="octane.benchmark.mandreel" runtime="v8"/>
  </target>
  <target name="octane-mandreel-rhino" depends="jar">
    <run-one cond="octane.benchmark.mandreel" runtime="rhino"/>
  </target>

  <!-- navier-stokes -->
  <target name="octane-navier-stokes" depends="octane-navier-stokes-nashorn"/>
  <target name="octane-navier-stokes-nashorn" depends="jar">
    <run-one cond="octane.benchmark.navier-stokes" runtime="nashorn"/>
  </target>
  <target name="octane-navier-stokes-v8" depends="jar">
    <run-one cond="octane.benchmark.navier-stokes" runtime="v8"/>
  </target>
  <target name="octane-navier-stokes-rhino" depends="jar">
    <run-one cond="octane.benchmark.navier-stokes" runtime="rhino"/>
  </target>

  <!-- pdfjs -->
  <target name="octane-pdfjs" depends="octane-pdfjs-nashorn"/>
  <target name="octane-pdfjs-nashorn" depends="jar">
    <run-one cond="octane.benchmark.pdfjs" runtime="nashorn"/>
  </target>
  <target name="octane-pdfjs-v8" depends="jar">
    <run-one cond="octane.benchmark.pdfjs" runtime="v8"/>
  </target>
  <target name="octane-pdfjs-rhino" depends="jar">
    <run-one cond="octane.benchmark.pdfjs" runtime="rhino"/>
  </target>

  <!-- raytrace -->
  <target name="octane-raytrace" depends="octane-raytrace-nashorn"/>
  <target name="octane-raytrace-nashorn" depends="jar">
    <run-one cond="octane.benchmark.raytrace" runtime="nashorn"/>
  </target>
  <target name="octane-raytrace-v8" depends="jar">
    <run-one cond="octane.benchmark.raytrace" runtime="v8"/>
  </target>
  <target name="octane-raytrace-rhino" depends="jar">
    <run-one cond="octane.benchmark.raytrace" runtime="rhino"/>
  </target>

  <!-- regexp -->
  <target name="octane-regexp" depends="octane-regexp-nashorn"/>
  <target name="octane-regexp-nashorn" depends="jar">
    <run-one cond="octane.benchmark.regexp" runtime="nashorn"/>
  </target>
  <target name="octane-regexp-v8" depends="jar">
    <run-one cond="octane.benchmark.regexp" runtime="v8"/>
  </target>
  <target name="octane-regexp-rhino" depends="jar">
    <run-one cond="octane.benchmark.regexp" runtime="rhino"/>
  </target>

  <!-- richards -->
  <target name="octane-richards" depends="octane-richards-nashorn"/>
  <target name="octane-richards-nashorn" depends="jar">
    <run-one cond="octane.benchmark.richards" runtime="nashorn"/>
  </target>
  <target name="octane-richards-v8" depends="jar">
    <run-one cond="octane.benchmark.richards" runtime="v8"/>
  </target>
  <target name="octane-richards-rhino" depends="jar">
    <run-one cond="octane.benchmark.richards" runtime="rhino"/>
  </target>

  <!-- splay -->
  <target name="octane-splay" depends="octane-splay-nashorn"/>
  <target name="octane-splay-nashorn" depends="jar">
    <run-one cond="octane.benchmark.splay" runtime="nashorn"/>
  </target>
  <target name="octane-splay-v8" depends="jar">
    <run-one cond="octane.benchmark.splay" runtime="v8"/>
  </target>
  <target name="octane-splay-rhino" depends="jar">
    <run-one cond="octane.benchmark.splay" runtime="rhino"/>
  </target>

  <!-- typescript -->
  <target name="octane-typescript" depends="octane-typescript-nashorn"/>
  <target name="octane-typescript-nashorn" depends="jar">
    <run-one cond="octane.benchmark.typescript" runtime="nashorn"/>
  </target>
  <target name="octane-typescript-v8" depends="jar">
    <run-one cond="octane.benchmark.typescript" runtime="v8"/>
  </target>
  <target name="octane-typescript-rhino" depends="jar">
    <run-one cond="octane.benchmark.typescript" runtime="rhino"/>
  </target>

  <!-- zlib -->
  <target name="octane-zlib" depends="octane-zlib-nashorn"/>
  <target name="octane-zlib-nashorn" depends="jar">
    <run-one cond="octane.benchmark.zlib" runtime="nashorn"/>
  </target>
  <target name="octane-zlib-v8" depends="jar">
    <run-one cond="octane.benchmark.zlib" runtime="v8"/>
  </target>
  <target name="octane-zlib-rhino" depends="jar">
    <run-one cond="octane.benchmark.zlib" runtime="rhino"/>
  </target>

  <!--
      Benchmark runners for one or more benchmarks, single
      or multiple process
  -->

  <target name="octane-process-separate" if="${octane-test-sys-prop.separate.process}">
    <echo message="Running each benchmark in separate processes, starting new JVMs for each."/>
    <script language="javascript"><![CDATA[
      var props = [];

      for (var prop in project.getProperties()) {
        if (prop.startsWith("octane.benchmark.")) {
          props.push(prop);
        }
      }

      //sort benchmark props in alphabetical order by name
      props.sort(function(a, b) {
        if (a < b) {
          return -1;
        } else if (a > b) {
          return 1;
        } else {
           return 0;
        }
      });
      
      var runtime = project.getProperty("runtime");

      for (var i in props) {
        var task = project.createTask("run-one");
	// workaround for https://issues.apache.org/bugzilla/show_bug.cgi?id=53831, still not fixed
        if (task.getOwningTarget() == null) {
	  task.setOwningTarget(self.getOwningTarget());
	}
        var prop = props[i];
        task.setDynamicAttribute("cond", prop);
        task.setDynamicAttribute("runtime", runtime);
	task.perform();
      }
    ]]></script>
  </target>

  <target name="octane-process-single" unless="${octane-test-sys-prop.separate.process}">
    <echo message="Running all benchmarks in the same process."/>
    <pathconvert property="octane.benchmarks" pathsep=" ">
      <propertyset>
    <propertyref prefix="octane.benchmark."/>
      </propertyset>
    </pathconvert>
    <antcall target="run-octane${runtime}">
      <param name="octane-tests" value="${octane.benchmarks}"/>
    </antcall>
  </target>

  <!--
       run 'octane' in single or separate processes based on config
       This uses nashorn as the default runtime
  -->
  <target name="octane-nashorn" depends="jar">
    <property name="runtime" value="nashorn"/>
    <!--
       Temporarily disabled because ant script tag is broken with
       jdk9. See also: JDK-8152533.

       <antcall target="octane-process-separate"/>
       <antcall target="octane-process-single"/>
    -->
    <echo message="octane target temporarily disabled"/>
  </target>

  <!-- alias for 'octane' -->
  <target name="octane" depends="octane-nashorn"/>

  <!-- run octane benchmarks using octane as runtime -->
  <target name="octane-v8" depends="jar">
    <property name="runtime" value="v8"/>
    <antcall target="octane-process-separate"/>
    <antcall target="octane-process-single"/>
  </target>

  <!-- run octane benchmarks using Rhino as runtime -->
  <target name="octane-rhino" depends="jar">
    <property name="runtime" value="rhino"/>
    <antcall target="octane-process-separate"/>
    <antcall target="octane-process-single"/>
  </target>

  <macrodef name="run-one">
    <attribute name="cond"/>
    <attribute name="runtime" default=""/>
    <sequential>
	<antcall target="run-octane-@{runtime}" if:set="@{cond}">
	  <param name="octane-tests" value="${@{cond}}"/>
	</antcall>
    </sequential>
  </macrodef>

  <target name="run-octane-nashorn">
    <java classname="${nashorn.shell.tool}"
          classpath="${run.test.classpath}"
          fork="true"
          dir=".">
      <jvmarg line="${boot.class.path}"/>
      <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
      <!-- pass on all properties prefixed with 'nashorn' to the runtime -->
      <syspropertyset>
        <propertyref prefix="nashorn."/>
      </syspropertyset>
      <arg value="${octane-test-sys-prop.test.js.framework}"/>
      <arg value="-scripting"/>
      <arg value="--"/>
      <arg value="${octane-tests}"/>
      <arg value="--runtime"/>
      <arg value="nashorn"/>
      <arg value="--verbose"/>
      <arg value="--iterations ${octane.iterations}"/>
    </java>
  </target>

  <target name="run-octane-v8">
    <exec executable="${v8.shell}">
      <arg value="${octane-test-sys-prop.test.js.framework}"/>
      <arg value="--"/>
      <arg value="${octane-tests}"/>
      <arg value="--runtime"/>
      <arg value="v8"/>
      <arg value="--verbose"/>
      <arg value="--iterations ${octane.iterations}"/>
    </exec>
  </target>

  <target name="run-octane-rhino">
    <java jar="${rhino.jar}"
          classpath="${run.test.classpath}"
          fork="true"
          dir=".">
      <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
      <arg value="-opt"/>
      <arg value="9"/>
      <arg value="${octane-test-sys-prop.test.js.framework}"/>
      <arg value="${octane-tests}"/>
      <arg value="--runtime"/>
      <arg value="rhino"/>
      <arg value="--verbose"/>
      <arg value="--iterations ${octane.iterations}"/>
    </java>
  </target>

  <!-- run octane with all known runtimes for comparison -->
  <target name="octane-all" depends="octane, octane-v8, octane-rhino">
    <exec executable="${v8.shell}">
      <arg value="${octane-test-sys-prop.test.js.framework}"/>
      <arg value="${octane-tests}/"/>
    </exec>
  </target>

  <target name="sunspider-init" depends="jar">
    <fileset id="sunspider-set"
         dir="${sunspider-test-sys-prop.test.js.roots}"
         excludes="${sunspider-test-sys-prop.test.js.exclude.list}">
      <include name="**/*.js"/>
    </fileset>
    <pathconvert pathsep=" " property="sunspider-tests" refid="sunspider-set"/>
  </target>

  <!--- SUNSPIDER JOB BELOW -->

  <!-- run sunspider with Nashorn -->
  <target name="sunspider" depends="sunspider-nashorn"/>

  <target name="sunspider-nashorn" depends="sunspider-init">
    <java classname="${nashorn.shell.tool}"
          classpath="${run.test.classpath}"
          fork="true"
          dir=".">
      <jvmarg line="${boot.class.path}"/>
      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
      <arg value="-timezone=PST"/>
      <arg value="--class-cache-size=50"/>
      <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
      <arg value="--"/>
      <arg value="${sunspider-tests}/"/>
      <arg value="--verbose"/>
      <arg value="--times"/>
      <arg value="${sunspider.iterations}"/>
    </java>
  </target>

  <!-- run sunspider with v8 -->
  <target name="sunspider-v8" depends="sunspider-init">
    <exec executable="${v8.shell}">
      <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
      <arg value="--"/>
      <arg value="${sunspider-tests}/"/>
      <arg value="--verbose"/>
      <arg value="--times"/>
      <arg value="${sunspider.iterations}"/>
    </exec>
  </target>

  <!-- run sunspider with Rhino -->
  <target name="sunspider-rhino" depends="sunspider-init">
    <java jar="${rhino.jar}"
          classpath="${run.test.classpath}"
          fork="true"
          dir=".">
      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
      <arg value="-opt"/>
      <arg value="9"/>
      <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
      <arg value="${sunspider-tests}/"/>
      <arg value="--verbose"/>
      <arg value="--times"/>
      <arg value="${sunspider.iterations}"/>
    </java>
  </target>

</project>