Precedente: Encoder Stage Su: Indice Successivo: Writer Stage

Packager Stage

Once the Generator has been properly encoded in the Encoder stage, Rubinius packages the bytecode up as a CompiledCode by creating a new CompiledCode and setting a number of properties on it.

These properties are available on any CompiledCode. You can retrieve the CompiledCode from a Ruby Method object by calling executable on it.

The Packager stage also makes sure that any child generators (such as generators for blocks or methods) are also converted into compiled methods. These child compiled methods are included in the literals tuple of the parent compiled method.

Once the Generator has finished packaging itself as a CompiledCode, it invokes the Writer stage, passing in the CompiledCode as its input.

Files Referenced

Customization

In general, the package method is designed to populate the CompiledCode with a group of variables. However, you could also use the packager to populate another object with the same interface. However, it would not necessarily be useful on its own, without additional customizations later on

Precedente: Encoder Stage Su: Indice Successivo: Writer Stage

Tweet at @rubinius on Twitter or email community@rubini.us. Please report Rubinius issues to our issue tracker.