This is the original home of the open source version of the Purifier project (A.K.A. Purifier1).
Attention: The Purifier project has been re-tasked as a commercial product, Purifier2. The original, open source, Purifier1 version is still available. However, for technical reasons, it cannot be made to guarantee that the results are always identical to Sun's preverifier. The Purifier2 commercial version, which is still under development, uses a significantly different architecture to provide better compatibility. See the Project Status section for more details.
Purifier1 is an open source, pure Java, minimal, J2ME preverifier. That means that it is a program and API that does the absolute minimum required by the CLDC 1.0 specification to convert a compiled Java class file into a file that will work in a CLDC compatible virtual machine. The Purifier1 assumes the given class file has already been checked by a J2SE verifier and does not contain any illegal class references or data types. What that leaves is a program that will inline code from jsr and jsr_w's and create a Stack Map entry for every method that needs one.
See the manual for more details
... or why create an open source, pure Java, minimal, CLDC preverifier?
The original impetus was that Sun's Java 2 Micro Edition Wireless Toolkit has a preverifier that is written in C. It's always good to have Java development tools that are written in Java so that development can be as platform independent as Java itself. The original toolkit actually had a preverifier that only worked on Windows, which is completely unacceptable to many developers. Although version 1.0.4_01 of the toolkit now includes a Linux and Solaris preverifier, there are many platforms, such as Mac OS X, that have no preverification support from Sun at all.
Another application is in J2ME provisioning servers that need to be able to dynamically modify and wrap existing Midlets and MidletSuites. After manipulating the byte code in a CLDC application class file it has to be re-preverified. Running Sun's preverifier on a high volume, mission critical server isn't a viable proposition because it requires spawning a new shell for each request. Besides, such servers are rarely Windows boxes.
More details and examples of applications are given in the manual.
Development of the Purifier1 project has been halted and work is now proceeding on a commercial Purifier2 version with a significantly different architecture. Although the algorithm that the Purifier1 used for StackMap generation is an extremely fast and efficient generator of StackMaps, when compared to full CFA/DFA algorithms, its fundamentally different approach made it impossible to guarantee that it would always produce exactly the same results as Sun's preverifier. This reduced its viability for some of its intended purposes.
The development of Purifier1 provided me with an amazing learning experience and commercial interests were impressed enough with the value of the Purifier to take that to the next level and begin development of a more extensive, commercial version. However, the original version along with its documentation is still available for anyone else who would like to benefit from this learning experience.
Until the open source version of the project was halted, the code was in the later part of the initial development stage. The work was focused on getting the StackMap generation algorithm to agree with Sun's preverifier in all cases. Of the 661 test cases that were being used, it failed to generate the correct StackMap in 28 cases and produced no exceptions at all. That's an almost 96% success rate! The basic data flow analysis algorithm is reasonably stable and most of the easy problems have been solved. Four failure mechanisms remained to be solved. The primary cause behind these failure mechanisms were related to subtle differences in the approaches used by the Purifier1 and Sun's preverifier. Although a significant amount of work was done on Purifier1 to mask these differences, the two algorithms are, ultimately, irreconcilable.
Some documentation of the Purifier1 is available in the online manual.
The final phases of the project to re-factor the project to a more suitable class structure, add code for jsr/jsr_w inlining and CLCD specific checks have never been completed. As it stands, the Purifier1 project is primarily a collection of methods that implement the required StackMap generation algorithm. To be a complete project, it would have to be re-organized, but this shouldn't be very difficult. However, due to the disagreements between the Purifier1 StackMaps and those produced by Sun's preverifier, there is not much point in completing the project
The project distribution, including source, unit tests, and JavaDocs, are available upon request. Since I am relucant to distribute "broken" code, I would appreciate it if requesters provide some information about their need for the source and intended uses. Requests may be sent via email to Mark Crocker <email@example.com>
I've been wanting to do the Purifier for a while now, but it was only with the support of mCentric and Data Representations, that I was able to get a good start on the project. Although no money changed hands to get the project to this point, the business arrangements, which were dropped when the project was converted to a commercial product, were responsible for getting the original Purifier1 project started.
This product includes software developed by the Apache Software Foundation (http://www.apache.org/), but is not endorsed or promoted by the Apache Software Foundation.
The Purifier1 project is distributed under the Apache Software License, Version 1.1.
Next Mark Crocker's Home page