Path: blob/aarch64-shenandoah-jdk8u272-b10/nashorn/bin/runopt.sh
32281 views
#!/bin/sh1#2# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4#5# This code is free software; you can redistribute it and/or modify it6# under the terms of the GNU General Public License version 2 only, as7# published by the Free Software Foundation.8#9# This code is distributed in the hope that it will be useful, but WITHOUT10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12# version 2 for more details (a copy is included in the LICENSE file that13# accompanied this code).14#15# You should have received a copy of the GNU General Public License version16# 2 along with this work; if not, write to the Free Software Foundation,17# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18#19# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20# or visit www.oracle.com if you need additional information or have any21# questions.22#2324###########################################################################################25# This is a helper script to evaluate nashorn with optimistic types26# it produces a flight recording for every run, and uses the best27# known flags for performance for the current configration28###########################################################################################2930# Flags to enable assertions, we need the system assertions too, since31# this script runs Nashorn in the BCP to override any nashorn.jar that might32# reside in your $JAVA_HOME/jre/lib/ext/nashorn.jar33#34ENABLE_ASSERTIONS_FLAGS="-ea -esa"3536# Flags to instrument lambdaform computation, caching, interpretation and compilation37# Default compile threshold for lambdaforms is 3038#39#LAMBDAFORM_FLAGS="\40# -Djava.lang.invoke.MethodHandle.COMPILE_THRESHOLD=3 \41# -Djava.lang.invoke.MethodHandle.DUMP_CLASS_FILES=true \42# -Djava.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE=true \43# -Djava.lang.invoke.MethodHandle.TRACE_INTERPRETER=true"4445# Flags to run trusted tests from the Nashorn test suite46#47#TRUSTED_TEST_FLAGS="\48#-Djava.security.manager \49#-Djava.security.policy=../build/nashorn.policy -Dnashorn.debug"5051# Testing out new code optimizations using the generic hotspot "new code" parameter52#53#USE_NEW_CODE_FLAGS=-XX:+UnlockDiagnosticVMOptions -XX:+UseNewCode5455#56#-Dnashorn.typeInfo.disabled=false \57# and for Nashorn options:58# --class-cache-size=0 --persistent-code-cache=false5960# Unique timestamped file name for JFR recordings. For JFR, we also have to61# crank up the stack cutoff depth to 1024, because of ridiculously long lambda form62# stack traces.63#64# It is also recommended that you go into $JAVA_HOME/jre/lib/jfr/default.jfc and65# set the "method-sampling-interval" Normal and Maximum sample time as low as you66# can go (10 ms on most platforms). The default is normally higher. The increased67# sampling overhead is usually negligible for Nashorn runs, but the data is better6869if [ -z $JFR_FILENAME ]; then70JFR_FILENAME="./nashorn_$(date|sed "s/ /_/g"|sed "s/:/_/g").jfr"71fi7273# Flight recorder74#75# see above - already in place, copy the flags down here to disable76ENABLE_FLIGHT_RECORDER_FLAGS="\77-XX:+UnlockCommercialFeatures \78-XX:+FlightRecorder \79-XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath=$JFR_FILENAME,stackdepth=1024"8081# Type specialization and math intrinsic replacement should be enabled by default in 8u20 and nine,82# keeping this flag around for experimental reasons. Replace + with - to switch it off83#84#ENABLE_TYPE_SPECIALIZATION_FLAGS=-XX:+UseTypeSpeculation8586# Same with math intrinsics. They should be enabled by default in 8u20 and 9, so87# this disables them if needed88#89#DISABLE_MATH_INTRINSICS_FLAGS=-XX:-UseMathExactIntrinsics9091# Add timing to time the compilation phases.92#ENABLE_TIME_FLAGS=--log=time9394# Add ShowHiddenFrames to get lambda form internals on the stack traces95#ENABLE_SHOW_HIDDEN_FRAMES_FLAGS=-XX:+ShowHiddenFrames9697# Add print optoassembly to get an asm dump. This requires 1) a debug build, not product,98# That tired compilation is switched off, for C2 only output and that the number of99# compiler threads is set to 1 for determinsm.100#101#PRINT_ASM_FLAGS=-XX:+PrintOptoAssembly -XX:-TieredCompilation -XX:CICompilerCount=1 \102103# Tier compile threasholds. Default value is 10. (1-100 is useful for experiments)104#TIER_COMPILATION_THRESHOLD_FLAGS=-XX:IncreaseFirstTierCompileThresholdAt=10105106# Directory where to look for nashorn.jar in a dist folder. The default is "..", assuming107# that we run the script from the make dir108DIR=..109NASHORN_JAR=$DIR/dist/nashorn.jar110111112# The built Nashorn jar is placed first in the bootclasspath to override the JDK113# nashorn.jar in $JAVA_HOME/jre/lib/ext. Thus, we also need -esa, as assertions in114# nashorn count as system assertions in this configuration115116# Type profiling default level is 111, 222 adds some compile time, but is faster117118$JAVA_HOME/bin/java \119$ENABLE_ASSERTIONS_FLAGS \120$LAMBDAFORM_FLAGS \121$TRUSTED_FLAGS \122$USE_NEW_CODE_FLAGS \123$ENABLE_SHOW_HIDDEN_FRAMES_FLAGS \124$ENABLE_FLIGHT_RECORDER_FLAGS \125$ENABLE_TYPE_SPECIALIZATION_FLAGS \126$TIERED_COMPILATION_THRESOLD_FLAGS \127$DISABLE_MATH_INTRINSICS_FLAGS \128$PRINT_ASM_FLAGS \129-Xbootclasspath/p:$NASHORN_JAR \130-Xms2G -Xmx2G \131-XX:TypeProfileLevel=222 \132-cp $CLASSPATH:../build/test/classes/ \133jdk.nashorn.tools.Shell $ENABLE_TIME_FLAGS ${@}134135136137138