From dev-return-37941-apmail-harmony-dev-archive=harmony.apache.org@harmony.apache.org Mon Aug 17 15:03:08 2009 Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 58098 invoked from network); 17 Aug 2009 15:03:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Aug 2009 15:03:08 -0000 Received: (qmail 1653 invoked by uid 500); 17 Aug 2009 15:03:14 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 1607 invoked by uid 500); 17 Aug 2009 15:03:14 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 1596 invoked by uid 99); 17 Aug 2009 15:03:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Aug 2009 15:03:14 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of daniel.gong.fudan@gmail.com designates 209.85.212.182 as permitted sender) Received: from [209.85.212.182] (HELO mail-vw0-f182.google.com) (209.85.212.182) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Aug 2009 15:03:06 +0000 Received: by vws12 with SMTP id 12so2668798vws.24 for ; Mon, 17 Aug 2009 08:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=7Id+VNe1WRYYpP24bK0K6l8zIYvuDlAuXSjvjX73a4o=; b=K0snAWqDkMx7aphzmTMlkxQRJHPORi1SYzljphG0jdGNhPvM0ojEqW/nFmzMmYXAfD W0WPGt2R9MV55ixpIIRIZtWVC7tZnGY18btrNHrC0T/1piscCtA4uNZhAAX8/u12bB5Z L+2adQ2fnuSbbgbmonz4D6MEgxSTcq0QxelpI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=JjosRTDWoDBO/TnFxuybazLrx5QlpCmqCXrqYJZdXRlWNR/gnG8cOF09J0AFnq1MFQ BLo2khPPnBMOSanN2dLnm4CpQExQhHhNNCt2tq4Bqe4nBEjQA4fOphfPa5Mr9bE+W9iY 6LXovodi+C55WwS5vU/uO2U2PLW/NUGlfZL6o= MIME-Version: 1.0 Received: by 10.220.127.196 with SMTP id h4mr4827885vcs.32.1250521364975; Mon, 17 Aug 2009 08:02:44 -0700 (PDT) In-Reply-To: <2cde31750908170759i4d6079aeg7eb433aee6043a27@mail.gmail.com> References: <2cde31750908050031t45afd716wdaf3a6082c556816@mail.gmail.com> <2cde31750908050149l88cf160h3bd4554b76c55996@mail.gmail.com> <4A7A4618.10007@gmail.com> <2cde31750908100501k1348ba44p47f9f88647d6e7a6@mail.gmail.com> <4A837C24.7020504@gmail.com> <2cde31750908122129x70d766a7od1747040debb4ab9@mail.gmail.com> <4A83A458.8090902@gmail.com> <2cde31750908160119q7fc3380dtd86bab8bb1604d19@mail.gmail.com> <4A88B80F.4000907@gmail.com> <2cde31750908170759i4d6079aeg7eb433aee6043a27@mail.gmail.com> Date: Mon, 17 Aug 2009 23:02:44 +0800 Message-ID: <2cde31750908170802s7521d348h6b412c37ccfe95ca@mail.gmail.com> Subject: Re: [GSOC] The code for smallest class set for customer application in now on JIRA From: Daniel Gong To: dev@harmony.apache.org Content-Type: multipart/alternative; boundary=000e0cd28874be4f54047157b128 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd28874be4f54047157b128 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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 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. T= he > analyzing strategies include constant pool parsing, dynamic tracing and s= o > 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 t= he > JRE to a size which will be very possibly larger than the real minimum si= ze > 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 th= e > 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 =93Class Name Set File=94 and follow= ed 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 characte= rs > 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 dec= ide > whether it is a valid name. If not, it will ignore it quietly and continu= e. > 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 c= opy > necessary files and =93reduced=94 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 =93jdk.dir=94, > =93origin.dir=94, =93target.dir=94 should be correctly configured to your= JDK > directory, the original JRE directory and the target JRE directory > respectively. > > Run =93ant=94 in the demo directory will execute the default target =93di= st=94 and > get a distribution of MinJreToolkit in the =93dist=94 directory after com= piling > and testing. After that, the user can use the distribution to help him/he= r > get a reduced JRE for his/her own application. > > Run =93ant clean=94 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 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. >> > > --000e0cd28874be4f54047157b128--