# HG changeset patch # User lagergren # Date 1364283755 -3600 # Node ID 43e40c08e7f80d42a5bebb32392c9e2a537585cb # Parent 15dac7439921b336b8beb2c3cbe868030ccbb95b 8010706: -Dnashorn.args system property to create command lines to wrapped nashorn.jar:s Reviewed-by: hannesw, sundar diff -r 15dac7439921 -r 43e40c08e7f8 docs/DEVELOPER_README --- a/docs/DEVELOPER_README Mon Mar 25 18:20:16 2013 +0530 +++ b/docs/DEVELOPER_README Tue Mar 26 08:42:35 2013 +0100 @@ -13,6 +13,17 @@ This documentation of the system property flags assume that the default value of the flag is false, unless otherwise specified. +SYSTEM PROPERTY: -Dnashorn.args= + +This property takes as its value a space separated list of Nashorn +command line options that should be passed to Nashorn. This might be useful +in environments where it is hard to tell how a nashorn.jar is launched. + +Example: + +> java -Dnashorn.args="--lazy-complation --log=compiler" large-java-app-with-nashorn.jar +> ant -Dnashorn.args="--log=codegen" antjob + SYSTEM PROPERTY: -Dnashorn.unstable.relink.threshold=x This property controls how many call site misses are allowed before a diff -r 15dac7439921 -r 43e40c08e7f8 src/jdk/nashorn/internal/runtime/options/Options.java --- a/src/jdk/nashorn/internal/runtime/options/Options.java Mon Mar 25 18:20:16 2013 +0530 +++ b/src/jdk/nashorn/internal/runtime/options/Options.java Tue Mar 26 08:42:35 2013 +0100 @@ -66,6 +66,9 @@ /** The options map of enabled options */ private final TreeMap> options; + /** System property that can be used for command line option propagation */ + private static final String NASHORN_ARGS_PROPERTY = "nashorn.args"; + /** * Constructor * @@ -386,6 +389,14 @@ final LinkedList argList = new LinkedList<>(); Collections.addAll(argList, args); + final String extra = getStringProperty(NASHORN_ARGS_PROPERTY, null); + if (extra != null) { + final StringTokenizer st = new StringTokenizer(extra); + while (st.hasMoreTokens()) { + argList.add(st.nextToken()); + } + } + while (!argList.isEmpty()) { final String arg = argList.remove(0);