nashorn/docs/DEVELOPER_README
changeset 16201 889ddb179cdf
parent 16168 f0c208287983
child 16227 1bafb74d17b2
equal deleted inserted replaced
16200:1c54dc374fe4 16201:889ddb179cdf
    32 
    32 
    33 SYSTEM PROPERTY: -Dnashorn.callsiteaccess.debug
    33 SYSTEM PROPERTY: -Dnashorn.callsiteaccess.debug
    34 
    34 
    35 See the description of the access logger below. This flag is
    35 See the description of the access logger below. This flag is
    36 equivalent to enabling the access logger with "info" level.
    36 equivalent to enabling the access logger with "info" level.
    37 
       
    38 
       
    39 SYSTEM PROPERTY: -Dnashorn.compiler.ints.disable
       
    40 
       
    41 This flag prevents ints and longs (non double values) from being used
       
    42 for any primitive representation in the lowered IR. This is default
       
    43 false, i.e Lower will attempt to use integer variables as long as it
       
    44 can. For example, var x = 17 would try to use x as an integer, unless
       
    45 other operations occur later that require coercion to wider type, for
       
    46 example x *= 17.1;
       
    47 
    37 
    48 
    38 
    49 SYSTEM PROPERTY: -Dnashorn.compiler.intarithmetic 
    39 SYSTEM PROPERTY: -Dnashorn.compiler.intarithmetic 
    50 
    40 
    51 Arithmetic operations in Nashorn (except bitwise ones) typically
    41 Arithmetic operations in Nashorn (except bitwise ones) typically
   193 
   183 
   194 We still have to deal with objects vs primitives for local bytecode
   184 We still have to deal with objects vs primitives for local bytecode
   195 slots, possibly through code copying and versioning.
   185 slots, possibly through code copying and versioning.
   196 
   186 
   197 
   187 
   198 SYSTEM PROPERTY: -Dnashorn.compiler.symbol.trace=<x>
   188 SYSTEM PROPERTY: -Dnashorn.compiler.symbol.trace=[<x>[,*]], 
       
   189   -Dnashorn.compiler.symbol.stacktrace=[<x>[,*]]
   199 
   190 
   200 When this property is set, creation and manipulation of any symbol
   191 When this property is set, creation and manipulation of any symbol
   201 named "x" will show information about when the compiler changes its
   192 named "x" will show information about when the compiler changes its
   202 type assumption, bytecode local variable slot assignment and other
   193 type assumption, bytecode local variable slot assignment and other
   203 data. This is useful if, for example, a symbol shows up as an Object,
   194 data. This is useful if, for example, a symbol shows up as an Object,
   204 when you believe it should be a primitive. Usually there is an
   195 when you believe it should be a primitive. Usually there is an
   205 explanation for this, for example that it exists in the global scope
   196 explanation for this, for example that it exists in the global scope
   206 and type analysis has to be more conservative. In that case, the stack
   197 and type analysis has to be more conservative. 
   207 trace upon type change to object will usually tell us why.
   198 
       
   199 Several symbols names to watch can be specified by comma separation.
       
   200 
       
   201 If no variable name is specified (and no equals sign), all symbols
       
   202 will be watched
       
   203 
       
   204 By using "stacktrace" instead of or together with "trace", stack
       
   205 traces will be displayed upon symbol changes according to the same
       
   206 semantics.
   208 
   207 
   209 
   208 
   210 SYSTEM PROPERTY: nashorn.lexer.xmlliterals
   209 SYSTEM PROPERTY: nashorn.lexer.xmlliterals
   211 
   210 
   212 If this property it set, it means that the Lexer should attempt to
   211 If this property it set, it means that the Lexer should attempt to
   347 
   346 
   348 ===============
   347 ===============
   349 2. The loggers.
   348 2. The loggers.
   350 ===============
   349 ===============
   351 
   350 
       
   351 It is very simple to create your own logger. Use the DebugLogger class
       
   352 and give the subsystem name as a constructor argument.
       
   353 
   352 The Nashorn loggers can be used to print per-module or per-subsystem
   354 The Nashorn loggers can be used to print per-module or per-subsystem
   353 debug information with different levels of verbosity. The loggers for
   355 debug information with different levels of verbosity. The loggers for
   354 a given subsystem are available are enabled by using
   356 a given subsystem are available are enabled by using
   355 
   357 
   356 --log=<systemname>[:<level>]
   358 --log=<systemname>[:<level>]
   380 The compiler is in charge of turning source code and function nodes
   382 The compiler is in charge of turning source code and function nodes
   381 into byte code, and installs the classes into a class loader
   383 into byte code, and installs the classes into a class loader
   382 controlled from the Context. Log messages are, for example, about
   384 controlled from the Context. Log messages are, for example, about
   383 things like new compile units being allocated. The compiler has global
   385 things like new compile units being allocated. The compiler has global
   384 settings that all the tiers of codegen (e.g. Lower and CodeGenerator)
   386 settings that all the tiers of codegen (e.g. Lower and CodeGenerator)
   385 use.
   387 use.s
   386 
   388 
   387 
   389 
   388 * codegen
   390 * codegen
   389 
   391 
   390 The code generator is the emitter stage of the code pipeline, and
   392 The code generator is the emitter stage of the code pipeline, and
   427 "nashorn.codegen.debug" to true.
   429 "nashorn.codegen.debug" to true.
   428 
   430 
   429 
   431 
   430 * lower
   432 * lower
   431 
   433 
       
   434 This is the first lowering pass.
       
   435 
       
   436 Lower is a code generation pass that turns high level IR nodes into
       
   437 lower level one, for example substituting comparisons to RuntimeNodes
       
   438 and inlining finally blocks.
       
   439 
       
   440 Lower is also responsible for determining control flow information
       
   441 like end points.
       
   442 
       
   443 
       
   444 * attr
       
   445 
   432 The lowering annotates a FunctionNode with symbols for each identifier
   446 The lowering annotates a FunctionNode with symbols for each identifier
   433 and transforms high level constructs into lower level ones, that the
   447 and transforms high level constructs into lower level ones, that the
   434 CodeGenerator consumes.
   448 CodeGenerator consumes.
   435 
   449 
   436 Lower logging typically outputs things like post pass actions,
   450 Lower logging typically outputs things like post pass actions,
   437 insertions of casts because symbol types have been changed and type
   451 insertions of casts because symbol types have been changed and type
   438 specialization information. Currently very little info is generated by
   452 specialization information. Currently very little info is generated by
   439 this logger. This will probably change.
   453 this logger. This will probably change.
   440 
   454 
   441 
   455 
   442 * access
   456 * finalize
   443 
   457 
   444 The --log=access option is equivalent to setting the system variable
   458 This --log=finalize log option outputs information for type finalization,
   445 "nashorn.callsiteaccess.debug" to true. There are several levels of
   459 the third tier of the compiler. This means things like placement of 
   446 the access logger, usually the default level "info" is enough
   460 specialized scope nodes or explicit conversions. 
   447 
       
   448 It is very simple to create your own logger. Use the DebugLogger class
       
   449 and give the subsystem name as a constructor argument.
       
   450 
   461 
   451 
   462 
   452 * fields
   463 * fields
   453 
   464 
   454 The --log=fields option (at info level) is equivalent to setting the
   465 The --log=fields option (at info level) is equivalent to setting the