docs/DEVELOPER_README

Wed, 03 Jul 2019 20:04:13 +0800

author
aoqi
date
Wed, 03 Jul 2019 20:04:13 +0800
changeset 2452
03e581dea892
parent 1490
d85f981c8cf8
permissions
-rw-r--r--

Added tag mips64el-jdk8u202-b10 for changeset 9147f0e1d3a7

aoqi@0 1 This document describes system properties that are used for internal
aoqi@0 2 debugging and instrumentation purposes, along with the system loggers,
aoqi@0 3 which are used for the same thing.
aoqi@0 4
aoqi@0 5 This document is intended as a developer resource, and it is not
aoqi@0 6 needed as Nashorn documentation for normal usage. Flags and system
aoqi@0 7 properties described herein are subject to change without notice.
aoqi@0 8
aoqi@0 9 =====================================
aoqi@0 10 1. System properties used internally
aoqi@0 11 =====================================
aoqi@0 12
aoqi@0 13 This documentation of the system property flags assume that the
aoqi@0 14 default value of the flag is false, unless otherwise specified.
aoqi@0 15
aoqi@0 16 SYSTEM PROPERTY: -Dnashorn.args=<string>
aoqi@0 17
aoqi@0 18 This property takes as its value a space separated list of Nashorn
aoqi@0 19 command line options that should be passed to Nashorn. This might be
aoqi@0 20 useful in environments where it is hard to tell how a nashorn.jar is
aoqi@0 21 launched.
aoqi@0 22
aoqi@0 23 Example:
aoqi@0 24
aoqi@0 25 > java -Dnashorn.args="--lazy-complation --log=compiler" large-java-app-with-nashorn.jar
aoqi@0 26 > ant -Dnashorn.args="--log=codegen" antjob
aoqi@0 27
hannesw@1068 28 SYSTEM PROPERTY: -Dnashorn.args.prepend=<string>
hannesw@1068 29
hannesw@1068 30 This property behaves like nashorn.args, but adds the given arguments
hannesw@1068 31 before the existing ones instead of after them. Later arguments will
hannesw@1068 32 overwrite earlier ones, so this is useful for setting default arguments
hannesw@1068 33 that can be overwritten.
hannesw@1068 34
hannesw@1068 35
aoqi@0 36 SYSTEM PROPERTY: -Dnashorn.unstable.relink.threshold=x
aoqi@0 37
aoqi@0 38 This property controls how many call site misses are allowed before a
aoqi@0 39 callsite is relinked with "apply" semantics to never change again.
aoqi@0 40 In the case of megamorphic callsites, this is necessary, or the
aoqi@0 41 program would spend all its time swapping out callsite targets. Dynalink
aoqi@0 42 has a default value (currently 8 relinks) for this property if it
aoqi@0 43 is not explicitly set.
aoqi@0 44
aoqi@0 45
aoqi@0 46 SYSTEM PROPERTY: -Dnashorn.compiler.splitter.threshold=x
aoqi@0 47
aoqi@0 48 This will change the node weight that requires a subgraph of the IR to
aoqi@0 49 be split into several classes in order not to run out of bytecode space.
aoqi@0 50 The default value is 0x8000 (32768).
aoqi@0 51
aoqi@0 52
hannesw@1068 53 SYSTEM PROPERTY: -Dnashorn.serialize.compression=<x>
aoqi@0 54
hannesw@1068 55 This property sets the compression level used when deflating serialized
hannesw@1068 56 AST structures of anonymous split functions. Valid values range from 0 to 9,
hannesw@1068 57 the default value is 4. Higher values will reduce memory size of serialized
hannesw@1068 58 AST but increase CPU usage required for compression.
aoqi@0 59
aoqi@0 60
hannesw@1068 61 SYSTEM PROPERTY: -Dnashorn.codegen.debug.trace=<x>
aoqi@0 62
aoqi@0 63 See the description of the codegen logger below.
aoqi@0 64
aoqi@0 65
hannesw@1330 66 SYSTEM PROPERTY: -Dnashorn.fields.objects, -Dnashorn.fields.dual
aoqi@0 67
hannesw@1330 68 When the nashorn.fields.objects property is true, Nashorn will always
hannesw@1330 69 use object fields for AccessorProperties, requiring boxing for all
hannesw@1330 70 primitive property values. When nashorn.fields.dual is set, Nashorn
hannesw@1330 71 will always use dual long/object fields, which allows primitives to be
hannesw@1330 72 stored without boxing. When neither system property is set, Nashorn
hannesw@1330 73 chooses a setting depending on the optimistic types setting (dual
hannesw@1330 74 fields when optimistic types are enabled, object-only fields otherwise).
aoqi@0 75
hannesw@1330 76 With dual fields, Nashorn uses long fields to store primitive values.
hannesw@1330 77 Ints are represented as the 32 low bits of the long fields. Doubles
hannesw@1330 78 are represented as the doubleToLongBits of their value. This way a
hannesw@1068 79 single field can be used for all primitive types. Packing and
hannesw@1068 80 unpacking doubles to their bit representation is intrinsified by
hannesw@1068 81 the JVM and extremely fast.
aoqi@0 82
aoqi@0 83 In the future, this might complement or be replaced by experimental
aoqi@0 84 feature sun.misc.TaggedArray, which has been discussed on the mlvm
aoqi@0 85 mailing list. TaggedArrays are basically a way to share data space
aoqi@0 86 between primitives and references, and have the GC understand this.
aoqi@0 87
aoqi@0 88
aoqi@0 89 SYSTEM PROPERTY: -Dnashorn.compiler.symbol.trace=[<x>[,*]],
aoqi@0 90 -Dnashorn.compiler.symbol.stacktrace=[<x>[,*]]
aoqi@0 91
aoqi@0 92 When this property is set, creation and manipulation of any symbol
aoqi@0 93 named "x" will show information about when the compiler changes its
aoqi@0 94 type assumption, bytecode local variable slot assignment and other
aoqi@0 95 data. This is useful if, for example, a symbol shows up as an Object,
aoqi@0 96 when you believe it should be a primitive. Usually there is an
aoqi@0 97 explanation for this, for example that it exists in the global scope
aoqi@0 98 and type analysis has to be more conservative.
aoqi@0 99
aoqi@0 100 Several symbols names to watch can be specified by comma separation.
aoqi@0 101
aoqi@0 102 If no variable name is specified (and no equals sign), all symbols
aoqi@0 103 will be watched
aoqi@0 104
aoqi@0 105 By using "stacktrace" instead of or together with "trace", stack
aoqi@0 106 traces will be displayed upon symbol changes according to the same
aoqi@0 107 semantics.
aoqi@0 108
aoqi@0 109
aoqi@0 110 SYSTEM PROPERTY: -Dnashorn.lexer.xmlliterals
aoqi@0 111
aoqi@0 112 If this property it set, it means that the Lexer should attempt to
aoqi@0 113 parse XML literals, which would otherwise generate syntax
aoqi@0 114 errors. Warning: there are currently no unit tests for this
aoqi@0 115 functionality.
aoqi@0 116
aoqi@0 117 XML literals, when this is enabled, end up as standard LiteralNodes in
aoqi@0 118 the IR.
aoqi@0 119
aoqi@0 120
aoqi@0 121 SYSTEM_PROPERTY: -Dnashorn.debug
aoqi@0 122
aoqi@0 123 If this property is set to true, Nashorn runs in Debug mode. Debug
aoqi@0 124 mode is slightly slower, as for example statistics counters are enabled
aoqi@0 125 during the run. Debug mode makes available a NativeDebug instance
aoqi@0 126 called "Debug" in the global space that can be used to print property
aoqi@0 127 maps and layout for script objects, as well as a "dumpCounters" method
aoqi@0 128 that will print the current values of the previously mentioned stats
aoqi@0 129 counters.
aoqi@0 130
aoqi@0 131 These functions currently exists for Debug:
aoqi@0 132
aoqi@0 133 "map" - print(Debug.map(x)) will dump the PropertyMap for object x to
aoqi@0 134 stdout (currently there also exist functions called "embedX", where X
aoqi@0 135 is a value from 0 to 3, that will dump the contents of the embed pool
aoqi@0 136 for the first spill properties in any script object and "spill", that
aoqi@0 137 will dump the contents of the growing spill pool of spill properties
aoqi@0 138 in any script object. This is of course subject to change without
aoqi@0 139 notice, should we change the script object layout.
aoqi@0 140
aoqi@0 141 "methodHandle" - this method returns the method handle that is used
aoqi@0 142 for invoking a particular script function.
aoqi@0 143
aoqi@0 144 "identical" - this method compares two script objects for reference
aoqi@0 145 equality. It is a == Java comparison
aoqi@0 146
hannesw@1068 147 "equals" - Returns true if two objects are either referentially
hannesw@1068 148 identical or equal as defined by java.lang.Object.equals.
hannesw@1068 149
aoqi@0 150 "dumpCounters" - will dump the debug counters' current values to
aoqi@0 151 stdout.
aoqi@0 152
aoqi@0 153 Currently we count number of ScriptObjects in the system, number of
aoqi@0 154 Scope objects in the system, number of ScriptObject listeners added,
aoqi@0 155 removed and dead (without references).
aoqi@0 156
aoqi@0 157 We also count number of ScriptFunctions, ScriptFunction invocations
aoqi@0 158 and ScriptFunction allocations.
aoqi@0 159
aoqi@0 160 Furthermore we count PropertyMap statistics: how many property maps
aoqi@0 161 exist, how many times were property maps cloned, how many times did
aoqi@0 162 the property map history cache hit, prevent new allocations, how many
aoqi@0 163 prototype invalidations were done, how many time the property map
aoqi@0 164 proto cache hit.
aoqi@0 165
aoqi@0 166 Finally we count callsite misses on a per callsite bases, which occur
aoqi@0 167 when a callsite has to be relinked, due to a previous assumption of
aoqi@0 168 object layout being invalidated.
aoqi@0 169
hannesw@1068 170 "getContext" - return the current Nashorn context.
aoqi@0 171
hannesw@1068 172 "equalWithoutType" - Returns true if if the two objects are both
hannesw@1068 173 property maps, and they have identical properties in the same order,
hannesw@1068 174 but allows the properties to differ in their types.
aoqi@0 175
hannesw@1068 176 "diffPropertyMaps" Returns a diagnostic string representing the difference
hannesw@1068 177 of two property maps.
aoqi@0 178
hannesw@1068 179 "getClass" - Returns the Java class of an object, or undefined if null.
hannesw@1068 180
hannesw@1068 181 "toJavaString" - Returns the Java toString representation of an object.
hannesw@1068 182
hannesw@1068 183 "toIdentString" - Returns a string representation of an object consisting
hannesw@1068 184 of its java class name and hash code.
hannesw@1068 185
hannesw@1068 186 "getListenerCount" - Return the number of property listeners for a
hannesw@1068 187 script object.
hannesw@1068 188
hannesw@1068 189 "getEventQueueCapacity" - Get the capacity of the event queue.
hannesw@1068 190
hannesw@1068 191 "setEventQueueCapacity" - Set the event queue capacity.
hannesw@1068 192
hannesw@1068 193 "addRuntimeEvent" - Add a runtime event to the runtime event queue.
hannesw@1068 194 The queue has a fixed size (see -Dnashorn.runtime.event.queue.size)
hannesw@1068 195 and the oldest entry will be thrown out of the queue is about to overflow.
hannesw@1068 196
hannesw@1068 197 "expandEventQueueCapacity" - Expands the event queue capacity,
hannesw@1068 198 or truncates if capacity is lower than current capacity. Then only
hannesw@1068 199 the newest entries are kept.
hannesw@1068 200
hannesw@1068 201 "clearRuntimeEvents" - Clear the runtime event queue.
hannesw@1068 202
hannesw@1068 203 "removeRuntimeEvent" - Remove a specific runtime event from the event queue.
hannesw@1068 204
hannesw@1068 205 "getRuntimeEvents" - Return all runtime events in the queue as an array.
hannesw@1068 206
hannesw@1068 207 "getLastRuntimeEvent" - Return the last runtime event in the queue.
aoqi@0 208
aoqi@0 209
aoqi@0 210 SYSTEM PROPERTY: -Dnashorn.methodhandles.debug.stacktrace
aoqi@0 211
hannesw@1068 212 This enhances methodhandles logging (see below) to also dump the
hannesw@1068 213 stack trace for every instrumented method handle operation.
hannesw@1068 214 Warning: This is enormously verbose, but provides a pretty
aoqi@0 215 decent "grep:able" picture of where the calls are coming from.
aoqi@0 216
aoqi@0 217
hannesw@1068 218 SYSTEM PROPERTY: -Dnashorn.cce
aoqi@0 219
hannesw@1068 220 Setting this system property causes the Nashorn linker to rely on
hannesw@1068 221 ClassCastExceptions for triggering a callsite relink. If not set, the linker
hannesw@1068 222 will add an explicit instanceof guard.
aoqi@0 223
aoqi@0 224
hannesw@1068 225 SYSTEM PROPERTY: -Dnashorn.spill.threshold=<x>
aoqi@0 226
hannesw@1068 227 This property sets the number of fields in an object from which to use
hannesw@1068 228 generic array based spill storage instead of Java fields. The default value
hannesw@1068 229 is 256.
aoqi@0 230
aoqi@0 231
aoqi@0 232 SYSTEM PROPERTY: -Dnashorn.tcs.miss.samplePercent=<x>
aoqi@0 233
aoqi@0 234 When running with the trace callsite option (-tcs), Nashorn will count
aoqi@0 235 and instrument any callsite misses that require relinking. As the
aoqi@0 236 number of relinks is large and usually produces a lot of output, this
aoqi@0 237 system property can be used to constrain the percentage of misses that
aoqi@0 238 should be logged. Typically this is set to 1 or 5 (percent). 1% is the
aoqi@0 239 default value.
aoqi@0 240
hannesw@1068 241 SYSTEM PROPERTY: -Dnashorn.persistent.code.cache
aoqi@0 242
hannesw@1068 243 This property can be used to set the directory where Nashorn stores
hannesw@1068 244 serialized script classes generated with the -pcc/--persistent-code-cache
hannesw@1068 245 option. The default directory name is "nashorn_code_cache".
hannesw@1068 246
hannesw@1068 247
hannesw@1068 248 SYSTEM PROPERTY: -Dnashorn.typeInfo.maxFiles
hannesw@1068 249
hannesw@1068 250 Maximum number of files to store in the type info cache. The type info cache
hannesw@1068 251 is used to cache type data of JavaScript functions when running with
hannesw@1068 252 optimistic types (-ot/--optimistic-types). There is one file per JavaScript
hannesw@1068 253 function in the cache.
hannesw@1068 254
hannesw@1068 255 The default value is 0 which means the feature is disabled. Setting this
hannesw@1068 256 to something like 20000 is probably good enough for most applications and
hannesw@1068 257 will usually cap the cache directory to about 80MB presuming a 4kB
hannesw@1068 258 filesystem allocation unit. Set this to "unlimited" to run without limit.
hannesw@1068 259
hannesw@1068 260 If the value is not 0 or "unlimited", Nashorn will spawn a cleanup thread
hannesw@1068 261 that makes sure the number of files in the cache does not exceed the given
hannesw@1068 262 value by deleting the least recently modified files.
hannesw@1068 263
hannesw@1068 264
hannesw@1068 265 SYSTEM PROPERTY: -Dnashorn.typeInfo.cacheDir
hannesw@1068 266
hannesw@1068 267 This property can be used to set the directory where Nashorn stores the
hannesw@1068 268 type info cache when -Dnashorn.typeInfo.maxFiles is set to a nonzero
hannesw@1068 269 value. The default location is platform specific. On Windows, it is
hannesw@1068 270 "${java.io.tmpdir}\com.oracle.java.NashornTypeInfo". On Linux and
hannesw@1068 271 Solaris it is "~/.cache/com.oracle.java.NashornTypeInfo". On Mac OS X,
hannesw@1068 272 it is "~/Library/Caches/com.oracle.java.NashornTypeInfo".
hannesw@1068 273
hannesw@1068 274
hannesw@1068 275 SYSTEM PROPERTY: -Dnashorn.typeInfo.cleanupDelaySeconds=<value>
hannesw@1068 276
hannesw@1068 277 This sets the delay between cleanups of the typeInfo cache, in seconds.
hannesw@1068 278 The default delay is 20 seconds.
hannesw@1068 279
hannesw@1068 280
hannesw@1068 281 SYSTEM PROPERTY: -Dnashorn.profilefile=<filename>
aoqi@0 282
aoqi@0 283 When running with the profile callsite options (-pcs), Nashorn will
aoqi@0 284 dump profiling data for all callsites to stderr as a shutdown hook. To
aoqi@0 285 instead redirect this to a file, specify the path to the file using
aoqi@0 286 this system property.
aoqi@0 287
aoqi@0 288
aoqi@0 289 SYSTEM_PROPERTY: -Dnashorn.regexp.impl=[jdk|joni]
aoqi@0 290
aoqi@0 291 This property defines the regular expression engine to be used by
aoqi@0 292 Nashorn. Set this flag to "jdk" to get an implementation based on the
aoqi@0 293 JDK's java.util.regex package. Set this property to "joni" to install
aoqi@0 294 an implementation based on Joni, the regular expression engine used by
aoqi@0 295 the JRuby project. The default value for this flag is "joni"
aoqi@0 296
hannesw@1068 297 SYSTEM PROPERTY: -Dnashorn.runtime.event.queue.size=<value>
aoqi@0 298
hannesw@1068 299 Nashorn provides a fixed sized runtime event queue for debugging purposes.
hannesw@1068 300 See -Dnashorn.debug for methods to access the event queue.
hannesw@1068 301 The default value is 1024.
aoqi@0 302
aoqi@0 303 ===============
aoqi@0 304 2. The loggers.
aoqi@0 305 ===============
aoqi@0 306
aoqi@0 307 It is very simple to create your own logger. Use the DebugLogger class
aoqi@0 308 and give the subsystem name as a constructor argument.
aoqi@0 309
aoqi@0 310 The Nashorn loggers can be used to print per-module or per-subsystem
aoqi@0 311 debug information with different levels of verbosity. The loggers for
aoqi@0 312 a given subsystem are available are enabled by using
aoqi@0 313
aoqi@0 314 --log=<systemname>[:<level>]
aoqi@0 315
aoqi@0 316 on the command line.
aoqi@0 317
aoqi@0 318 Here <systemname> identifies the name of the subsystem to be logged
aoqi@0 319 and the optional colon and level argument is a standard
aoqi@0 320 java.util.logging.Level name (severe, warning, info, config, fine,
aoqi@0 321 finer, finest). If the level is left out for a particular subsystem,
aoqi@0 322 it defaults to "info". Any log message logged as the level or a level
aoqi@0 323 that is more important will be output to stderr by the logger.
aoqi@0 324
aoqi@0 325 Several loggers can be enabled by a single command line option, by
aoqi@0 326 putting a comma after each subsystem/level tuple (or each subsystem if
aoqi@0 327 level is unspecified). The --log option can also be given multiple
aoqi@0 328 times on the same command line, with the same effect.
aoqi@0 329
aoqi@0 330 For example: --log=codegen,fields:finest is equivalent to
aoqi@0 331 --log=codegen:info --log=fields:finest
aoqi@0 332
hannesw@1068 333 The following is an incomplete list of subsystems that currently
hannesw@1068 334 support logging. Look for classes implementing
hannesw@1068 335 jdk.nashorn.internal.runtime.logging.Loggable for more loggers.
aoqi@0 336
aoqi@0 337
aoqi@0 338 * compiler
aoqi@0 339
aoqi@0 340 The compiler is in charge of turning source code and function nodes
aoqi@0 341 into byte code, and installs the classes into a class loader
aoqi@0 342 controlled from the Context. Log messages are, for example, about
aoqi@0 343 things like new compile units being allocated. The compiler has global
aoqi@0 344 settings that all the tiers of codegen (e.g. Lower and CodeGenerator)
aoqi@0 345 use.s
aoqi@0 346
aoqi@0 347
hannesw@1068 348 * recompile
hannesw@1068 349
hannesw@1068 350 This logger shows information about recompilation of scripts and
hannesw@1068 351 functions at runtime. Recompilation may happen because a function
hannesw@1068 352 was called with different parameter types, or because an optimistic
hannesw@1068 353 assumption failed while executing a function with -ot/--optimistic-types.
hannesw@1068 354
hannesw@1068 355
aoqi@0 356 * codegen
aoqi@0 357
aoqi@0 358 The code generator is the emitter stage of the code pipeline, and
aoqi@0 359 turns the lowest tier of a FunctionNode into bytecode. Codegen logging
aoqi@0 360 shows byte codes as they are being emitted, line number information
aoqi@0 361 and jumps. It also shows the contents of the bytecode stack prior to
aoqi@0 362 each instruction being emitted. This is a good debugging aid. For
aoqi@0 363 example:
aoqi@0 364
aoqi@0 365 [codegen] #41 line:2 (f)_afc824e
aoqi@0 366 [codegen] #42 load symbol x slot=2
aoqi@0 367 [codegen] #43 {1:O} load int 0
aoqi@0 368 [codegen] #44 {2:I O} dynamic_runtime_call GT:ZOI_I args=2 returnType=boolean
aoqi@0 369 [codegen] #45 signature (Ljava/lang/Object;I)Z
aoqi@0 370 [codegen] #46 {1:Z} ifeq ternary_false_5402fe28
aoqi@0 371 [codegen] #47 load symbol x slot=2
aoqi@0 372 [codegen] #48 {1:O} goto ternary_exit_107c1f2f
aoqi@0 373 [codegen] #49 ternary_false_5402fe28
aoqi@0 374 [codegen] #50 load symbol x slot=2
aoqi@0 375 [codegen] #51 {1:O} convert object -> double
aoqi@0 376 [codegen] #52 {1:D} neg
aoqi@0 377 [codegen] #53 {1:D} convert double -> object
aoqi@0 378 [codegen] #54 {1:O} ternary_exit_107c1f2f
aoqi@0 379 [codegen] #55 {1:O} return object
aoqi@0 380
aoqi@0 381 shows a ternary node being generated for the sequence "return x > 0 ?
aoqi@0 382 x : -x"
aoqi@0 383
aoqi@0 384 The first number on the log line is a unique monotonically increasing
aoqi@0 385 emission id per bytecode. There is no guarantee this is the same id
aoqi@0 386 between runs. depending on non deterministic code
aoqi@0 387 execution/compilation, but for small applications it usually is. If
aoqi@0 388 the system variable -Dnashorn.codegen.debug.trace=<x> is set, where x
aoqi@0 389 is a bytecode emission id, a stack trace will be shown as the
aoqi@0 390 particular bytecode is about to be emitted. This can be a quick way to
aoqi@0 391 determine where it comes from without attaching the debugger. "Who
aoqi@0 392 generated that neg?"
aoqi@0 393
aoqi@0 394 The --log=codegen option is equivalent to setting the system variable
aoqi@0 395 "nashorn.codegen.debug" to true.
aoqi@0 396
aoqi@0 397 * fold
aoqi@0 398
aoqi@0 399 Shows constant folding taking place before lowering
aoqi@0 400
aoqi@0 401 * lower
aoqi@0 402
aoqi@0 403 This is the first lowering pass.
aoqi@0 404
aoqi@0 405 Lower is a code generation pass that turns high level IR nodes into
aoqi@0 406 lower level one, for example substituting comparisons to RuntimeNodes
aoqi@0 407 and inlining finally blocks.
aoqi@0 408
aoqi@0 409 Lower is also responsible for determining control flow information
aoqi@0 410 like end points.
aoqi@0 411
hannesw@1068 412 * symbols
aoqi@0 413
hannesw@1068 414 The symbols logger tracks the assignment os symbols to identifiers.
aoqi@0 415
hannesw@1068 416 * scopedepths
aoqi@0 417
hannesw@1068 418 This logs the calculation of scope depths for non-local symbols.
aoqi@0 419
aoqi@0 420 * fields
aoqi@0 421
aoqi@0 422 The --log=fields option (at info level) is equivalent to setting the
aoqi@0 423 system variable "nashorn.fields.debug" to true. At the info level it
aoqi@0 424 will only show info about type assumptions that were invalidated. If
aoqi@0 425 the level is set to finest, it will also trace every AccessorProperty
aoqi@0 426 getter and setter in the program, show arguments, return values
aoqi@0 427 etc. It will also show the internal representation of respective field
aoqi@0 428 (Object in the normal case, unless running with the dual field
aoqi@0 429 representation)
aoqi@0 430
attila@963 431 * time
attila@963 432
attila@963 433 This enables timers for various phases of script compilation. The timers
attila@963 434 will be dumped when the Nashorn process exits. We see a percentage value
attila@963 435 of how much time was spent not executing bytecode (i.e. compilation and
attila@963 436 internal tasks) at the end of the report.
attila@963 437
attila@963 438 A finer level than "info" will show individual compilation timings as they
attila@963 439 happen.
attila@963 440
attila@963 441 Here is an example:
attila@963 442
attila@963 443 [time] Accumulated complation phase Timings:
attila@963 444 [time]
attila@963 445 [time] 'JavaScript Parsing' 1076 ms
attila@963 446 [time] 'Constant Folding' 159 ms
attila@963 447 [time] 'Control Flow Lowering' 303 ms
attila@963 448 [time] 'Program Point Calculation' 282 ms
attila@963 449 [time] 'Builtin Replacement' 71 ms
attila@963 450 [time] 'Code Splitting' 670 ms
attila@963 451 [time] 'Symbol Assignment' 474 ms
attila@963 452 [time] 'Scope Depth Computation' 249 ms
attila@963 453 [time] 'Optimistic Type Assignment' 186 ms
attila@963 454 [time] 'Local Variable Type Calculation' 526 ms
attila@963 455 [time] 'Bytecode Generation' 5177 ms
attila@963 456 [time] 'Class Installation' 1854 ms
attila@963 457 [time]
attila@963 458 [time] Total runtime: 11994 ms (Non-runtime: 11027 ms [91%])
lagergren@526 459
hannesw@1068 460 * methodhandles
hannesw@1068 461
hannesw@1068 462 If this logger is enabled, each MethodHandle related call that uses
hannesw@1068 463 the java.lang.invoke package gets its MethodHandle intercepted and an
hannesw@1068 464 instrumentation printout of arguments and return value appended to
hannesw@1068 465 it. This shows exactly which method handles are executed and from
hannesw@1068 466 where. (Also MethodTypes and SwitchPoints).
hannesw@1068 467
hannesw@1068 468 * classcache
hannesw@1068 469
hannesw@1068 470 This logger shows information about reusing code classes using the
hannesw@1068 471 in-memory class cache. Nashorn will try to avoid compilation of
hannesw@1068 472 scripts by using existing classes. This can significantly improve
hannesw@1068 473 performance when repeatedly evaluating the same script.
aoqi@0 474
aoqi@0 475 =======================
aoqi@0 476 3. Undocumented options
aoqi@0 477 =======================
aoqi@0 478
aoqi@0 479 Here follows a short description of undocumented options for Nashorn.
aoqi@0 480 To see a list of all undocumented options, use the (undocumented) flag
aoqi@0 481 "-xhelp".
aoqi@0 482
aoqi@0 483 i.e. jjs -xhelp or java -jar nashorn.jar -xhelp
aoqi@0 484
aoqi@0 485 Undocumented options are not guaranteed to work, run correctly or be
aoqi@0 486 bug free. They are experimental and for internal or debugging use.
aoqi@0 487 They are also subject to change without notice.
aoqi@0 488
aoqi@0 489 In practice, though, all options below not explicitly documented as
aoqi@0 490 EXPERIMENTAL can be relied upon, for example --dump-on-error is useful
aoqi@0 491 for any JavaScript/Nashorn developer, but there is no guarantee.
aoqi@0 492
aoqi@0 493 A short summary follows:
aoqi@0 494
aoqi@0 495 -D (-Dname=value. Set a system property. This option can be repeated.)
aoqi@0 496
aoqi@0 497 -ccs, --class-cache-size (Size of the Class cache size per global scope.)
aoqi@0 498
aoqi@0 499 -cp, -classpath (-cp path. Specify where to find user class files.)
aoqi@0 500
attila@963 501 -co, --compile-only (Compile without running.)
aoqi@0 502 param: [true|false] default: false
aoqi@0 503
attila@963 504 -d, --dump-debug-dir (specify a destination directory to dump class files.)
aoqi@0 505 param: <path>
aoqi@0 506
aoqi@0 507 --debug-lines (Generate line number table in .class files.)
aoqi@0 508 param: [true|false] default: true
aoqi@0 509
aoqi@0 510 --debug-locals (Generate local variable table in .class files.)
aoqi@0 511 param: [true|false] default: false
aoqi@0 512
aoqi@0 513 -doe, -dump-on-error (Dump a stack trace on errors.)
aoqi@0 514 param: [true|false] default: false
aoqi@0 515
aoqi@0 516 --early-lvalue-error (invalid lvalue expressions should be reported as early errors.)
aoqi@0 517 param: [true|false] default: true
aoqi@0 518
aoqi@0 519 --empty-statements (Preserve empty statements in AST.)
aoqi@0 520 param: [true|false] default: false
aoqi@0 521
aoqi@0 522 -fv, -fullversion (Print full version info of Nashorn.)
aoqi@0 523 param: [true|false] default: false
aoqi@0 524
aoqi@0 525 --function-statement-error (Report an error when function declaration is used as a statement.)
aoqi@0 526 param: [true|false] default: false
aoqi@0 527
aoqi@0 528 --function-statement-warning (Warn when function declaration is used as a statement.)
aoqi@0 529 param: [true|false] default: false
aoqi@0 530
aoqi@0 531 -fx (Launch script as an fx application.)
aoqi@0 532 param: [true|false] default: false
aoqi@0 533
aoqi@0 534 --global-per-engine (Use single Global instance per script engine instance.)
aoqi@0 535 param: [true|false] default: false
aoqi@0 536
aoqi@0 537 -h, -help (Print help for command line flags.)
aoqi@0 538 param: [true|false] default: false
aoqi@0 539
aoqi@0 540 --loader-per-compile (Create a new class loader per compile.)
aoqi@0 541 param: [true|false] default: true
aoqi@0 542
aoqi@0 543 -l, --locale (Set Locale for script execution.)
aoqi@0 544 param: <locale> default: en-US
aoqi@0 545
aoqi@0 546 --log (Enable logging of a given level for a given number of sub systems.
attila@963 547 [for example: --log=fields:finest,codegen:info].)
aoqi@0 548 param: <module:level>,*
aoqi@0 549
attila@963 550 -nj, --no-java (Disable Java support.)
aoqi@0 551 param: [true|false] default: false
aoqi@0 552
attila@963 553 -nse, --no-syntax-extensions (Disallow non-standard syntax extensions.)
aoqi@0 554 param: [true|false] default: false
aoqi@0 555
attila@963 556 -nta, --no-typed-arrays (Disable typed arrays support.)
aoqi@0 557 param: [true|false] default: false
aoqi@0 558
aoqi@0 559 --parse-only (Parse without compiling.)
aoqi@0 560 param: [true|false] default: false
aoqi@0 561
aoqi@0 562 --print-ast (Print abstract syntax tree.)
aoqi@0 563 param: [true|false] default: false
aoqi@0 564
attila@963 565 -pc, --print-code (Print generated bytecode. If a directory is specified, nothing will
attila@963 566 be dumped to stderr. Also, in that case, .dot files will be generated
attila@963 567 for all functions or for the function with the specified name only.)
attila@963 568 param: [dir:<output-dir>,function:<name>]
aoqi@0 569
aoqi@0 570 --print-lower-ast (Print lowered abstract syntax tree.)
aoqi@0 571 param: [true|false] default: false
aoqi@0 572
attila@963 573 -plp, --print-lower-parse (Print the parse tree after lowering.)
aoqi@0 574 param: [true|false] default: false
aoqi@0 575
aoqi@0 576 --print-mem-usage (Print memory usage of IR after each compile stage.)
aoqi@0 577 param: [true|false] default: false
aoqi@0 578
aoqi@0 579 --print-no-newline (Print function will not print new line char.)
aoqi@0 580 param: [true|false] default: false
aoqi@0 581
attila@963 582 -pp, --print-parse (Print the parse tree.)
aoqi@0 583 param: [true|false] default: false
aoqi@0 584
aoqi@0 585 --print-symbols (Print the symbol table.)
aoqi@0 586 param: [true|false] default: false
aoqi@0 587
aoqi@0 588 -pcs, --profile-callsites (Dump callsite profile data.)
aoqi@0 589 param: [true|false] default: false
aoqi@0 590
aoqi@0 591 -scripting (Enable scripting features.)
aoqi@0 592 param: [true|false] default: false
aoqi@0 593
attila@963 594 --stderr (Redirect stderr to a filename or to another tty, e.g. stdout.)
aoqi@0 595 param: <output console>
aoqi@0 596
attila@963 597 --stdout (Redirect stdout to a filename or to another tty, e.g. stderr.)
aoqi@0 598 param: <output console>
aoqi@0 599
aoqi@0 600 -strict (Run scripts in strict mode.)
aoqi@0 601 param: [true|false] default: false
aoqi@0 602
aoqi@0 603 -t, -timezone (Set timezone for script execution.)
aoqi@0 604 param: <timezone> default: Europe/Stockholm
aoqi@0 605
aoqi@0 606 -tcs, --trace-callsites (Enable callsite trace mode. Options are: miss [trace callsite misses]
attila@963 607 enterexit [trace callsite enter/exit], objects [print object properties].)
aoqi@0 608 param: [=[option,]*]
aoqi@0 609
aoqi@0 610 --verify-code (Verify byte code before running.)
aoqi@0 611 param: [true|false] default: false
aoqi@0 612
aoqi@0 613 -v, -version (Print version info of Nashorn.)
aoqi@0 614 param: [true|false] default: false
aoqi@0 615
aoqi@0 616 -xhelp (Print extended help for command line flags.)
aoqi@0 617 param: [true|false] default: false
aoqi@0 618

mercurial