Next: First Approach Direct Compilation Up: Internals of perl Previous: The ``Add and Print''   Contents

Accessing the IR via B

The previous example demonstrates how closely tied the perl IR is to the PVM--many OPs are specifically tuned for operations on the PVM. And, given the other problems discussed in Section 3.1, it is not possible to simply ``map'' the PVM onto the JVM in any simple way. However, thanks to the B module, perl's existing front-end can be used to leverage some parts of the IR for a JVM port, even if the PVM and the JVM are not really analogous.

The B module allows programmers to implement their own back-ends separate from the PVM. The B module provides facilities to examine and manipulate the IR generated by perl's front-end. In addition, the B module can be used to examine the internal data structures used by the both the PVM and the front-end.

On the perl command line, the user interface to the B module is through the O module. The O module acts primarily as a wrapper, allowing the corresponding B module to be invoked. Instead of running the ``default'' perl back-end (i.e., the PVM), the user can use the O module to choose a completely different back-end. That back-end is implemented by the corresponding B module, which can be written in Perl or C. ([3] and [15] contain a more complete discussion of the B and O modules.)

The next chapter discusses the first approach to a JVM port, which made use of the B module and perl's IR to compile to the JVM.


Next: First Approach Direct Compilation Up: Internals of perl Previous: The ``Add and Print''   Contents

Copyright © 2000, 2001 Bradley M. Kuhn.

Verbatim copying and distribution of this entire thesis is permitted in any medium, provided this notice is preserved.