Next: Bibliography Up: Thesis Previous: The ``Add and Print''   Contents

Conclusions and Future Work

Porting Perl to the JVM represents a unique challenge. The complexity of Perl's native data types and of parsing Perl cripple most typical methods of compilation for the JVM. This thesis presented a study of possible approaches for a Perl port to the JVM.

Clearly, it made sense to mitigate the parsing issues by using perl's existing front-end. Use of that front-end leveraged the many person-years that went into the canonical implementation of Perl, while limiting the problem scope to a much more manageable task.

However, using perl's front-end was not without its own challenges. The first approach tried, a direct compilation method, ultimately failed. This approach relied too much on perl's IR. This approach implicitly assumed that the PVM could be easily mapped onto the JVM directly. The perl IR proved too inflexible for this method, as it was not designed to be a generalized IR. Attempting to use it as such quickly took perl's IR to its limits. In the case of our JVM port, this meant that far too much new Java code was required to support even the simplest of features.

In addition, reliance on the JVM to act in the same manner as the PVM proved to be another problematic assumption. The JVM is not designed to be a perfectly general virtual architecture. Parts of the JVM, such as the bytecode verifier, rely on assumptions that are not applicable when the JVM is used in a more general way. This is not necessarily a flaw in the JVM, but it does indicate that using the JVM in such a general way is not the best approach.

Fortunately, the Kawa system provides a more generalized method for compiling non-Java languages to the JVM. Kawa introduces a layer of abstraction that is absolutely necessary if the JVM is to be used as a general architecture for non-Java languages. Other projects that port non-Java languages to the JVM would do well to revisit Kawa in its current state, and perhaps migrate to it. Such migration would not only alleviate problems faced in those projects, but standardizing on Kawa would also ease the task of integrating the object models of the various JVM ports. Such integration would bring the community closer to the goals described in Section 1.2.3.

In the specific case of our Perl port, Kawa solved some even more difficult problems. Using Kawa overcomes the deficiencies inherent in perl's IR and its tight coupling with the PVM. By providing a higher-level IR, Kawa eases the reuse of perl's IR. The minutiae of book-keeping required when trying to compile perl's IR directly to JVM bytecode disappears when Kawa is used. Semantic mapping is the sole focus, and the common details of compilation are handled internally by Kawa's compilation process.

The key impact of this work, however, is not only the final conclusion that ``Kawa is the right path for JVM compilation of non-Java languages''. The process of finding that solution is the greatest contribution here. This work shows the unexpected pitfalls that are encountered when direct compilation to JVM bytecode is attempted. In addition, this work exposes the problem of tightly coupling the IR with a particular virtual machine architecture. It is hoped that the Perl6 effort (which seeks to reimplement perl from the ground up) can make use of the lesson learned here, so that future versions of perl will ease the burden of porting to architectures like the JVM.

The most open area for future work is to continue porting more of Perl to the JVM via Kawa. Currently, only a small subset of Perl is supported, but the path is clear. Kawa's infrastructure makes the task of porting Perl to the JVM much more feasible. It is hoped that more developers will become interested in the project now that this work has laid out a clear path to the goal. With that in mind, all software developed in conjunction with this thesis has been released as free software, and contributions from the community have already begun.

Such work does not only benefit the Perl community, either. Already, the work of porting Perl to the JVM via Kawa has inspired enhancements to Kawa itself [6]. It is hoped that continued efforts to port a unique language like Perl via Kawa will help Kawa to become even more generalized and robust.

As Microsoft's .NET system looms on the horizon, The Kawa/JVM environment can be a real competitor to it. Of course, a Kawa/JVM system has the added advantage that it is completely open and free software, while Microsoft's .NET will no doubt remain proprietary. It is hoped that this advantage can carry a Kawa/JVM-based language system, along with a Perl port to Kawa/JVM, to success for users and programmers alike.

Next: Bibliography Up: Thesis 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.