OptimizationLevel

OptimizationLevel is an enum class indicating the possible degrees of optimization effort. These are arranged approximately monotonically increasing in terms of both cost to generate and expected performance improvement.

Entries

Link copied to clipboard

Unoptimized code, interpreted via Level One machinery. Technically the current implementation only executes Level Two code, but the default Level Two chunk relies on a Level Two instruction that simply fetches each nybblecode and interprets it.

Link copied to clipboard

Translate the nybblecodes quickly into an L2SimpleChunk.

Link copied to clipboard

The initial translation into Level Two instructions customized to a particular raw function. This at least should avoid the cost of fetching nybblecodes. It also avoids looking up monomorphic methods at execution time, and can inline or even fold calls to suitable primitives. The inlined calls to infallible primitives are simpler than the calls to fallible ones or non-primitives or polymorphic methods. Inlined primitive attempts avoid having to reify the calling continuation in the case that they're successful, but have to reify if the primitive fails.

Link copied to clipboard

The initial translation into Level Two instructions customized to a particular raw function. This at least should avoid the cost of fetching nybblecodes. It also avoids looking up monomorphic methods at execution time, and can inline or even fold calls to suitable primitives. The inlined calls to infallible primitives are simpler than the calls to fallible ones or non-primitives or polymorphic methods. Inlined primitive attempts avoid having to reify the calling continuation in the case that they're successful, but have to reify if the primitive fails.

Link copied to clipboard

Unimplemented. The idea is that at this level some inlining of non-primitives will take place, emphasizing inlining of function application. Invocations of methods that take a literal function should tend very strongly to get inlined, as the potential to turn things like continuation-based conditionals and loops into mere jumps is expected to be highly profitable.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The value to use for the countdown after the translation at this level has taken place (i.e., how many calls to endure before the next level of optimization is attempted).

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
abstract fun optimize(code: A_RawFunction, interpreter: Interpreter)

Perform this level of optimization on the given A_RawFunction.

Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.