nashorn/bin/runopt.sh
author lana
Fri, 18 Jul 2014 08:25:26 -0700
changeset 25597 6073de33135f
parent 24766 7b54e2362c6c
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     1
#!/bin/sh
24766
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
     2
#
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
     3
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
     5
# 
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
     8
# published by the Free Software Foundation.
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
     9
# 
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    10
# This code is distributed in the hope that it will be useful, but WITHOUT
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    13
# version 2 for more details (a copy is included in the LICENSE file that
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    14
# accompanied this code).
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    15
# 
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    16
# You should have received a copy of the GNU General Public License version
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    17
# 2 along with this work; if not, write to the Free Software Foundation,
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    19
# 
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    21
# or visit www.oracle.com if you need additional information or have any
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    22
# questions.
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    23
#
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    24
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    25
###########################################################################################
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    26
# This is a helper script to evaluate nashorn with optimistic types
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    27
# it produces a flight recording for every run, and uses the best 
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    28
# known flags for performance for the current configration
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    29
###########################################################################################
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    30
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    31
# Flags to instrument lambdaform computation, caching, interpretation and compilation
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    32
# Default compile threshold for lambdaforms is 30
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    33
#FLAGS="-Djava.lang.invoke.MethodHandle.COMPILE_THRESHOLD=3 -Djava.lang.invoke.MethodHandle.DUMP_CLASS_FILES=true -Djava.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE=true -Djava.lang.invoke.MethodHandle.TRACE_INTERPRETER=true"
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    34
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    35
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    36
# Flags to run trusted tests from the Nashorn test suite
24731
ab0c8fc915ae 8038406: Testability: as a first step of moving loggers away from the process global space, the Debug object now supports logging POJOs from log entries as an event queue, which can be introspected from test scripts. This is way better than screen scraping brittle and subject-to-change log output.
lagergren
parents: 24722
diff changeset
    37
#FLAGS="-Djava.security.manager -Djava.security.policy=../build/nashorn.policy -Dnashorn.debug"
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    38
24720
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 24719
diff changeset
    39
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    40
# Unique timestamped file name for JFR recordings. For JFR, we also have to
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    41
# crank up the stack cutoff depth to 1024, because of ridiculously long lambda form
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    42
# stack traces.
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    43
#
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    44
# It is also recommended that you go into $JAVA_HOME/jre/lib/jfr/default.jfc and
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    45
# set the "method-sampling-interval" Normal and Maximum sample time as low as you
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    46
# can go (10 ms on most platforms). The default is normally higher. The increased
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    47
# sampling overhead is usually negligible for Nashorn runs, but the data is better
24766
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    48
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    49
JFR_FILENAME="./nashorn_$(date|sed "s/ /_/g"|sed "s/:/_/g").jfr"
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    50
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    51
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    52
# Directory where to look for nashorn.jar in a dist folder. The default is "..", assuming
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    53
# that we run the script from the make dir
24721
81f70e23cd3b 8036127: Prototype filter needs to be applied to getter guard as well, not just getter
lagergren
parents: 24720
diff changeset
    54
DIR=..
24720
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 24719
diff changeset
    55
NASHORN_JAR=$DIR/dist/nashorn.jar
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    56
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    57
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    58
# The built Nashorn jar is placed first in the bootclasspath to override the JDK
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    59
# nashorn.jar in $JAVA_HOME/jre/lib/ext. Thus, we also need -esa, as assertions in
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    60
# nashorn count as system assertions in this configuration
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    61
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    62
# Type profiling default level is 111, 222 adds some compile time, but is faster
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    63
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    64
$JAVA_HOME/bin/java \
24720
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 24719
diff changeset
    65
$FLAGS \
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    66
-ea \
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    67
-esa \
24741
4232289c3235 8040102: Remove all references to Unsafe and definition of anonymous clases from the code
lagergren
parents: 24740
diff changeset
    68
-Xbootclasspath/p:$NASHORN_JAR \
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    69
-Xms2G -Xmx2G \
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    70
-XX:TypeProfileLevel=222 \
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    71
-cp $CLASSPATH:../build/test/classes/ \
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    72
jdk.nashorn.tools.Shell ${@}
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    73
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    74
# Below are flags that may come in handy, but aren't used for default runs
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    75
24766
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    76
# Testing out new code optimizations using the generic hotspot "new code" parameter
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    77
#-XX:+UnlockDiagnosticVMOptions \
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    78
#-XX:+UseNewCode \
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    79
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    80
# Flight recorder
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    81
#-XX:+UnlockCommercialFeatures \
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    82
#-XX:+FlightRecorder \
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    83
#-XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath=$JFR_FILENAME,stackdepth=1024 \
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
    84
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    85
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    86
# Type specialization and math intrinsic replacement should be enabled by default in 8u20 and nine,
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    87
# keeping this flag around for experimental reasons. Replace + with - to switch it off
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    88
#-XX:+UseTypeSpeculation \
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    89
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    90
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    91
# Same with math intrinsics. They should be enabled by default in 8u20 and 9
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    92
#-XX:+UseMathExactIntrinsics \
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    93
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    94
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    95
# Add -Dnashorn.time to time the compilation phases.
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    96
#-Dnashorn.time \
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    97
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    98
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    99
# Add ShowHiddenFrames to get lambda form internals on the stack traces
24720
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 24719
diff changeset
   100
#-XX:+ShowHiddenFrames \
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
   101
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
   102
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
   103
# Add print optoassembly to get an asm dump. This requires 1) a debug build, not product,
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
   104
# That tired compilation is switched off, for C2 only output and that the number of
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
   105
# compiler threads is set to 1 for determinsm.
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
   106
#-XX:+PrintOptoAssembly -XX:-TieredCompilation -XX:CICompilerCount=1 \
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
   107
24766
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
   108
# Tier compile threasholds. Default value is 10. (1-100 is useful for experiments)
7b54e2362c6c 8043632: Parallelize class installation and various script fixes.
lagergren
parents: 24764
diff changeset
   109
# -XX:IncreaseFirstTierCompileThresholdAt=XX
24764
722a9603b237 8043633: In order to remove global state outside of contexts, make sure Timing class is an instance and not a static global collection of data. Move into Context. Move -Dnashorn.timing to an official logging option.
lagergren
parents: 24759
diff changeset
   110