1 #!/bin/sh |
|
2 # |
|
3 # Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. |
|
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 # |
|
6 # This code is free software; you can redistribute it and/or modify it |
|
7 # under the terms of the GNU General Public License version 2 only, as |
|
8 # published by the Free Software Foundation. |
|
9 # |
|
10 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 # version 2 for more details (a copy is included in the LICENSE file that |
|
14 # accompanied this code). |
|
15 # |
|
16 # You should have received a copy of the GNU General Public License version |
|
17 # 2 along with this work; if not, write to the Free Software Foundation, |
|
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 # |
|
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 # or visit www.oracle.com if you need additional information or have any |
|
22 # questions. |
|
23 # |
|
24 |
|
25 ########################################################################################### |
|
26 # This is a helper script to evaluate nashorn with optimistic types |
|
27 # it produces a flight recording for every run, and uses the best |
|
28 # known flags for performance for the current configration |
|
29 ########################################################################################### |
|
30 |
|
31 # Flags to instrument lambdaform computation, caching, interpretation and compilation |
|
32 # Default compile threshold for lambdaforms is 30 |
|
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" |
|
34 |
|
35 |
|
36 # Flags to run trusted tests from the Nashorn test suite |
|
37 #FLAGS="-Djava.security.manager -Djava.security.policy=../build/nashorn.policy -Dnashorn.debug" |
|
38 |
|
39 |
|
40 # Unique timestamped file name for JFR recordings. For JFR, we also have to |
|
41 # crank up the stack cutoff depth to 1024, because of ridiculously long lambda form |
|
42 # stack traces. |
|
43 # |
|
44 # It is also recommended that you go into $JAVA_HOME/jre/lib/jfr/default.jfc and |
|
45 # set the "method-sampling-interval" Normal and Maximum sample time as low as you |
|
46 # can go (10 ms on most platforms). The default is normally higher. The increased |
|
47 # sampling overhead is usually negligible for Nashorn runs, but the data is better |
|
48 |
|
49 JFR_FILENAME="./nashorn_$(date|sed "s/ /_/g"|sed "s/:/_/g").jfr" |
|
50 |
|
51 |
|
52 # Directory where to look for nashorn.jar in a dist folder. The default is "..", assuming |
|
53 # that we run the script from the make dir |
|
54 DIR=.. |
|
55 NASHORN_JAR=$DIR/dist/nashorn.jar |
|
56 |
|
57 |
|
58 # The built Nashorn jar is placed first in the bootclasspath to override the JDK |
|
59 # nashorn.jar in $JAVA_HOME/jre/lib/ext. Thus, we also need -esa, as assertions in |
|
60 # nashorn count as system assertions in this configuration |
|
61 |
|
62 # Type profiling default level is 111, 222 adds some compile time, but is faster |
|
63 |
|
64 $JAVA_HOME/bin/java \ |
|
65 $FLAGS \ |
|
66 -ea \ |
|
67 -esa \ |
|
68 -Xbootclasspath/p:$NASHORN_JAR \ |
|
69 -Xms2G -Xmx2G \ |
|
70 -XX:TypeProfileLevel=222 \ |
|
71 -cp $CLASSPATH:../build/test/classes/ \ |
|
72 jdk.nashorn.tools.Shell ${@} |
|
73 |
|
74 # Below are flags that may come in handy, but aren't used for default runs |
|
75 |
|
76 # Testing out new code optimizations using the generic hotspot "new code" parameter |
|
77 #-XX:+UnlockDiagnosticVMOptions \ |
|
78 #-XX:+UseNewCode \ |
|
79 |
|
80 # Flight recorder |
|
81 #-XX:+UnlockCommercialFeatures \ |
|
82 #-XX:+FlightRecorder \ |
|
83 #-XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath=$JFR_FILENAME,stackdepth=1024 \ |
|
84 |
|
85 |
|
86 # Type specialization and math intrinsic replacement should be enabled by default in 8u20 and nine, |
|
87 # keeping this flag around for experimental reasons. Replace + with - to switch it off |
|
88 #-XX:+UseTypeSpeculation \ |
|
89 |
|
90 |
|
91 # Same with math intrinsics. They should be enabled by default in 8u20 and 9 |
|
92 #-XX:+UseMathExactIntrinsics \ |
|
93 |
|
94 |
|
95 # Add -Dnashorn.time to time the compilation phases. |
|
96 #-Dnashorn.time \ |
|
97 |
|
98 |
|
99 # Add ShowHiddenFrames to get lambda form internals on the stack traces |
|
100 #-XX:+ShowHiddenFrames \ |
|
101 |
|
102 |
|
103 # Add print optoassembly to get an asm dump. This requires 1) a debug build, not product, |
|
104 # That tired compilation is switched off, for C2 only output and that the number of |
|
105 # compiler threads is set to 1 for determinsm. |
|
106 #-XX:+PrintOptoAssembly -XX:-TieredCompilation -XX:CICompilerCount=1 \ |
|
107 |
|
108 # Tier compile threasholds. Default value is 10. (1-100 is useful for experiments) |
|
109 # -XX:IncreaseFirstTierCompileThresholdAt=XX |
|
110 |
|