JVMChunk

abstract class JVMChunk constructor : ExecutableChunk

A JVMChunk is an ExecutableChunk for the Java Virtual Machine. It is produced by a JVMTranslator on behalf of an L2Generator that has just completed a translation or optimization.

In the initial cheesy version of JVM translation, the generated subclasses of JVMChunk simply embed the reified L2Instructions directly and execute them without the interpreter's loop overhead. This mechanism is a feel-good milestone, and is not intended to survive very long.

Author

Todd L Smith

Constructors

Link copied to clipboard
constructor()

Construct a JVMChunk.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The L1 source code, if any is available; null otherwise. Primarily intended for debugging.

Link copied to clipboard

The L2 source code, if any is available; null otherwise. Primarily intended for debugging.

Functions

Link copied to clipboard
abstract fun name(): String

Answer a descriptive (non-unique) name for the ExecutableChunk.

Link copied to clipboard
abstract fun runChunk(interpreter: Interpreter, offset: Int): StackReifier?

Run the ExecutableChunk to completion. Note that a reification request may cut this short. For an initial invocation, the Interpreter.argsBuffer will have been set up for the call. For a return into this continuation, the offset will refer to code that will rebuild the register set from the top reified continuation, using the Interpreter.getLatestResult. For resuming the continuation, the offset will point to code that also rebuilds the register set from the top reified continuation, but it won't expect a return value. These re-entry points should perform validity checks on the chunk, allowing an orderly off-ramp into the unoptimizedChunk (which simply interprets the L1 nybblecodes).