harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Gong <daniel.gong.fu...@gmail.com>
Subject Re: [GSOC] The code for smallest class set for customer application in now on JIRA
Date Mon, 17 Aug 2009 15:02:44 GMT
This is my doc for MinJreToolkit besides its javadoc. I don't know where to
put it in wiki, so I post it here.
Thanks for Regis's mentoring & all in the list that have ever helped me!

-Daniel

On Mon, Aug 17, 2009 at 10:59 PM, Daniel Gong
<daniel.gong.fudan@gmail.com>wrote:

> *Introduction to MinJreToolkit*
>
>
>
> Version 0.01
>
>
>
> 1.  Main goal
>
> The main goal of MinJreToolkit is to implement a set of tools to help
> developers decide which files of a JRE are necessary to execute a certain
> custom JAVA application and then reduce the JRE size as much as possible to
> just suit the custom application.
>
>
>
> 2.  General idea
>
> The general idea of MinJreToolkit is to implement tools to automatically
> analyze the custom application in several different ways and define a
> uniformed result format which can be merged easily for all these tools. The
> analyzing strategies include constant pool parsing, dynamic tracing and so
> on.
>
> Due to the possible dynamic behavior of JAVA application, it is hard to
> strictly decide the exact necessary files given a JRE implementation and a
> JAVA application. Therefore, the task of the MinJreToolkit is to reduce the
> JRE to a size which will be very possibly larger than the real minimum size
> a bit.
>
>
>
> 3. Detailed design
>
> In the current version of MinJreToolkit, the basic result format has been
> defined, associated with a class which contains the data of result and the
> operations between results. Besides, two analyzing strategies and a JRE
> generator have been implemented to perform static and dynamic analysis to a
> custom application and generate a new JRE from an origin one according to
> the final merged result.
>
> The basic result format
>
> The current result file is a plain text file with a cns file name
> extension, called CNS (Class Name Set) file. The format of CNS file is
> simple. It must start with a line of “Class Name Set File” and followed by a
> list of fully qualified class name (such as java.io.File) or package name
> (such as java.lang.*), only one item in a line without any empty characters
> before and after the name. Empty lines are allowed between name lines for
> that sometimes the user may want to organize the names in groups.
>
> The associated class, called ClassNameSet, is the data structure that
> contains and manages the class name set. It can be initialized from a cns
> file and can also be output to a cns file. More, it can merge from a cns
> file or another instance of ClassNameSet. When trying to add a class name or
> a package name, the instance of ClassNameSet will examine the name to decide
> whether it is a valid name. If not, it will ignore it quietly and continue.
> The future version of MinJreToolkit may add this kind of exception
> information to a log file.
>
> Static analysis
>
> The static analysis is implemented based on bcel 5.2. The analyzer parses
> the constant pool of each class with bcel, get the dependence between
> classes and employ a simple dependency closure algorithm to calculate the
> closure. The output of this analyzer is a cns file containing JRE classes in
> the closure.
>
> Dynamic analysis
>
> The dynamic analysis is implemented as a JVMTI agent. It parses all the
> class load events taking place in the runtime of an application and give a
> cns file output. The agent is supposed to be used in tests. The coverage of
> this kind of dynamic tracing depends on the coverage of test cases.
>
> JRE Generator
>
> The JRE generator should be initialized by a cns file which contains the
> necessary classes that a certain JRE implementation must load in any case.
> Then cns files can be added to the generator. After that, the generator copy
> necessary files and “reduced” jar files to the target JRE directory.
>
>
>
> 4. What can you do with the demo
>
> Currently the demo contains
>
>
>    - the functional module of static analyzer and JRE generator
>    - the main class of static analyzer and JRE generator
>    - the command line scripts of  static analyzer and JRE generator (in
>    Windows environment)
>    - the Ant task of static analyzer and JRE generator
>    - the dynamic tracing agent (in both Windows & Linux environment)
>
> A build.xml file has been provided to compile, test both command line
> version and Ant task version of static analyzer and JRE generator as well as
> the dynamic tracing agent and finally create the distribution of
> MinJreToolkit including binary files, command line scripts and
> documentation.
>
> To execute the build.xml file, the user should have Apache Ant installed
> and well configured. Before the execution, the property of “jdk.dir”,
> “origin.dir”, “target.dir” should be correctly configured to your JDK
> directory, the original JRE directory and the target JRE directory
> respectively.
>
> Run “ant” in the demo directory will execute the default target “dist” and
> get a distribution of MinJreToolkit in the “dist” directory after compiling
> and testing. After that, the user can use the distribution to help him/her
> get a reduced JRE for his/her own application.
>
> Run “ant clean” in the demo directory will clean all files possibly
> produced in the previous building process and restore the demo directory to
> the original status.
>
> 5. Future plan
>
> Currently the following improvements are in the future plan:
>
>
>    - Optimize the closure calculation algorithm used in the static
>    analysis
>       - Reduce the output closure size
>       - Enhance the performance of the algorithm in speed and memory
>       occupancy
>    - Add other analyzers to make the toolkit generate smaller JRE
>    - Add a log functional module to the toolkit to provide more
>    information to user
>
>
> On Mon, Aug 17, 2009 at 9:53 AM, Regis <xu.regis@gmail.com> wrote:
>
>> Daniel Gong wrote:
>>
>>
>>> Since adding this is a small change, should I upload a new version to
>>> JIRA?
>>>
>>
>> I have committed the code to
>> https://svn.apache.org/repos/asf/harmony/enhanced/tools/trunk/minijre at
>> r804821
>>
>> so you can create patch against it.
>>
>>
>>> Besides, I am wondering what else should I do for GSoC?
>>>
>>
>> It would be great if you can add a wiki page to introduce this tool.
>>
>>
>>> -Daniel
>>>
>>>
>>
>>
>> --
>> Best Regards,
>> Regis.
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message