nashorn/bin/runopt.sh
author lagergren
Wed, 21 May 2014 16:12:40 +0200
changeset 24764 722a9603b237
parent 24759 31aed7d9c02a
child 24766 7b54e2362c6c
permissions -rw-r--r--
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. Reviewed-by: sundar, attila
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     1
#!/bin/sh
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     2
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
     3
###########################################################################################
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
     4
# 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
     5
# 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
     6
# 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
     7
###########################################################################################
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
     8
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
     9
# 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
    10
# Default compile threshold for lambdaforms is 30
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    11
#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
    12
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    13
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    14
# 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
    15
#FLAGS="-Djava.security.manager -Djava.security.policy=../build/nashorn.policy -Dnashorn.debug"
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    16
24720
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 24719
diff changeset
    17
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    18
# 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
    19
# 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
    20
# 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
    21
#
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    22
# 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
    23
# 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
    24
# 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
    25
# sampling overhead is usually negligible for Nashorn runs, but the data is better
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    26
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
    27
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    28
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    29
# 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
    30
# 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
    31
DIR=..
24720
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 24719
diff changeset
    32
NASHORN_JAR=$DIR/dist/nashorn.jar
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    33
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
# 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
    36
# 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
    37
# 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
    38
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    39
# 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
    40
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    41
$JAVA_HOME/bin/java \
24720
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 24719
diff changeset
    42
$FLAGS \
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    43
-ea \
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    44
-esa \
24741
4232289c3235 8040102: Remove all references to Unsafe and definition of anonymous clases from the code
lagergren
parents: 24740
diff changeset
    45
-Xbootclasspath/p:$NASHORN_JAR \
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    46
-Xms2G -Xmx2G \
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    47
-XX:+UnlockCommercialFeatures \
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    48
-XX:+FlightRecorder \
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
-XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath=$JFR_FILENAME,stackdepth=1024 \
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    50
-XX:TypeProfileLevel=222 \
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    51
-cp $CLASSPATH:../build/test/classes/ \
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    52
jdk.nashorn.tools.Shell ${@}
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    53
24759
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    54
# 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
    55
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    56
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    57
# 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
    58
# 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
    59
#-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
    60
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
# 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
    63
#-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
    64
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    65
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    66
# 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
    67
#-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
    68
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    69
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    70
# Add ShowHiddenFrames to get lambda form internals on the stack traces
24720
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 24719
diff changeset
    71
#-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
    72
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    73
31aed7d9c02a 8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
lagergren
parents: 24745
diff changeset
    74
# 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
    75
# 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
    76
# 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
    77
#-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
    78
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
    79
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
    80
#[20/05/14 14:05:54] Albert Noll: IncreaseFirstTierCompileThresholdAt=XX
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
    81
#[20/05/14 14:06:03] Albert Noll: where X is between 1..100
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
    82
#[20/05/14 14:06:33] Albert Noll: The smaller X is, the less methods are being compiled with C1
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
    83
#[20/05/14 14:07:37] Albert Noll: You can also do more aggressive sweeping with:
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
    84
# NmethodSweepActivity=XX
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
    85
#[20/05/14 14:07:47] Albert Noll: The default value is 10