You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Daniel Gong <da...@gmail.com> on 2009/08/05 09:31:42 UTC

[GSOC] The code for smallest class set for customer application in now on JIRA

Hi all,
I have my code attached in issue HARMONY-6291 on JIRA. I'd like to call it
MinJre Toolkit.

Now the coding of MinJreToolkit is almost complete. It includes functional
classes as well as command line tool and ant task implemented based on them.
More, for dynamic tracing, a jvmti agent has been implemented. Both static
analysis and dynamic tracing produce a type of result file called cns (Class
Name Set) file, which has an associated data structure called ClassNameSet
that can be created from a cns file, witten to a cns file and merged with a
cns file. The cns file in the conf directory contains the required classes
for different jre implementations. Now it only supports Harmony.

The toolkit can be used in two steps. First, employ both static analyzer and
dynamic tracer in the process of application development and test, and
record necessary information in several cns files. Second, employ the jre
generator to merge these cns files and generate a new jre from an original
one.

So far I have written a simple ant build file to handle the whole process
including compile, test, pack & javadoc. The compiling of the agent is not
in because I'm still learning ant usage. The test is also very simple, just
a helloworld app:P

I'll improve the toolkit by adding command line script, optimizing ant
build, doing more test and improve the algorithm if a better strategy is
found.

Everyone please feel free to give me advice or report bugs to me~thx:)

Daniel Gong

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
Thank you Mark.
It is true that what the current version of MinJreToolkit produces is not a
true minimum one, and I believe it is not always possible to cut jre to a
minimum one because of the possible dynamic behavior of a java application.

However, in my opinion, the MinJreToolkit is designed to analyze a custom
application automatically in several different ways and integrate the
results to the final result. The current version of MinJreToolkit define the
format of result and contains two tools which can reduce the size of
jre markedly but it's still not enough. The current version is for GSoC, and
of course I will keep improving it.

I've also tried the same kind of experiments as you did. The problem is how
to find automatic algorithms to detect the dependence rather than analyze
with a large configure file specified for a certain implementation of jre.
In my future plan, I will try to find such kind of algorithms and optimize
the existing algorithm to reduce the size of jre further. More, your
comments remind me that I should offer a building log for those who want to
know what classes and files are reserved in the new generated jre and why.
The cns file is for the jre generator, not for the user, so I think it will
be better to place these information in a log file.

Thanks very much again for all your comments! By the way, I like the word
"interesting" you use to describe my work:) It is really an interesting
project and a challenge for me, and I've learnt a lot:)

On Thu, Aug 13, 2009 at 9:17 PM, Mark Hindess
<ma...@googlemail.com>wrote:

>
> In message <2c...@mail.gmail.com>,
> Daniel Gong writes:
> >
> > Hi all,
> > I have my code attached in issue HARMONY-6291 on JIRA. I'd like to call
> it
> > MinJre Toolkit.
>
> Nice work Daniel.
>
> A couple of comments . . .
>
> When running on linux I have to set jdk.dir (or JAVA_HOME), origin.dir
> and target.dir.  It would be nice if I could just set one property
> (assuming people are running with Harmony and if not they deserve to
> have to set more properties ;-) and have the others default to something
> sensible.  So something like:
>
>        <property name="jdk.dir" location="${env.JAVA_HOME}" />
>        <property name="origin.dir" location="${jdk.dir}/jre" />
>        <property name="target.dir" location="${origin.dir}-min" />
>
> You will also note that I changed the properties to use location="..."
> rather than value="..." since the later converts them to a full path.
> If I didn't do this I had a problem because g++ was execute in a
> different working directory and a relative path is then broken.
>
> With these changes I can just do:
>
>  JAVA_HOME=../target/hdk/jdk ant
>
> and it uses Harmony to create a new minimal jre in
> "../target/hdk/jdk/jre-min".
>
> In addition to the class lists, in cns it would be nice to have some
> information about why a class was required.  For instance, I'd like to know
> why the static analysis decided that org.apache.bcel.generic.LoadClass was
> required for Hello.class.
>
> Similarly, it would be nice to have a log file created that shows why
> each item in jre-min was copied from the jre.  The default should be to
> copy almost nothing but the launcher and justify everything else you
> copy.  I think this is a good approach since it would avoid copying:
>
> 1) Artifacts for which there is no justification.  For example,
> security-kernel-stubs.jar which is a jar of empty method stubs used
> for satisfying dependencies during compilation.
>
> 2) Artifacts for which the justification is dependent on another artifact.
> For example, without awt.jar there is no point in having the awt artifacts
> such as:
>
>  bin/libFL.so
>  bin/libgl.so
>  bin/libjpegdecoder.so
>  bin/liblcmm.so
>  bin/liblinuxfont.so
>  bin/liboglwrapper.so
>  bin/libX11Wrapper.so
>  lib/fonts
>  lib/cmm
>
> Similarly for the DLLs for natives corresponding to jars.  You'd also
> probably not end up with empty directories such as lib/boot/yoko-1.0 or
> manifests with no corresponding jar such as lib/boot/asm-3.1.
>
>
> Since it is simple to automate, you might want to comment out any jars
> you remove from the bootclasspath.properties file to avoid the VM having
> to look for them at all.
>
>
> As an experiment, I took the jre-min for the example Hello class and
> removed the unused DLLs, cmm, font and jar files[0].  Excluding the jvm
> in jre/bin/default that reduced the size from 19.4k to 10.4k which is
> 53.7% of the original minimal jre size.
>
> Taking the -verbose:class output, I then removed the classes from the
> jars that were not listed in the -verbose:class output.  This reduced
> the since to 8.6k which is 44.2% of the original minimal jre size.  This
> is totally crazy for a real world application but give some idea of the
> absolute minimal boot class set.
>
> Thanks again for your interesting work.
>
> Regards,
>  Mark.
>
> [0] I basically wrote a script which did 'chmod 0' on each file, ran
> the Hello class, then either removed the file or reverted the chmod
> depending on the success or otherwise of the Hello run.  The list of
> files I removed is:
>
> bin/libaccessors.so
> bin/libFL.so
> bin/libgl.so
> bin/libhyauth.so
> bin/libhyinstrument.so
> bin/libhyniochar.so[1]
> bin/libhysecurity.so
> bin/libjpegdecoder.so
> bin/libjpegencoder.so
> bin/liblcmm.so
> bin/liblinuxfont.so
> bin/liboglwrapper.so
> bin/libpngencoder.so
> bin/libX11Wrapper.so
> lib/boot/archive.jar
> lib/boot/asm-3.1/META-INF/MANIFEST.MF
> lib/boot/auth.jar
> lib/boot/bcel-5.2/bcel-5.2.jar
> lib/boot/beans.jar
> lib/boot/concurrent.jar
> lib/boot/crypto.jar
> lib/boot/instrument.jar
> lib/boot/lang-management.jar
> lib/boot/logging.jar
> lib/boot/math.jar
> lib/boot/misc.jar
> lib/boot/mx4j_3.0.2/META-INF/MANIFEST.MF
> lib/boot/mx4j_3.0.2/mx4j.jar
> lib/boot/mx4j_3.0.2/mx4j-remote.jar
> lib/boot/regex.jar
> lib/boot/rmi.jar
> lib/boot/security-kernel-stubs.jar
> lib/boot/suncompat.jar
> lib/boot/text.jar
> lib/boot/xalan-j_2.7.0/META-INF/MANIFEST.MF
> lib/boot/xerces_2.9.1/META-INF/MANIFEST.MF
> lib/boot/xerces_2.9.1/xml-apis.jar
> lib/cmm/CIEXYZ.pf
> lib/cmm/GRAY.pf
> lib/cmm/LINEAR_RGB.pf
> lib/cmm/sRGB.pf
> lib/fonts/DejaVuSans-BoldOblique.ttf
> lib/fonts/DejaVuSans-Bold.ttf
> lib/fonts/DejaVuSans-Oblique.ttf
> lib/fonts/DejaVuSans.ttf
> lib/fonts/DejaVuSerif-BoldItalic.ttf
> lib/fonts/DejaVuSerif-Bold.ttf
> lib/fonts/DejaVuSerif-Italic.ttf
> lib/fonts/DejaVuSerif.ttf
>
> [1] Removing libniochar.so means that the ICU4J implementation is used
> for the charset providers (rather than the native version) which may not
> be a good idea for all applications.
>
> [2] Using an IBM VME you can also remove:
>
> bin/libhyarchive.so
> lib/boot/annotation.jar
>
> If you remove these with DRLVM, then you get a SIGABORT crash dump.  I
> can't help wondering why we don't handle these errors a little more
> gracefully.
>
>
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Mark Hindess <ma...@googlemail.com>.
In message <2c...@mail.gmail.com>,
Daniel Gong writes:
> 
> Hi all,
> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to call it
> MinJre Toolkit.

Nice work Daniel.

A couple of comments . . .

When running on linux I have to set jdk.dir (or JAVA_HOME), origin.dir
and target.dir.  It would be nice if I could just set one property
(assuming people are running with Harmony and if not they deserve to
have to set more properties ;-) and have the others default to something
sensible.  So something like:

  	<property name="jdk.dir" location="${env.JAVA_HOME}" />
	<property name="origin.dir" location="${jdk.dir}/jre" />
	<property name="target.dir" location="${origin.dir}-min" />

You will also note that I changed the properties to use location="..."
rather than value="..." since the later converts them to a full path.
If I didn't do this I had a problem because g++ was execute in a
different working directory and a relative path is then broken.

With these changes I can just do:

  JAVA_HOME=../target/hdk/jdk ant

and it uses Harmony to create a new minimal jre in "../target/hdk/jdk/jre-min".

In addition to the class lists, in cns it would be nice to have some 
information about why a class was required.  For instance, I'd like to know
why the static analysis decided that org.apache.bcel.generic.LoadClass was
required for Hello.class.

Similarly, it would be nice to have a log file created that shows why
each item in jre-min was copied from the jre.  The default should be to
copy almost nothing but the launcher and justify everything else you
copy.  I think this is a good approach since it would avoid copying:

1) Artifacts for which there is no justification.  For example,
security-kernel-stubs.jar which is a jar of empty method stubs used
for satisfying dependencies during compilation.

2) Artifacts for which the justification is dependent on another artifact.
For example, without awt.jar there is no point in having the awt artifacts
such as:

  bin/libFL.so
  bin/libgl.so
  bin/libjpegdecoder.so
  bin/liblcmm.so
  bin/liblinuxfont.so
  bin/liboglwrapper.so
  bin/libX11Wrapper.so
  lib/fonts
  lib/cmm

Similarly for the DLLs for natives corresponding to jars.  You'd also
probably not end up with empty directories such as lib/boot/yoko-1.0 or
manifests with no corresponding jar such as lib/boot/asm-3.1.


Since it is simple to automate, you might want to comment out any jars
you remove from the bootclasspath.properties file to avoid the VM having
to look for them at all.


As an experiment, I took the jre-min for the example Hello class and
removed the unused DLLs, cmm, font and jar files[0].  Excluding the jvm
in jre/bin/default that reduced the size from 19.4k to 10.4k which is
53.7% of the original minimal jre size.

Taking the -verbose:class output, I then removed the classes from the
jars that were not listed in the -verbose:class output.  This reduced
the since to 8.6k which is 44.2% of the original minimal jre size.  This
is totally crazy for a real world application but give some idea of the
absolute minimal boot class set.

Thanks again for your interesting work.

Regards,
 Mark.

[0] I basically wrote a script which did 'chmod 0' on each file, ran
the Hello class, then either removed the file or reverted the chmod
depending on the success or otherwise of the Hello run.  The list of
files I removed is:

bin/libaccessors.so
bin/libFL.so
bin/libgl.so
bin/libhyauth.so
bin/libhyinstrument.so
bin/libhyniochar.so[1]
bin/libhysecurity.so
bin/libjpegdecoder.so
bin/libjpegencoder.so
bin/liblcmm.so
bin/liblinuxfont.so
bin/liboglwrapper.so
bin/libpngencoder.so
bin/libX11Wrapper.so
lib/boot/archive.jar
lib/boot/asm-3.1/META-INF/MANIFEST.MF
lib/boot/auth.jar
lib/boot/bcel-5.2/bcel-5.2.jar
lib/boot/beans.jar
lib/boot/concurrent.jar
lib/boot/crypto.jar
lib/boot/instrument.jar
lib/boot/lang-management.jar
lib/boot/logging.jar
lib/boot/math.jar
lib/boot/misc.jar
lib/boot/mx4j_3.0.2/META-INF/MANIFEST.MF
lib/boot/mx4j_3.0.2/mx4j.jar
lib/boot/mx4j_3.0.2/mx4j-remote.jar
lib/boot/regex.jar
lib/boot/rmi.jar
lib/boot/security-kernel-stubs.jar
lib/boot/suncompat.jar
lib/boot/text.jar
lib/boot/xalan-j_2.7.0/META-INF/MANIFEST.MF
lib/boot/xerces_2.9.1/META-INF/MANIFEST.MF
lib/boot/xerces_2.9.1/xml-apis.jar
lib/cmm/CIEXYZ.pf
lib/cmm/GRAY.pf
lib/cmm/LINEAR_RGB.pf
lib/cmm/sRGB.pf
lib/fonts/DejaVuSans-BoldOblique.ttf
lib/fonts/DejaVuSans-Bold.ttf
lib/fonts/DejaVuSans-Oblique.ttf
lib/fonts/DejaVuSans.ttf
lib/fonts/DejaVuSerif-BoldItalic.ttf
lib/fonts/DejaVuSerif-Bold.ttf
lib/fonts/DejaVuSerif-Italic.ttf
lib/fonts/DejaVuSerif.ttf

[1] Removing libniochar.so means that the ICU4J implementation is used
for the charset providers (rather than the native version) which may not
be a good idea for all applications.

[2] Using an IBM VME you can also remove:

bin/libhyarchive.so
lib/boot/annotation.jar

If you remove these with DRLVM, then you get a SIGABORT crash dump.  I
can't help wondering why we don't handle these errors a little more
gracefully.



Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
I will add it in the description:)

On Wed, Aug 5, 2009 at 3:47 PM, Regis <xu...@gmail.com> wrote:

> Daniel Gong wrote:
>
>> Hi all,
>> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to call it
>> MinJre Toolkit.
>>
>> Now the coding of MinJreToolkit is almost complete. It includes functional
>> classes as well as command line tool and ant task implemented based on
>> them.
>> More, for dynamic tracing, a jvmti agent has been implemented. Both static
>> analysis and dynamic tracing produce a type of result file called cns
>> (Class
>> Name Set) file, which has an associated data structure called ClassNameSet
>> that can be created from a cns file, witten to a cns file and merged with
>> a
>> cns file. The cns file in the conf directory contains the required classes
>> for different jre implementations. Now it only supports Harmony.
>>
>> The toolkit can be used in two steps. First, employ both static analyzer
>> and
>> dynamic tracer in the process of application development and test, and
>> record necessary information in several cns files. Second, employ the jre
>> generator to merge these cns files and generate a new jre from an original
>> one.
>>
>> So far I have written a simple ant build file to handle the whole process
>> including compile, test, pack & javadoc. The compiling of the agent is not
>> in because I'm still learning ant usage. The test is also very simple,
>> just
>> a helloworld app:P
>>
>
> Do you have any instructions about how to build the agent?
>
>
>> I'll improve the toolkit by adding command line script, optimizing ant
>> build, doing more test and improve the algorithm if a better strategy is
>> found.
>>
>> Everyone please feel free to give me advice or report bugs to me~thx:)
>>
>> Daniel Gong
>>
>>
>
> --
> Best Regards,
> Regis.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Regis <xu...@gmail.com>.
Daniel Gong wrote:
> Hi all,
> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to call it
> MinJre Toolkit.
> 
> Now the coding of MinJreToolkit is almost complete. It includes functional
> classes as well as command line tool and ant task implemented based on them.
> More, for dynamic tracing, a jvmti agent has been implemented. Both static
> analysis and dynamic tracing produce a type of result file called cns (Class
> Name Set) file, which has an associated data structure called ClassNameSet
> that can be created from a cns file, witten to a cns file and merged with a
> cns file. The cns file in the conf directory contains the required classes
> for different jre implementations. Now it only supports Harmony.
> 
> The toolkit can be used in two steps. First, employ both static analyzer and
> dynamic tracer in the process of application development and test, and
> record necessary information in several cns files. Second, employ the jre
> generator to merge these cns files and generate a new jre from an original
> one.
> 
> So far I have written a simple ant build file to handle the whole process
> including compile, test, pack & javadoc. The compiling of the agent is not
> in because I'm still learning ant usage. The test is also very simple, just
> a helloworld app:P

Do you have any instructions about how to build the agent?

> 
> I'll improve the toolkit by adding command line script, optimizing ant
> build, doing more test and improve the algorithm if a better strategy is
> found.
> 
> Everyone please feel free to give me advice or report bugs to me~thx:)
> 
> Daniel Gong
> 


-- 
Best Regards,
Regis.

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
Another question: it seems I can delete the attachment of HARMONY-6291, is
it OK that I delete the old version of minjretoolkit?

On Mon, Aug 10, 2009 at 8:01 PM, Daniel Gong <da...@gmail.com>wrote:

> On Thu, Aug 6, 2009 at 10:55 AM, Regis <xu...@gmail.com> wrote:
>
>> Daniel Gong wrote:
>>
>>> Yes it is the problem of  the build file, I have correct it and  upload a
>>> new one:)
>>> To run it, you should modify the origin and target property in the build
>>> file to your origin jre path and the target min jre path.
>>> More, I have updated the description. Hope it will help you all and work
>>> well:)
>>>
>>> On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:
>>>
>>>  Daniel Gong wrote:
>>>>
>>>>  Sorry, that's my fault. It seems I have put the wrong version of ant
>>>>> build...I will correct it and upload it again.
>>>>>
>>>>>  It seems not a problem of ant, when I removed takedef of "analyze" and
>>>> "gen", ant compile work correct, but ant test-hello (which only depends
>>>> on
>>>> compile), reported error again:
>>>>
>>>> C:\download\minijre\build.xml:56: Execute failed: java.io.IOException:
>>>> Cannot run program "${target}
>>>> \bin\java": CreateProcess error=2, The system cannot find the file
>>>> specified
>>>>
>>>> And I found ${target} is never defined, do you mean ${target.dir} here?
>>>> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir}
>>>> ${test.dir}
>>>>
>>>> After fixing these variables and copy Harmony JRE to "origin" dir, I can
>>>> run "ant test-hello" successfully. The target directory should be
>>>> minijre,
>>>> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>>>>
>>>> I'm waiting Daniel's description, so didn't try the agent yet :)
>>>>
>>>>
>>>>
>>>>  On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>>>>
>>>>>  Daniel Gong wrote:
>>>>>
>>>>>>  Hi all,
>>>>>>
>>>>>>> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to
>>>>>>> call
>>>>>>> it
>>>>>>> MinJre Toolkit.
>>>>>>>
>>>>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>>>>> functional
>>>>>>> classes as well as command line tool and ant task implemented based
>>>>>>> on
>>>>>>> them.
>>>>>>> More, for dynamic tracing, a jvmti agent has been implemented. Both
>>>>>>> static
>>>>>>> analysis and dynamic tracing produce a type of result file called cns
>>>>>>> (Class
>>>>>>> Name Set) file, which has an associated data structure called
>>>>>>> ClassNameSet
>>>>>>> that can be created from a cns file, witten to a cns file and merged
>>>>>>> with
>>>>>>> a
>>>>>>> cns file. The cns file in the conf directory contains the required
>>>>>>> classes
>>>>>>> for different jre implementations. Now it only supports Harmony.
>>>>>>>
>>>>>>> The toolkit can be used in two steps. First, employ both static
>>>>>>> analyzer
>>>>>>> and
>>>>>>> dynamic tracer in the process of application development and test,
>>>>>>> and
>>>>>>> record necessary information in several cns files. Second, employ the
>>>>>>> jre
>>>>>>> generator to merge these cns files and generate a new jre from an
>>>>>>> original
>>>>>>> one.
>>>>>>>
>>>>>>> So far I have written a simple ant build file to handle the whole
>>>>>>> process
>>>>>>> including compile, test, pack & javadoc. The compiling of the agent
>>>>>>> is
>>>>>>> not
>>>>>>> in because I'm still learning ant usage. The test is also very
>>>>>>> simple,
>>>>>>> just
>>>>>>> a helloworld app:P
>>>>>>>
>>>>>>> I'll improve the toolkit by adding command line script, optimizing
>>>>>>> ant
>>>>>>> build, doing more test and improve the algorithm if a better strategy
>>>>>>> is
>>>>>>> found.
>>>>>>>
>>>>>>> Everyone please feel free to give me advice or report bugs to
>>>>>>> me~thx:)
>>>>>>>
>>>>>>> Daniel Gong
>>>>>>>
>>>>>>>
>>>>>>>  Well done Daniel!
>>>>>>>
>>>>>> I'm trying to build the tool. I downloaded minjretoolkit.tar.gz from
>>>>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but got
>>>>>> a
>>>>>> error:
>>>>>>
>>>>>> c:\download\minijre\build.xml:23: taskdef class
>>>>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>>>>> yTask cannot be found
>>>>>>
>>>>>> Did I miss anything?
>>>>>>
>>>>>> --
>>>>>> Best Regards,
>>>>>> Regis.
>>>>>>
>>>>>>
>>>>>>  --
>>>> Best Regards,
>>>> Regis.
>>>>
>>>>
>>>
>> I tried the new one, the build script worked fine for me. Following the
>> instructions on JIRA, I generated dynamic trace by agent and merged with
>> static one successfully, seems you have finished the core part of this tool,
>> well done!!
>>
>> While there are still places can be improved:
>
> Dear all,
>
> 1. add build scrip for native code, "ant compile" will compile both java
> and native.
>
> Done.
>
> 2. -agentlib:Agent=help print help info about how to use this agent. I you
> type java -agentlib:jdwp=help to see the example. The options of agent
> usually is name=value pattern, maybe something like: java
> -agentlib:Agent=tracefile=[filename]
>
> Done. Usage: java -agentlib:tracer=output=[filename]
>
> The zip file attached to HARMONY-6291 is the newest version of MinJre
> Toolkit.
>
> The ant build file can compile and test jvmti agent now.
>
> I have tested it under Windows XP SP3 & Ubuntu 9.04.
>
> The script directory is command line launcher for the analyzer and jregen,
> not implemented yet, but in my plan.
>
> Best Regards,
>
> Daniel Gong
>
> --
>> Best Regards,
>> Regis.
>>
>
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
I get your point. Thanks~
-Daniel

On Thu, Aug 13, 2009 at 1:27 PM, Regis <xu...@gmail.com> wrote:

> Daniel Gong wrote:
>
>> I also encountered the Ubuntu "permission denied" problem...
>> I think handling this kind of problem is the user's responsibility.
>>
>
> But it'll break build script. When we are testing it, we are using it, it's
> our responsibility to make it work.
>
> Simply adding
>
> <chmod file="${target.dir}/bin/java" perm="+x"/>
>
> after generating jre can make it work on Linux.
>
>
>
>> Thank you very much, Regis.
>>
>> -Daniel
>>
>> On Thu, Aug 13, 2009 at 10:36 AM, Regis <xu...@gmail.com> wrote:
>>
>>  Daniel Gong wrote:
>>>
>>>  On Thu, Aug 6, 2009 at 10:55 AM, Regis <xu...@gmail.com> wrote:
>>>>
>>>>  Daniel Gong wrote:
>>>>
>>>>>  Yes it is the problem of  the build file, I have correct it and
>>>>>  upload
>>>>>
>>>>>> a
>>>>>> new one:)
>>>>>> To run it, you should modify the origin and target property in the
>>>>>> build
>>>>>> file to your origin jre path and the target min jre path.
>>>>>> More, I have updated the description. Hope it will help you all and
>>>>>> work
>>>>>> well:)
>>>>>>
>>>>>> On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:
>>>>>>
>>>>>>  Daniel Gong wrote:
>>>>>>
>>>>>>   Sorry, that's my fault. It seems I have put the wrong version of ant
>>>>>>>
>>>>>>>  build...I will correct it and upload it again.
>>>>>>>>
>>>>>>>>  It seems not a problem of ant, when I removed takedef of "analyze"
>>>>>>>> and
>>>>>>>>
>>>>>>>>  "gen", ant compile work correct, but ant test-hello (which only
>>>>>>> depends
>>>>>>> on
>>>>>>> compile), reported error again:
>>>>>>>
>>>>>>> C:\download\minijre\build.xml:56: Execute failed:
>>>>>>> java.io.IOException:
>>>>>>> Cannot run program "${target}
>>>>>>> \bin\java": CreateProcess error=2, The system cannot find the file
>>>>>>> specified
>>>>>>>
>>>>>>> And I found ${target} is never defined, do you mean ${target.dir}
>>>>>>> here?
>>>>>>> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir}
>>>>>>> ${test.dir}
>>>>>>>
>>>>>>> After fixing these variables and copy Harmony JRE to "origin" dir, I
>>>>>>> can
>>>>>>> run "ant test-hello" successfully. The target directory should be
>>>>>>> minijre,
>>>>>>> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>>>>>>>
>>>>>>> I'm waiting Daniel's description, so didn't try the agent yet :)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>>>>>>
>>>>>>>   Daniel Gong wrote:
>>>>>>>>
>>>>>>>>  Hi all,
>>>>>>>>
>>>>>>>>>  I have my code attached in issue HARMONY-6291 on JIRA. I'd like to
>>>>>>>>>
>>>>>>>>>> call
>>>>>>>>>> it
>>>>>>>>>> MinJre Toolkit.
>>>>>>>>>>
>>>>>>>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>>>>>>>> functional
>>>>>>>>>> classes as well as command line tool and ant task implemented
>>>>>>>>>> based
>>>>>>>>>> on
>>>>>>>>>> them.
>>>>>>>>>> More, for dynamic tracing, a jvmti agent has been implemented.
>>>>>>>>>> Both
>>>>>>>>>> static
>>>>>>>>>> analysis and dynamic tracing produce a type of result file called
>>>>>>>>>> cns
>>>>>>>>>> (Class
>>>>>>>>>> Name Set) file, which has an associated data structure called
>>>>>>>>>> ClassNameSet
>>>>>>>>>> that can be created from a cns file, witten to a cns file and
>>>>>>>>>> merged
>>>>>>>>>> with
>>>>>>>>>> a
>>>>>>>>>> cns file. The cns file in the conf directory contains the required
>>>>>>>>>> classes
>>>>>>>>>> for different jre implementations. Now it only supports Harmony.
>>>>>>>>>>
>>>>>>>>>> The toolkit can be used in two steps. First, employ both static
>>>>>>>>>> analyzer
>>>>>>>>>> and
>>>>>>>>>> dynamic tracer in the process of application development and test,
>>>>>>>>>> and
>>>>>>>>>> record necessary information in several cns files. Second, employ
>>>>>>>>>> the
>>>>>>>>>> jre
>>>>>>>>>> generator to merge these cns files and generate a new jre from an
>>>>>>>>>> original
>>>>>>>>>> one.
>>>>>>>>>>
>>>>>>>>>> So far I have written a simple ant build file to handle the whole
>>>>>>>>>> process
>>>>>>>>>> including compile, test, pack & javadoc. The compiling of the
>>>>>>>>>> agent
>>>>>>>>>> is
>>>>>>>>>> not
>>>>>>>>>> in because I'm still learning ant usage. The test is also very
>>>>>>>>>> simple,
>>>>>>>>>> just
>>>>>>>>>> a helloworld app:P
>>>>>>>>>>
>>>>>>>>>> I'll improve the toolkit by adding command line script, optimizing
>>>>>>>>>> ant
>>>>>>>>>> build, doing more test and improve the algorithm if a better
>>>>>>>>>> strategy
>>>>>>>>>> is
>>>>>>>>>> found.
>>>>>>>>>>
>>>>>>>>>> Everyone please feel free to give me advice or report bugs to
>>>>>>>>>> me~thx:)
>>>>>>>>>>
>>>>>>>>>> Daniel Gong
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  Well done Daniel!
>>>>>>>>>>
>>>>>>>>>>  I'm trying to build the tool. I downloaded minjretoolkit.tar.gz
>>>>>>>>>>
>>>>>>>>> from
>>>>>>>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but
>>>>>>>>> got
>>>>>>>>> a
>>>>>>>>> error:
>>>>>>>>>
>>>>>>>>> c:\download\minijre\build.xml:23: taskdef class
>>>>>>>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>>>>>>>> yTask cannot be found
>>>>>>>>>
>>>>>>>>> Did I miss anything?
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Best Regards,
>>>>>>>>> Regis.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  --
>>>>>>>>>
>>>>>>>>>  Best Regards,
>>>>>>>>
>>>>>>> Regis.
>>>>>>>
>>>>>>>
>>>>>>>  I tried the new one, the build script worked fine for me. Following
>>>>>>>
>>>>>> the
>>>>> instructions on JIRA, I generated dynamic trace by agent and merged
>>>>> with
>>>>> static one successfully, seems you have finished the core part of this
>>>>> tool,
>>>>> well done!!
>>>>>
>>>>> While there are still places can be improved:
>>>>>
>>>>>  Dear all,
>>>>
>>>> 1. add build scrip for native code, "ant compile" will compile both java
>>>> and
>>>> native.
>>>>
>>>> Done.
>>>>
>>>> 2. -agentlib:Agent=help print help info about how to use this agent. I
>>>> you
>>>> type java -agentlib:jdwp=help to see the example. The options of agent
>>>> usually is name=value pattern, maybe something like: java
>>>> -agentlib:Agent=tracefile=[filename]
>>>>
>>>> Done. Usage: java -agentlib:tracer=output=[filename]
>>>>
>>>> The zip file attached to HARMONY-6291 is the newest version of MinJre
>>>> Toolkit.
>>>>
>>>> The ant build file can compile and test jvmti agent now.
>>>>
>>>> I have tested it under Windows XP SP3 & Ubuntu 9.04.
>>>>
>>>> The script directory is command line launcher for the analyzer and
>>>> jregen,
>>>> not implemented yet, but in my plan.
>>>>
>>>> Best Regards,
>>>>
>>>> Daniel Gong
>>>>
>>>>
>>>>  Hi Daniel,
>>>
>>> The new package on JIRA is good! I tried on Windows XP and Ubuntu 8.04.2,
>>> all worked fine except when trying to run generated java, it complained
>>> "Permission denied", after I added execution permission, it worked
>>> smoothly.
>>>
>>> I think it's time to integrate  Daniel's work to Harmony repository, so
>>> Daniel can work with community easily and closely, and also anyone
>>> interested on this could work on this. If no one object I'm going to
>>> apply
>>> HARMONY-6291 to [1].
>>>
>>>
>>> [1]
>>> https://svn.apache.org/repos/asf/harmony/enhanced/tools/trunk/minijre
>>>
>>> --
>>> Best Regards,
>>> Regis.
>>>
>>>
>>
>
> --
> Best Regards,
> Regis.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
Regis, I've add a page
http://wiki.apache.org/harmony/Smallest_Classes_Set_For_Customer_Application as
my doc for this project.
More, my patch has been attached to
https://issues.apache.org/jira/browse/HARMONY-6314, thx.

-Daniel

On Tue, Aug 18, 2009 at 11:30 AM, Regis <xu...@gmail.com> wrote:

> Daniel Gong wrote:
>
>> This is my doc for MinJreToolkit besides its javadoc. I don't know where
>> to
>> put it in wiki, so I post it here.
>>
>
> I created a new Page "Google Summer of Code" at
> http://wiki.apache.org/harmony/Google_Summer_of_Code
>
> you can add your project here. I also move links of proposals to this page.
>
>  Thanks for Regis's mentoring & all in the list that have ever helped me!
>>
>
> Thanks for your contributions and well done!
>
>
>
>> -Daniel
>>
>> On Mon, Aug 17, 2009 at 10:59 PM, Daniel Gong
>> <da...@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...@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/minijreat
>>>> 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.
>>>>
>>>>
>>>
>>
>
> --
> Best Regards,
> Regis.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Regis <xu...@gmail.com>.
Daniel Gong wrote:
> This is my doc for MinJreToolkit besides its javadoc. I don't know where to
> put it in wiki, so I post it here.

I created a new Page "Google Summer of Code" at 
http://wiki.apache.org/harmony/Google_Summer_of_Code

you can add your project here. I also move links of proposals to this page.

> Thanks for Regis's mentoring & all in the list that have ever helped me!

Thanks for your contributions and well done!

> 
> -Daniel
> 
> On Mon, Aug 17, 2009 at 10:59 PM, Daniel Gong
> <da...@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...@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.
>>>
>>
> 


-- 
Best Regards,
Regis.

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
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
<da...@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...@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.
>>
>
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
*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...@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.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Regis <xu...@gmail.com>.
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.

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
Hi Regis,
On Thu, Aug 13, 2009 at 1:27 PM, Regis <xu...@gmail.com> wrote:

> Daniel Gong wrote:
>
>> I also encountered the Ubuntu "permission denied" problem...
>> I think handling this kind of problem is the user's responsibility.
>>
>
> But it'll break build script. When we are testing it, we are using it, it's
> our responsibility to make it work.
>
> Simply adding
>
> <chmod file="${target.dir}/bin/java" perm="+x"/>
>

Since adding this is a small change, should I upload a new version to JIRA?

Besides, I am wondering what else should I do for GSoC?

-Daniel

> after generating jre can make it work on Linux.
>
>
>
>> Thank you very much, Regis.
>>
>> -Daniel
>>
>> On Thu, Aug 13, 2009 at 10:36 AM, Regis <xu...@gmail.com> wrote:
>>
>>  Daniel Gong wrote:
>>>
>>>  On Thu, Aug 6, 2009 at 10:55 AM, Regis <xu...@gmail.com> wrote:
>>>>
>>>>  Daniel Gong wrote:
>>>>
>>>>>  Yes it is the problem of  the build file, I have correct it and
>>>>>  upload
>>>>>
>>>>>> a
>>>>>> new one:)
>>>>>> To run it, you should modify the origin and target property in the
>>>>>> build
>>>>>> file to your origin jre path and the target min jre path.
>>>>>> More, I have updated the description. Hope it will help you all and
>>>>>> work
>>>>>> well:)
>>>>>>
>>>>>> On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:
>>>>>>
>>>>>>  Daniel Gong wrote:
>>>>>>
>>>>>>   Sorry, that's my fault. It seems I have put the wrong version of ant
>>>>>>>
>>>>>>>  build...I will correct it and upload it again.
>>>>>>>>
>>>>>>>>  It seems not a problem of ant, when I removed takedef of "analyze"
>>>>>>>> and
>>>>>>>>
>>>>>>>>  "gen", ant compile work correct, but ant test-hello (which only
>>>>>>> depends
>>>>>>> on
>>>>>>> compile), reported error again:
>>>>>>>
>>>>>>> C:\download\minijre\build.xml:56: Execute failed:
>>>>>>> java.io.IOException:
>>>>>>> Cannot run program "${target}
>>>>>>> \bin\java": CreateProcess error=2, The system cannot find the file
>>>>>>> specified
>>>>>>>
>>>>>>> And I found ${target} is never defined, do you mean ${target.dir}
>>>>>>> here?
>>>>>>> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir}
>>>>>>> ${test.dir}
>>>>>>>
>>>>>>> After fixing these variables and copy Harmony JRE to "origin" dir, I
>>>>>>> can
>>>>>>> run "ant test-hello" successfully. The target directory should be
>>>>>>> minijre,
>>>>>>> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>>>>>>>
>>>>>>> I'm waiting Daniel's description, so didn't try the agent yet :)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>>>>>>
>>>>>>>   Daniel Gong wrote:
>>>>>>>>
>>>>>>>>  Hi all,
>>>>>>>>
>>>>>>>>>  I have my code attached in issue HARMONY-6291 on JIRA. I'd like to
>>>>>>>>>
>>>>>>>>>> call
>>>>>>>>>> it
>>>>>>>>>> MinJre Toolkit.
>>>>>>>>>>
>>>>>>>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>>>>>>>> functional
>>>>>>>>>> classes as well as command line tool and ant task implemented
>>>>>>>>>> based
>>>>>>>>>> on
>>>>>>>>>> them.
>>>>>>>>>> More, for dynamic tracing, a jvmti agent has been implemented.
>>>>>>>>>> Both
>>>>>>>>>> static
>>>>>>>>>> analysis and dynamic tracing produce a type of result file called
>>>>>>>>>> cns
>>>>>>>>>> (Class
>>>>>>>>>> Name Set) file, which has an associated data structure called
>>>>>>>>>> ClassNameSet
>>>>>>>>>> that can be created from a cns file, witten to a cns file and
>>>>>>>>>> merged
>>>>>>>>>> with
>>>>>>>>>> a
>>>>>>>>>> cns file. The cns file in the conf directory contains the required
>>>>>>>>>> classes
>>>>>>>>>> for different jre implementations. Now it only supports Harmony.
>>>>>>>>>>
>>>>>>>>>> The toolkit can be used in two steps. First, employ both static
>>>>>>>>>> analyzer
>>>>>>>>>> and
>>>>>>>>>> dynamic tracer in the process of application development and test,
>>>>>>>>>> and
>>>>>>>>>> record necessary information in several cns files. Second, employ
>>>>>>>>>> the
>>>>>>>>>> jre
>>>>>>>>>> generator to merge these cns files and generate a new jre from an
>>>>>>>>>> original
>>>>>>>>>> one.
>>>>>>>>>>
>>>>>>>>>> So far I have written a simple ant build file to handle the whole
>>>>>>>>>> process
>>>>>>>>>> including compile, test, pack & javadoc. The compiling of the
>>>>>>>>>> agent
>>>>>>>>>> is
>>>>>>>>>> not
>>>>>>>>>> in because I'm still learning ant usage. The test is also very
>>>>>>>>>> simple,
>>>>>>>>>> just
>>>>>>>>>> a helloworld app:P
>>>>>>>>>>
>>>>>>>>>> I'll improve the toolkit by adding command line script, optimizing
>>>>>>>>>> ant
>>>>>>>>>> build, doing more test and improve the algorithm if a better
>>>>>>>>>> strategy
>>>>>>>>>> is
>>>>>>>>>> found.
>>>>>>>>>>
>>>>>>>>>> Everyone please feel free to give me advice or report bugs to
>>>>>>>>>> me~thx:)
>>>>>>>>>>
>>>>>>>>>> Daniel Gong
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  Well done Daniel!
>>>>>>>>>>
>>>>>>>>>>  I'm trying to build the tool. I downloaded minjretoolkit.tar.gz
>>>>>>>>>>
>>>>>>>>> from
>>>>>>>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but
>>>>>>>>> got
>>>>>>>>> a
>>>>>>>>> error:
>>>>>>>>>
>>>>>>>>> c:\download\minijre\build.xml:23: taskdef class
>>>>>>>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>>>>>>>> yTask cannot be found
>>>>>>>>>
>>>>>>>>> Did I miss anything?
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Best Regards,
>>>>>>>>> Regis.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  --
>>>>>>>>>
>>>>>>>>>  Best Regards,
>>>>>>>>
>>>>>>> Regis.
>>>>>>>
>>>>>>>
>>>>>>>  I tried the new one, the build script worked fine for me. Following
>>>>>>>
>>>>>> the
>>>>> instructions on JIRA, I generated dynamic trace by agent and merged
>>>>> with
>>>>> static one successfully, seems you have finished the core part of this
>>>>> tool,
>>>>> well done!!
>>>>>
>>>>> While there are still places can be improved:
>>>>>
>>>>>  Dear all,
>>>>
>>>> 1. add build scrip for native code, "ant compile" will compile both java
>>>> and
>>>> native.
>>>>
>>>> Done.
>>>>
>>>> 2. -agentlib:Agent=help print help info about how to use this agent. I
>>>> you
>>>> type java -agentlib:jdwp=help to see the example. The options of agent
>>>> usually is name=value pattern, maybe something like: java
>>>> -agentlib:Agent=tracefile=[filename]
>>>>
>>>> Done. Usage: java -agentlib:tracer=output=[filename]
>>>>
>>>> The zip file attached to HARMONY-6291 is the newest version of MinJre
>>>> Toolkit.
>>>>
>>>> The ant build file can compile and test jvmti agent now.
>>>>
>>>> I have tested it under Windows XP SP3 & Ubuntu 9.04.
>>>>
>>>> The script directory is command line launcher for the analyzer and
>>>> jregen,
>>>> not implemented yet, but in my plan.
>>>>
>>>> Best Regards,
>>>>
>>>> Daniel Gong
>>>>
>>>>
>>>>  Hi Daniel,
>>>
>>> The new package on JIRA is good! I tried on Windows XP and Ubuntu 8.04.2,
>>> all worked fine except when trying to run generated java, it complained
>>> "Permission denied", after I added execution permission, it worked
>>> smoothly.
>>>
>>> I think it's time to integrate  Daniel's work to Harmony repository, so
>>> Daniel can work with community easily and closely, and also anyone
>>> interested on this could work on this. If no one object I'm going to
>>> apply
>>> HARMONY-6291 to [1].
>>>
>>>
>>> [1]
>>> https://svn.apache.org/repos/asf/harmony/enhanced/tools/trunk/minijre
>>>
>>> --
>>> Best Regards,
>>> Regis.
>>>
>>>
>>
>
> --
> Best Regards,
> Regis.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Regis <xu...@gmail.com>.
Daniel Gong wrote:
> I also encountered the Ubuntu "permission denied" problem...
> I think handling this kind of problem is the user's responsibility.

But it'll break build script. When we are testing it, we are using it, it's our 
responsibility to make it work.

Simply adding

<chmod file="${target.dir}/bin/java" perm="+x"/>

after generating jre can make it work on Linux.

> 
> Thank you very much, Regis.
> 
> -Daniel
> 
> On Thu, Aug 13, 2009 at 10:36 AM, Regis <xu...@gmail.com> wrote:
> 
>> Daniel Gong wrote:
>>
>>> On Thu, Aug 6, 2009 at 10:55 AM, Regis <xu...@gmail.com> wrote:
>>>
>>>  Daniel Gong wrote:
>>>>  Yes it is the problem of  the build file, I have correct it and  upload
>>>>> a
>>>>> new one:)
>>>>> To run it, you should modify the origin and target property in the build
>>>>> file to your origin jre path and the target min jre path.
>>>>> More, I have updated the description. Hope it will help you all and work
>>>>> well:)
>>>>>
>>>>> On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:
>>>>>
>>>>>  Daniel Gong wrote:
>>>>>
>>>>>>  Sorry, that's my fault. It seems I have put the wrong version of ant
>>>>>>
>>>>>>> build...I will correct it and upload it again.
>>>>>>>
>>>>>>>  It seems not a problem of ant, when I removed takedef of "analyze"
>>>>>>> and
>>>>>>>
>>>>>> "gen", ant compile work correct, but ant test-hello (which only depends
>>>>>> on
>>>>>> compile), reported error again:
>>>>>>
>>>>>> C:\download\minijre\build.xml:56: Execute failed: java.io.IOException:
>>>>>> Cannot run program "${target}
>>>>>> \bin\java": CreateProcess error=2, The system cannot find the file
>>>>>> specified
>>>>>>
>>>>>> And I found ${target} is never defined, do you mean ${target.dir} here?
>>>>>> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir}
>>>>>> ${test.dir}
>>>>>>
>>>>>> After fixing these variables and copy Harmony JRE to "origin" dir, I
>>>>>> can
>>>>>> run "ant test-hello" successfully. The target directory should be
>>>>>> minijre,
>>>>>> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>>>>>>
>>>>>> I'm waiting Daniel's description, so didn't try the agent yet :)
>>>>>>
>>>>>>
>>>>>>
>>>>>>  On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>>>>>
>>>>>>>  Daniel Gong wrote:
>>>>>>>
>>>>>>>   Hi all,
>>>>>>>>  I have my code attached in issue HARMONY-6291 on JIRA. I'd like to
>>>>>>>>> call
>>>>>>>>> it
>>>>>>>>> MinJre Toolkit.
>>>>>>>>>
>>>>>>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>>>>>>> functional
>>>>>>>>> classes as well as command line tool and ant task implemented based
>>>>>>>>> on
>>>>>>>>> them.
>>>>>>>>> More, for dynamic tracing, a jvmti agent has been implemented. Both
>>>>>>>>> static
>>>>>>>>> analysis and dynamic tracing produce a type of result file called
>>>>>>>>> cns
>>>>>>>>> (Class
>>>>>>>>> Name Set) file, which has an associated data structure called
>>>>>>>>> ClassNameSet
>>>>>>>>> that can be created from a cns file, witten to a cns file and merged
>>>>>>>>> with
>>>>>>>>> a
>>>>>>>>> cns file. The cns file in the conf directory contains the required
>>>>>>>>> classes
>>>>>>>>> for different jre implementations. Now it only supports Harmony.
>>>>>>>>>
>>>>>>>>> The toolkit can be used in two steps. First, employ both static
>>>>>>>>> analyzer
>>>>>>>>> and
>>>>>>>>> dynamic tracer in the process of application development and test,
>>>>>>>>> and
>>>>>>>>> record necessary information in several cns files. Second, employ
>>>>>>>>> the
>>>>>>>>> jre
>>>>>>>>> generator to merge these cns files and generate a new jre from an
>>>>>>>>> original
>>>>>>>>> one.
>>>>>>>>>
>>>>>>>>> So far I have written a simple ant build file to handle the whole
>>>>>>>>> process
>>>>>>>>> including compile, test, pack & javadoc. The compiling of the agent
>>>>>>>>> is
>>>>>>>>> not
>>>>>>>>> in because I'm still learning ant usage. The test is also very
>>>>>>>>> simple,
>>>>>>>>> just
>>>>>>>>> a helloworld app:P
>>>>>>>>>
>>>>>>>>> I'll improve the toolkit by adding command line script, optimizing
>>>>>>>>> ant
>>>>>>>>> build, doing more test and improve the algorithm if a better
>>>>>>>>> strategy
>>>>>>>>> is
>>>>>>>>> found.
>>>>>>>>>
>>>>>>>>> Everyone please feel free to give me advice or report bugs to
>>>>>>>>> me~thx:)
>>>>>>>>>
>>>>>>>>> Daniel Gong
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  Well done Daniel!
>>>>>>>>>
>>>>>>>>>  I'm trying to build the tool. I downloaded minjretoolkit.tar.gz
>>>>>>>> from
>>>>>>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but
>>>>>>>> got
>>>>>>>> a
>>>>>>>> error:
>>>>>>>>
>>>>>>>> c:\download\minijre\build.xml:23: taskdef class
>>>>>>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>>>>>>> yTask cannot be found
>>>>>>>>
>>>>>>>> Did I miss anything?
>>>>>>>>
>>>>>>>> --
>>>>>>>> Best Regards,
>>>>>>>> Regis.
>>>>>>>>
>>>>>>>>
>>>>>>>>  --
>>>>>>>>
>>>>>>> Best Regards,
>>>>>> Regis.
>>>>>>
>>>>>>
>>>>>>  I tried the new one, the build script worked fine for me. Following
>>>> the
>>>> instructions on JIRA, I generated dynamic trace by agent and merged with
>>>> static one successfully, seems you have finished the core part of this
>>>> tool,
>>>> well done!!
>>>>
>>>> While there are still places can be improved:
>>>>
>>> Dear all,
>>>
>>> 1. add build scrip for native code, "ant compile" will compile both java
>>> and
>>> native.
>>>
>>> Done.
>>>
>>> 2. -agentlib:Agent=help print help info about how to use this agent. I you
>>> type java -agentlib:jdwp=help to see the example. The options of agent
>>> usually is name=value pattern, maybe something like: java
>>> -agentlib:Agent=tracefile=[filename]
>>>
>>> Done. Usage: java -agentlib:tracer=output=[filename]
>>>
>>> The zip file attached to HARMONY-6291 is the newest version of MinJre
>>> Toolkit.
>>>
>>> The ant build file can compile and test jvmti agent now.
>>>
>>> I have tested it under Windows XP SP3 & Ubuntu 9.04.
>>>
>>> The script directory is command line launcher for the analyzer and jregen,
>>> not implemented yet, but in my plan.
>>>
>>> Best Regards,
>>>
>>> Daniel Gong
>>>
>>>
>> Hi Daniel,
>>
>> The new package on JIRA is good! I tried on Windows XP and Ubuntu 8.04.2,
>> all worked fine except when trying to run generated java, it complained
>> "Permission denied", after I added execution permission, it worked smoothly.
>>
>> I think it's time to integrate  Daniel's work to Harmony repository, so
>> Daniel can work with community easily and closely, and also anyone
>> interested on this could work on this. If no one object I'm going to apply
>> HARMONY-6291 to [1].
>>
>>
>> [1] https://svn.apache.org/repos/asf/harmony/enhanced/tools/trunk/minijre
>>
>> --
>> Best Regards,
>> Regis.
>>
> 


-- 
Best Regards,
Regis.

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
I also encountered the Ubuntu "permission denied" problem...
I think handling this kind of problem is the user's responsibility.

Thank you very much, Regis.

-Daniel

On Thu, Aug 13, 2009 at 10:36 AM, Regis <xu...@gmail.com> wrote:

> Daniel Gong wrote:
>
>> On Thu, Aug 6, 2009 at 10:55 AM, Regis <xu...@gmail.com> wrote:
>>
>>  Daniel Gong wrote:
>>>
>>>  Yes it is the problem of  the build file, I have correct it and  upload
>>>> a
>>>> new one:)
>>>> To run it, you should modify the origin and target property in the build
>>>> file to your origin jre path and the target min jre path.
>>>> More, I have updated the description. Hope it will help you all and work
>>>> well:)
>>>>
>>>> On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:
>>>>
>>>>  Daniel Gong wrote:
>>>>
>>>>>  Sorry, that's my fault. It seems I have put the wrong version of ant
>>>>>
>>>>>> build...I will correct it and upload it again.
>>>>>>
>>>>>>  It seems not a problem of ant, when I removed takedef of "analyze"
>>>>>> and
>>>>>>
>>>>> "gen", ant compile work correct, but ant test-hello (which only depends
>>>>> on
>>>>> compile), reported error again:
>>>>>
>>>>> C:\download\minijre\build.xml:56: Execute failed: java.io.IOException:
>>>>> Cannot run program "${target}
>>>>> \bin\java": CreateProcess error=2, The system cannot find the file
>>>>> specified
>>>>>
>>>>> And I found ${target} is never defined, do you mean ${target.dir} here?
>>>>> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir}
>>>>> ${test.dir}
>>>>>
>>>>> After fixing these variables and copy Harmony JRE to "origin" dir, I
>>>>> can
>>>>> run "ant test-hello" successfully. The target directory should be
>>>>> minijre,
>>>>> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>>>>>
>>>>> I'm waiting Daniel's description, so didn't try the agent yet :)
>>>>>
>>>>>
>>>>>
>>>>>  On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>>>>
>>>>>>  Daniel Gong wrote:
>>>>>>
>>>>>>   Hi all,
>>>>>>>
>>>>>>>  I have my code attached in issue HARMONY-6291 on JIRA. I'd like to
>>>>>>>> call
>>>>>>>> it
>>>>>>>> MinJre Toolkit.
>>>>>>>>
>>>>>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>>>>>> functional
>>>>>>>> classes as well as command line tool and ant task implemented based
>>>>>>>> on
>>>>>>>> them.
>>>>>>>> More, for dynamic tracing, a jvmti agent has been implemented. Both
>>>>>>>> static
>>>>>>>> analysis and dynamic tracing produce a type of result file called
>>>>>>>> cns
>>>>>>>> (Class
>>>>>>>> Name Set) file, which has an associated data structure called
>>>>>>>> ClassNameSet
>>>>>>>> that can be created from a cns file, witten to a cns file and merged
>>>>>>>> with
>>>>>>>> a
>>>>>>>> cns file. The cns file in the conf directory contains the required
>>>>>>>> classes
>>>>>>>> for different jre implementations. Now it only supports Harmony.
>>>>>>>>
>>>>>>>> The toolkit can be used in two steps. First, employ both static
>>>>>>>> analyzer
>>>>>>>> and
>>>>>>>> dynamic tracer in the process of application development and test,
>>>>>>>> and
>>>>>>>> record necessary information in several cns files. Second, employ
>>>>>>>> the
>>>>>>>> jre
>>>>>>>> generator to merge these cns files and generate a new jre from an
>>>>>>>> original
>>>>>>>> one.
>>>>>>>>
>>>>>>>> So far I have written a simple ant build file to handle the whole
>>>>>>>> process
>>>>>>>> including compile, test, pack & javadoc. The compiling of the agent
>>>>>>>> is
>>>>>>>> not
>>>>>>>> in because I'm still learning ant usage. The test is also very
>>>>>>>> simple,
>>>>>>>> just
>>>>>>>> a helloworld app:P
>>>>>>>>
>>>>>>>> I'll improve the toolkit by adding command line script, optimizing
>>>>>>>> ant
>>>>>>>> build, doing more test and improve the algorithm if a better
>>>>>>>> strategy
>>>>>>>> is
>>>>>>>> found.
>>>>>>>>
>>>>>>>> Everyone please feel free to give me advice or report bugs to
>>>>>>>> me~thx:)
>>>>>>>>
>>>>>>>> Daniel Gong
>>>>>>>>
>>>>>>>>
>>>>>>>>  Well done Daniel!
>>>>>>>>
>>>>>>>>  I'm trying to build the tool. I downloaded minjretoolkit.tar.gz
>>>>>>> from
>>>>>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but
>>>>>>> got
>>>>>>> a
>>>>>>> error:
>>>>>>>
>>>>>>> c:\download\minijre\build.xml:23: taskdef class
>>>>>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>>>>>> yTask cannot be found
>>>>>>>
>>>>>>> Did I miss anything?
>>>>>>>
>>>>>>> --
>>>>>>> Best Regards,
>>>>>>> Regis.
>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>>
>>>>>> Best Regards,
>>>>> Regis.
>>>>>
>>>>>
>>>>>  I tried the new one, the build script worked fine for me. Following
>>> the
>>> instructions on JIRA, I generated dynamic trace by agent and merged with
>>> static one successfully, seems you have finished the core part of this
>>> tool,
>>> well done!!
>>>
>>> While there are still places can be improved:
>>>
>>
>> Dear all,
>>
>> 1. add build scrip for native code, "ant compile" will compile both java
>> and
>> native.
>>
>> Done.
>>
>> 2. -agentlib:Agent=help print help info about how to use this agent. I you
>> type java -agentlib:jdwp=help to see the example. The options of agent
>> usually is name=value pattern, maybe something like: java
>> -agentlib:Agent=tracefile=[filename]
>>
>> Done. Usage: java -agentlib:tracer=output=[filename]
>>
>> The zip file attached to HARMONY-6291 is the newest version of MinJre
>> Toolkit.
>>
>> The ant build file can compile and test jvmti agent now.
>>
>> I have tested it under Windows XP SP3 & Ubuntu 9.04.
>>
>> The script directory is command line launcher for the analyzer and jregen,
>> not implemented yet, but in my plan.
>>
>> Best Regards,
>>
>> Daniel Gong
>>
>>
> Hi Daniel,
>
> The new package on JIRA is good! I tried on Windows XP and Ubuntu 8.04.2,
> all worked fine except when trying to run generated java, it complained
> "Permission denied", after I added execution permission, it worked smoothly.
>
> I think it's time to integrate  Daniel's work to Harmony repository, so
> Daniel can work with community easily and closely, and also anyone
> interested on this could work on this. If no one object I'm going to apply
> HARMONY-6291 to [1].
>
>
> [1] https://svn.apache.org/repos/asf/harmony/enhanced/tools/trunk/minijre
>
> --
> Best Regards,
> Regis.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Jin Mingjian <ji...@gmail.com>.
good news!:)



2009/8/13 Regis <xu...@gmail.com>

>  Daniel Gong wrote:
>
>> On Thu, Aug 6, 2009 at 10:55 AM, Regis <xu...@gmail.com> wrote:
>>
>> Daniel Gong wrote:
>>>
>>> Yes it is the problem of  the build file, I have correct it and  upload a
>>>> new one:)
>>>> To run it, you should modify the origin and target property in the build
>>>> file to your origin jre path and the target min jre path.
>>>> More, I have updated the description. Hope it will help you all and work
>>>> well:)
>>>>
>>>> On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:
>>>>
>>>>  Daniel Gong wrote:
>>>>
>>>>>  Sorry, that's my fault. It seems I have put the wrong version of ant
>>>>>
>>>>>> build...I will correct it and upload it again.
>>>>>>
>>>>>>  It seems not a problem of ant, when I removed takedef of "analyze"
>>>>>> and
>>>>>>
>>>>> "gen", ant compile work correct, but ant test-hello (which only depends
>>>>> on
>>>>> compile), reported error again:
>>>>>
>>>>> C:\download\minijre\build.xml:56: Execute failed: java.io.IOException:
>>>>> Cannot run program "${target}
>>>>> \bin\java": CreateProcess error=2, The system cannot find the file
>>>>> specified
>>>>>
>>>>> And I found ${target} is never defined, do you mean ${target.dir} here?
>>>>> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir}
>>>>> ${test.dir}
>>>>>
>>>>> After fixing these variables and copy Harmony JRE to "origin" dir, I
>>>>> can
>>>>> run "ant test-hello" successfully. The target directory should be
>>>>> minijre,
>>>>> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>>>>>
>>>>> I'm waiting Daniel's description, so didn't try the agent yet :)
>>>>>
>>>>>
>>>>>
>>>>>  On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>>>>
>>>>>>  Daniel Gong wrote:
>>>>>>
>>>>>>  Hi all,
>>>>>>>
>>>>>>> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to
>>>>>>>> call
>>>>>>>> it
>>>>>>>> MinJre Toolkit.
>>>>>>>>
>>>>>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>>>>>> functional
>>>>>>>> classes as well as command line tool and ant task implemented based
>>>>>>>> on
>>>>>>>> them.
>>>>>>>> More, for dynamic tracing, a jvmti agent has been implemented. Both
>>>>>>>> static
>>>>>>>> analysis and dynamic tracing produce a type of result file called
>>>>>>>> cns
>>>>>>>> (Class
>>>>>>>> Name Set) file, which has an associated data structure called
>>>>>>>> ClassNameSet
>>>>>>>> that can be created from a cns file, witten to a cns file and merged
>>>>>>>> with
>>>>>>>> a
>>>>>>>> cns file. The cns file in the conf directory contains the required
>>>>>>>> classes
>>>>>>>> for different jre implementations. Now it only supports Harmony.
>>>>>>>>
>>>>>>>> The toolkit can be used in two steps. First, employ both static
>>>>>>>> analyzer
>>>>>>>> and
>>>>>>>> dynamic tracer in the process of application development and test,
>>>>>>>> and
>>>>>>>> record necessary information in several cns files. Second, employ
>>>>>>>> the
>>>>>>>> jre
>>>>>>>> generator to merge these cns files and generate a new jre from an
>>>>>>>> original
>>>>>>>> one.
>>>>>>>>
>>>>>>>> So far I have written a simple ant build file to handle the whole
>>>>>>>> process
>>>>>>>> including compile, test, pack & javadoc. The compiling of the agent
>>>>>>>> is
>>>>>>>> not
>>>>>>>> in because I'm still learning ant usage. The test is also very
>>>>>>>> simple,
>>>>>>>> just
>>>>>>>> a helloworld app:P
>>>>>>>>
>>>>>>>> I'll improve the toolkit by adding command line script, optimizing
>>>>>>>> ant
>>>>>>>> build, doing more test and improve the algorithm if a better
>>>>>>>> strategy
>>>>>>>> is
>>>>>>>> found.
>>>>>>>>
>>>>>>>> Everyone please feel free to give me advice or report bugs to
>>>>>>>> me~thx:)
>>>>>>>>
>>>>>>>> Daniel Gong
>>>>>>>>
>>>>>>>>
>>>>>>>>  Well done Daniel!
>>>>>>>>
>>>>>>>> I'm trying to build the tool. I downloaded minjretoolkit.tar.gz from
>>>>>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but
>>>>>>> got
>>>>>>> a
>>>>>>> error:
>>>>>>>
>>>>>>> c:\download\minijre\build.xml:23: taskdef class
>>>>>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>>>>>> yTask cannot be found
>>>>>>>
>>>>>>> Did I miss anything?
>>>>>>>
>>>>>>> --
>>>>>>> Best Regards,
>>>>>>> Regis.
>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>>
>>>>>> Best Regards,
>>>>> Regis.
>>>>>
>>>>>
>>>>> I tried the new one, the build script worked fine for me. Following the
>>> instructions on JIRA, I generated dynamic trace by agent and merged with
>>> static one successfully, seems you have finished the core part of this
>>> tool,
>>> well done!!
>>>
>>> While there are still places can be improved:
>>>
>>
>> Dear all,
>>
>> 1. add build scrip for native code, "ant compile" will compile both java
>> and
>> native.
>>
>> Done.
>>
>> 2. -agentlib:Agent=help print help info about how to use this agent. I you
>> type java -agentlib:jdwp=help to see the example. The options of agent
>> usually is name=value pattern, maybe something like: java
>> -agentlib:Agent=tracefile=[filename]
>>
>> Done. Usage: java -agentlib:tracer=output=[filename]
>>
>> The zip file attached to HARMONY-6291 is the newest version of MinJre
>> Toolkit.
>>
>> The ant build file can compile and test jvmti agent now.
>>
>> I have tested it under Windows XP SP3 & Ubuntu 9.04.
>>
>> The script directory is command line launcher for the analyzer and jregen,
>> not implemented yet, but in my plan.
>>
>> Best Regards,
>>
>> Daniel Gong
>>
>>
> Hi Daniel,
>
> The new package on JIRA is good! I tried on Windows XP and Ubuntu 8.04.2,
> all worked fine except when trying to run generated java, it complained
> "Permission denied", after I added execution permission, it worked smoothly.
>
> I think it's time to integrate  Daniel's work to Harmony repository, so
> Daniel can work with community easily and closely, and also anyone
> interested on this could work on this. If no one object I'm going to apply
> HARMONY-6291 to [1].
>
>
> [1] https://svn.apache.org/repos/asf/harmony/enhanced/tools/trunk/minijre
>
> --
> Best Regards,
> Regis.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Regis <xu...@gmail.com>.
Daniel Gong wrote:
> On Thu, Aug 6, 2009 at 10:55 AM, Regis <xu...@gmail.com> wrote:
> 
>> Daniel Gong wrote:
>>
>>> Yes it is the problem of  the build file, I have correct it and  upload a
>>> new one:)
>>> To run it, you should modify the origin and target property in the build
>>> file to your origin jre path and the target min jre path.
>>> More, I have updated the description. Hope it will help you all and work
>>> well:)
>>>
>>> On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:
>>>
>>>  Daniel Gong wrote:
>>>>  Sorry, that's my fault. It seems I have put the wrong version of ant
>>>>> build...I will correct it and upload it again.
>>>>>
>>>>>  It seems not a problem of ant, when I removed takedef of "analyze" and
>>>> "gen", ant compile work correct, but ant test-hello (which only depends
>>>> on
>>>> compile), reported error again:
>>>>
>>>> C:\download\minijre\build.xml:56: Execute failed: java.io.IOException:
>>>> Cannot run program "${target}
>>>> \bin\java": CreateProcess error=2, The system cannot find the file
>>>> specified
>>>>
>>>> And I found ${target} is never defined, do you mean ${target.dir} here?
>>>> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir}
>>>> ${test.dir}
>>>>
>>>> After fixing these variables and copy Harmony JRE to "origin" dir, I can
>>>> run "ant test-hello" successfully. The target directory should be
>>>> minijre,
>>>> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>>>>
>>>> I'm waiting Daniel's description, so didn't try the agent yet :)
>>>>
>>>>
>>>>
>>>>  On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>>>>  Daniel Gong wrote:
>>>>>
>>>>>>  Hi all,
>>>>>>
>>>>>>> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to
>>>>>>> call
>>>>>>> it
>>>>>>> MinJre Toolkit.
>>>>>>>
>>>>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>>>>> functional
>>>>>>> classes as well as command line tool and ant task implemented based on
>>>>>>> them.
>>>>>>> More, for dynamic tracing, a jvmti agent has been implemented. Both
>>>>>>> static
>>>>>>> analysis and dynamic tracing produce a type of result file called cns
>>>>>>> (Class
>>>>>>> Name Set) file, which has an associated data structure called
>>>>>>> ClassNameSet
>>>>>>> that can be created from a cns file, witten to a cns file and merged
>>>>>>> with
>>>>>>> a
>>>>>>> cns file. The cns file in the conf directory contains the required
>>>>>>> classes
>>>>>>> for different jre implementations. Now it only supports Harmony.
>>>>>>>
>>>>>>> The toolkit can be used in two steps. First, employ both static
>>>>>>> analyzer
>>>>>>> and
>>>>>>> dynamic tracer in the process of application development and test, and
>>>>>>> record necessary information in several cns files. Second, employ the
>>>>>>> jre
>>>>>>> generator to merge these cns files and generate a new jre from an
>>>>>>> original
>>>>>>> one.
>>>>>>>
>>>>>>> So far I have written a simple ant build file to handle the whole
>>>>>>> process
>>>>>>> including compile, test, pack & javadoc. The compiling of the agent is
>>>>>>> not
>>>>>>> in because I'm still learning ant usage. The test is also very simple,
>>>>>>> just
>>>>>>> a helloworld app:P
>>>>>>>
>>>>>>> I'll improve the toolkit by adding command line script, optimizing ant
>>>>>>> build, doing more test and improve the algorithm if a better strategy
>>>>>>> is
>>>>>>> found.
>>>>>>>
>>>>>>> Everyone please feel free to give me advice or report bugs to me~thx:)
>>>>>>>
>>>>>>> Daniel Gong
>>>>>>>
>>>>>>>
>>>>>>>  Well done Daniel!
>>>>>>>
>>>>>> I'm trying to build the tool. I downloaded minjretoolkit.tar.gz from
>>>>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but got
>>>>>> a
>>>>>> error:
>>>>>>
>>>>>> c:\download\minijre\build.xml:23: taskdef class
>>>>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>>>>> yTask cannot be found
>>>>>>
>>>>>> Did I miss anything?
>>>>>>
>>>>>> --
>>>>>> Best Regards,
>>>>>> Regis.
>>>>>>
>>>>>>
>>>>>>  --
>>>> Best Regards,
>>>> Regis.
>>>>
>>>>
>> I tried the new one, the build script worked fine for me. Following the
>> instructions on JIRA, I generated dynamic trace by agent and merged with
>> static one successfully, seems you have finished the core part of this tool,
>> well done!!
>>
>> While there are still places can be improved:
> 
> Dear all,
> 
> 1. add build scrip for native code, "ant compile" will compile both java and
> native.
> 
> Done.
> 
> 2. -agentlib:Agent=help print help info about how to use this agent. I you
> type java -agentlib:jdwp=help to see the example. The options of agent
> usually is name=value pattern, maybe something like: java
> -agentlib:Agent=tracefile=[filename]
> 
> Done. Usage: java -agentlib:tracer=output=[filename]
> 
> The zip file attached to HARMONY-6291 is the newest version of MinJre
> Toolkit.
> 
> The ant build file can compile and test jvmti agent now.
> 
> I have tested it under Windows XP SP3 & Ubuntu 9.04.
> 
> The script directory is command line launcher for the analyzer and jregen,
> not implemented yet, but in my plan.
> 
> Best Regards,
> 
> Daniel Gong
> 

Hi Daniel,

The new package on JIRA is good! I tried on Windows XP and Ubuntu 8.04.2, all 
worked fine except when trying to run generated java, it complained "Permission 
denied", after I added execution permission, it worked smoothly.

I think it's time to integrate  Daniel's work to Harmony repository, so Daniel 
can work with community easily and closely, and also anyone interested on this 
could work on this. If no one object I'm going to apply HARMONY-6291 to [1].


[1] https://svn.apache.org/repos/asf/harmony/enhanced/tools/trunk/minijre

-- 
Best Regards,
Regis.

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
On Thu, Aug 6, 2009 at 10:55 AM, Regis <xu...@gmail.com> wrote:

> Daniel Gong wrote:
>
>> Yes it is the problem of  the build file, I have correct it and  upload a
>> new one:)
>> To run it, you should modify the origin and target property in the build
>> file to your origin jre path and the target min jre path.
>> More, I have updated the description. Hope it will help you all and work
>> well:)
>>
>> On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:
>>
>>  Daniel Gong wrote:
>>>
>>>  Sorry, that's my fault. It seems I have put the wrong version of ant
>>>> build...I will correct it and upload it again.
>>>>
>>>>  It seems not a problem of ant, when I removed takedef of "analyze" and
>>> "gen", ant compile work correct, but ant test-hello (which only depends
>>> on
>>> compile), reported error again:
>>>
>>> C:\download\minijre\build.xml:56: Execute failed: java.io.IOException:
>>> Cannot run program "${target}
>>> \bin\java": CreateProcess error=2, The system cannot find the file
>>> specified
>>>
>>> And I found ${target} is never defined, do you mean ${target.dir} here?
>>> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir}
>>> ${test.dir}
>>>
>>> After fixing these variables and copy Harmony JRE to "origin" dir, I can
>>> run "ant test-hello" successfully. The target directory should be
>>> minijre,
>>> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>>>
>>> I'm waiting Daniel's description, so didn't try the agent yet :)
>>>
>>>
>>>
>>>  On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>>>
>>>>  Daniel Gong wrote:
>>>>
>>>>>  Hi all,
>>>>>
>>>>>> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to
>>>>>> call
>>>>>> it
>>>>>> MinJre Toolkit.
>>>>>>
>>>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>>>> functional
>>>>>> classes as well as command line tool and ant task implemented based on
>>>>>> them.
>>>>>> More, for dynamic tracing, a jvmti agent has been implemented. Both
>>>>>> static
>>>>>> analysis and dynamic tracing produce a type of result file called cns
>>>>>> (Class
>>>>>> Name Set) file, which has an associated data structure called
>>>>>> ClassNameSet
>>>>>> that can be created from a cns file, witten to a cns file and merged
>>>>>> with
>>>>>> a
>>>>>> cns file. The cns file in the conf directory contains the required
>>>>>> classes
>>>>>> for different jre implementations. Now it only supports Harmony.
>>>>>>
>>>>>> The toolkit can be used in two steps. First, employ both static
>>>>>> analyzer
>>>>>> and
>>>>>> dynamic tracer in the process of application development and test, and
>>>>>> record necessary information in several cns files. Second, employ the
>>>>>> jre
>>>>>> generator to merge these cns files and generate a new jre from an
>>>>>> original
>>>>>> one.
>>>>>>
>>>>>> So far I have written a simple ant build file to handle the whole
>>>>>> process
>>>>>> including compile, test, pack & javadoc. The compiling of the agent is
>>>>>> not
>>>>>> in because I'm still learning ant usage. The test is also very simple,
>>>>>> just
>>>>>> a helloworld app:P
>>>>>>
>>>>>> I'll improve the toolkit by adding command line script, optimizing ant
>>>>>> build, doing more test and improve the algorithm if a better strategy
>>>>>> is
>>>>>> found.
>>>>>>
>>>>>> Everyone please feel free to give me advice or report bugs to me~thx:)
>>>>>>
>>>>>> Daniel Gong
>>>>>>
>>>>>>
>>>>>>  Well done Daniel!
>>>>>>
>>>>> I'm trying to build the tool. I downloaded minjretoolkit.tar.gz from
>>>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but got
>>>>> a
>>>>> error:
>>>>>
>>>>> c:\download\minijre\build.xml:23: taskdef class
>>>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>>>> yTask cannot be found
>>>>>
>>>>> Did I miss anything?
>>>>>
>>>>> --
>>>>> Best Regards,
>>>>> Regis.
>>>>>
>>>>>
>>>>>  --
>>> Best Regards,
>>> Regis.
>>>
>>>
>>
> I tried the new one, the build script worked fine for me. Following the
> instructions on JIRA, I generated dynamic trace by agent and merged with
> static one successfully, seems you have finished the core part of this tool,
> well done!!
>
> While there are still places can be improved:

Dear all,

1. add build scrip for native code, "ant compile" will compile both java and
native.

Done.

2. -agentlib:Agent=help print help info about how to use this agent. I you
type java -agentlib:jdwp=help to see the example. The options of agent
usually is name=value pattern, maybe something like: java
-agentlib:Agent=tracefile=[filename]

Done. Usage: java -agentlib:tracer=output=[filename]

The zip file attached to HARMONY-6291 is the newest version of MinJre
Toolkit.

The ant build file can compile and test jvmti agent now.

I have tested it under Windows XP SP3 & Ubuntu 9.04.

The script directory is command line launcher for the analyzer and jregen,
not implemented yet, but in my plan.

Best Regards,

Daniel Gong

-- 
> Best Regards,
> Regis.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
On Thu, Aug 6, 2009 at 10:55 AM, Regis <xu...@gmail.com> wrote:

> Daniel Gong wrote:
>
>> Yes it is the problem of  the build file, I have correct it and  upload a
>> new one:)
>> To run it, you should modify the origin and target property in the build
>> file to your origin jre path and the target min jre path.
>> More, I have updated the description. Hope it will help you all and work
>> well:)
>>
>> On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:
>>
>>  Daniel Gong wrote:
>>>
>>>  Sorry, that's my fault. It seems I have put the wrong version of ant
>>>> build...I will correct it and upload it again.
>>>>
>>>>  It seems not a problem of ant, when I removed takedef of "analyze" and
>>> "gen", ant compile work correct, but ant test-hello (which only depends
>>> on
>>> compile), reported error again:
>>>
>>> C:\download\minijre\build.xml:56: Execute failed: java.io.IOException:
>>> Cannot run program "${target}
>>> \bin\java": CreateProcess error=2, The system cannot find the file
>>> specified
>>>
>>> And I found ${target} is never defined, do you mean ${target.dir} here?
>>> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir}
>>> ${test.dir}
>>>
>>> After fixing these variables and copy Harmony JRE to "origin" dir, I can
>>> run "ant test-hello" successfully. The target directory should be
>>> minijre,
>>> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>>>
>>> I'm waiting Daniel's description, so didn't try the agent yet :)
>>>
>>>
>>>
>>>  On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>>>
>>>>  Daniel Gong wrote:
>>>>
>>>>>  Hi all,
>>>>>
>>>>>> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to
>>>>>> call
>>>>>> it
>>>>>> MinJre Toolkit.
>>>>>>
>>>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>>>> functional
>>>>>> classes as well as command line tool and ant task implemented based on
>>>>>> them.
>>>>>> More, for dynamic tracing, a jvmti agent has been implemented. Both
>>>>>> static
>>>>>> analysis and dynamic tracing produce a type of result file called cns
>>>>>> (Class
>>>>>> Name Set) file, which has an associated data structure called
>>>>>> ClassNameSet
>>>>>> that can be created from a cns file, witten to a cns file and merged
>>>>>> with
>>>>>> a
>>>>>> cns file. The cns file in the conf directory contains the required
>>>>>> classes
>>>>>> for different jre implementations. Now it only supports Harmony.
>>>>>>
>>>>>> The toolkit can be used in two steps. First, employ both static
>>>>>> analyzer
>>>>>> and
>>>>>> dynamic tracer in the process of application development and test, and
>>>>>> record necessary information in several cns files. Second, employ the
>>>>>> jre
>>>>>> generator to merge these cns files and generate a new jre from an
>>>>>> original
>>>>>> one.
>>>>>>
>>>>>> So far I have written a simple ant build file to handle the whole
>>>>>> process
>>>>>> including compile, test, pack & javadoc. The compiling of the agent is
>>>>>> not
>>>>>> in because I'm still learning ant usage. The test is also very simple,
>>>>>> just
>>>>>> a helloworld app:P
>>>>>>
>>>>>> I'll improve the toolkit by adding command line script, optimizing ant
>>>>>> build, doing more test and improve the algorithm if a better strategy
>>>>>> is
>>>>>> found.
>>>>>>
>>>>>> Everyone please feel free to give me advice or report bugs to me~thx:)
>>>>>>
>>>>>> Daniel Gong
>>>>>>
>>>>>>
>>>>>>  Well done Daniel!
>>>>>>
>>>>> I'm trying to build the tool. I downloaded minjretoolkit.tar.gz from
>>>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but got
>>>>> a
>>>>> error:
>>>>>
>>>>> c:\download\minijre\build.xml:23: taskdef class
>>>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>>>> yTask cannot be found
>>>>>
>>>>> Did I miss anything?
>>>>>
>>>>> --
>>>>> Best Regards,
>>>>> Regis.
>>>>>
>>>>>
>>>>>  --
>>> Best Regards,
>>> Regis.
>>>
>>>
>>
> I tried the new one, the build script worked fine for me. Following the
> instructions on JIRA, I generated dynamic trace by agent and merged with
> static one successfully, seems you have finished the core part of this tool,
> well done!!
>
> While there are still places can be improved:
>
> 1. add build scrip for native code, "ant compile" will compile both java
> and native.


This one is of course in my plan:)


>
> 2. -agentlib:Agent=help print help info about how to use this agent. I you
> type java -agentlib:jdwp=help to see the example. The options of agent
> usually is name=value pattern, maybe something like:
> java -agentlib:Agent=tracefile=[filename]
>

Thx for the tips for the agent lib:)


>
> --
> Best Regards,
> Regis.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Regis <xu...@gmail.com>.
Daniel Gong wrote:
> Yes it is the problem of  the build file, I have correct it and  upload a
> new one:)
> To run it, you should modify the origin and target property in the build
> file to your origin jre path and the target min jre path.
> More, I have updated the description. Hope it will help you all and work
> well:)
> 
> On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:
> 
>> Daniel Gong wrote:
>>
>>> Sorry, that's my fault. It seems I have put the wrong version of ant
>>> build...I will correct it and upload it again.
>>>
>> It seems not a problem of ant, when I removed takedef of "analyze" and
>> "gen", ant compile work correct, but ant test-hello (which only depends on
>> compile), reported error again:
>>
>> C:\download\minijre\build.xml:56: Execute failed: java.io.IOException:
>> Cannot run program "${target}
>> \bin\java": CreateProcess error=2, The system cannot find the file
>> specified
>>
>> And I found ${target} is never defined, do you mean ${target.dir} here?
>> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir} ${test.dir}
>>
>> After fixing these variables and copy Harmony JRE to "origin" dir, I can
>> run "ant test-hello" successfully. The target directory should be minijre,
>> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>>
>> I'm waiting Daniel's description, so didn't try the agent yet :)
>>
>>
>>
>>> On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>>
>>>  Daniel Gong wrote:
>>>>  Hi all,
>>>>> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to call
>>>>> it
>>>>> MinJre Toolkit.
>>>>>
>>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>>> functional
>>>>> classes as well as command line tool and ant task implemented based on
>>>>> them.
>>>>> More, for dynamic tracing, a jvmti agent has been implemented. Both
>>>>> static
>>>>> analysis and dynamic tracing produce a type of result file called cns
>>>>> (Class
>>>>> Name Set) file, which has an associated data structure called
>>>>> ClassNameSet
>>>>> that can be created from a cns file, witten to a cns file and merged
>>>>> with
>>>>> a
>>>>> cns file. The cns file in the conf directory contains the required
>>>>> classes
>>>>> for different jre implementations. Now it only supports Harmony.
>>>>>
>>>>> The toolkit can be used in two steps. First, employ both static analyzer
>>>>> and
>>>>> dynamic tracer in the process of application development and test, and
>>>>> record necessary information in several cns files. Second, employ the
>>>>> jre
>>>>> generator to merge these cns files and generate a new jre from an
>>>>> original
>>>>> one.
>>>>>
>>>>> So far I have written a simple ant build file to handle the whole
>>>>> process
>>>>> including compile, test, pack & javadoc. The compiling of the agent is
>>>>> not
>>>>> in because I'm still learning ant usage. The test is also very simple,
>>>>> just
>>>>> a helloworld app:P
>>>>>
>>>>> I'll improve the toolkit by adding command line script, optimizing ant
>>>>> build, doing more test and improve the algorithm if a better strategy is
>>>>> found.
>>>>>
>>>>> Everyone please feel free to give me advice or report bugs to me~thx:)
>>>>>
>>>>> Daniel Gong
>>>>>
>>>>>
>>>>>  Well done Daniel!
>>>> I'm trying to build the tool. I downloaded minjretoolkit.tar.gz from
>>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but got a
>>>> error:
>>>>
>>>> c:\download\minijre\build.xml:23: taskdef class
>>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>>> yTask cannot be found
>>>>
>>>> Did I miss anything?
>>>>
>>>> --
>>>> Best Regards,
>>>> Regis.
>>>>
>>>>
>> --
>> Best Regards,
>> Regis.
>>
> 

I tried the new one, the build script worked fine for me. Following the 
instructions on JIRA, I generated dynamic trace by agent and merged with static 
one successfully, seems you have finished the core part of this tool, well done!!

While there are still places can be improved:

1. add build scrip for native code, "ant compile" will compile both java and native.

2. -agentlib:Agent=help print help info about how to use this agent. I you type 
java -agentlib:jdwp=help to see the example. The options of agent usually is 
name=value pattern, maybe something like:
java -agentlib:Agent=tracefile=[filename]

-- 
Best Regards,
Regis.

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
Yes it is the problem of  the build file, I have correct it and  upload a
new one:)
To run it, you should modify the origin and target property in the build
file to your origin jre path and the target min jre path.
More, I have updated the description. Hope it will help you all and work
well:)

On Wed, Aug 5, 2009 at 4:40 PM, Regis <xu...@gmail.com> wrote:

> Daniel Gong wrote:
>
>> Sorry, that's my fault. It seems I have put the wrong version of ant
>> build...I will correct it and upload it again.
>>
>
> It seems not a problem of ant, when I removed takedef of "analyze" and
> "gen", ant compile work correct, but ant test-hello (which only depends on
> compile), reported error again:
>
> C:\download\minijre\build.xml:56: Execute failed: java.io.IOException:
> Cannot run program "${target}
> \bin\java": CreateProcess error=2, The system cannot find the file
> specified
>
> And I found ${target} is never defined, do you mean ${target.dir} here?
> ${cns} ${origin} ${test} should also be ${cns.dir} ${origin.dir} ${test.dir}
>
> After fixing these variables and copy Harmony JRE to "origin" dir, I can
> run "ant test-hello" successfully. The target directory should be minijre,
> the size of "lib" is reduced from 40.1MB to 10.4MB, looks great!!
>
> I'm waiting Daniel's description, so didn't try the agent yet :)
>
>
>
>> On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
>>
>>  Daniel Gong wrote:
>>>
>>>  Hi all,
>>>> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to call
>>>> it
>>>> MinJre Toolkit.
>>>>
>>>> Now the coding of MinJreToolkit is almost complete. It includes
>>>> functional
>>>> classes as well as command line tool and ant task implemented based on
>>>> them.
>>>> More, for dynamic tracing, a jvmti agent has been implemented. Both
>>>> static
>>>> analysis and dynamic tracing produce a type of result file called cns
>>>> (Class
>>>> Name Set) file, which has an associated data structure called
>>>> ClassNameSet
>>>> that can be created from a cns file, witten to a cns file and merged
>>>> with
>>>> a
>>>> cns file. The cns file in the conf directory contains the required
>>>> classes
>>>> for different jre implementations. Now it only supports Harmony.
>>>>
>>>> The toolkit can be used in two steps. First, employ both static analyzer
>>>> and
>>>> dynamic tracer in the process of application development and test, and
>>>> record necessary information in several cns files. Second, employ the
>>>> jre
>>>> generator to merge these cns files and generate a new jre from an
>>>> original
>>>> one.
>>>>
>>>> So far I have written a simple ant build file to handle the whole
>>>> process
>>>> including compile, test, pack & javadoc. The compiling of the agent is
>>>> not
>>>> in because I'm still learning ant usage. The test is also very simple,
>>>> just
>>>> a helloworld app:P
>>>>
>>>> I'll improve the toolkit by adding command line script, optimizing ant
>>>> build, doing more test and improve the algorithm if a better strategy is
>>>> found.
>>>>
>>>> Everyone please feel free to give me advice or report bugs to me~thx:)
>>>>
>>>> Daniel Gong
>>>>
>>>>
>>>>  Well done Daniel!
>>>
>>> I'm trying to build the tool. I downloaded minjretoolkit.tar.gz from
>>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but got a
>>> error:
>>>
>>> c:\download\minijre\build.xml:23: taskdef class
>>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>>> yTask cannot be found
>>>
>>> Did I miss anything?
>>>
>>> --
>>> Best Regards,
>>> Regis.
>>>
>>>
>>
>
> --
> Best Regards,
> Regis.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Regis <xu...@gmail.com>.
Daniel Gong wrote:
> Sorry, that's my fault. It seems I have put the wrong version of ant
> build...I will correct it and upload it again.

It seems not a problem of ant, when I removed takedef of "analyze" and "gen", 
ant compile work correct, but ant test-hello (which only depends on compile), 
reported error again:

C:\download\minijre\build.xml:56: Execute failed: java.io.IOException: Cannot 
run program "${target}
\bin\java": CreateProcess error=2, The system cannot find the file specified

And I found ${target} is never defined, do you mean ${target.dir} here? ${cns} 
${origin} ${test} should also be ${cns.dir} ${origin.dir} ${test.dir}

After fixing these variables and copy Harmony JRE to "origin" dir, I can run 
"ant test-hello" successfully. The target directory should be minijre, the size 
of "lib" is reduced from 40.1MB to 10.4MB, looks great!!

I'm waiting Daniel's description, so didn't try the agent yet :)

> 
> On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:
> 
>> Daniel Gong wrote:
>>
>>> Hi all,
>>> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to call it
>>> MinJre Toolkit.
>>>
>>> Now the coding of MinJreToolkit is almost complete. It includes functional
>>> classes as well as command line tool and ant task implemented based on
>>> them.
>>> More, for dynamic tracing, a jvmti agent has been implemented. Both static
>>> analysis and dynamic tracing produce a type of result file called cns
>>> (Class
>>> Name Set) file, which has an associated data structure called ClassNameSet
>>> that can be created from a cns file, witten to a cns file and merged with
>>> a
>>> cns file. The cns file in the conf directory contains the required classes
>>> for different jre implementations. Now it only supports Harmony.
>>>
>>> The toolkit can be used in two steps. First, employ both static analyzer
>>> and
>>> dynamic tracer in the process of application development and test, and
>>> record necessary information in several cns files. Second, employ the jre
>>> generator to merge these cns files and generate a new jre from an original
>>> one.
>>>
>>> So far I have written a simple ant build file to handle the whole process
>>> including compile, test, pack & javadoc. The compiling of the agent is not
>>> in because I'm still learning ant usage. The test is also very simple,
>>> just
>>> a helloworld app:P
>>>
>>> I'll improve the toolkit by adding command line script, optimizing ant
>>> build, doing more test and improve the algorithm if a better strategy is
>>> found.
>>>
>>> Everyone please feel free to give me advice or report bugs to me~thx:)
>>>
>>> Daniel Gong
>>>
>>>
>> Well done Daniel!
>>
>> I'm trying to build the tool. I downloaded minjretoolkit.tar.gz from
>> HARMONY-6291, and extract it, then run "ant" or "ant compile", but got a
>> error:
>>
>> c:\download\minijre\build.xml:23: taskdef class
>> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
>> yTask cannot be found
>>
>> Did I miss anything?
>>
>> --
>> Best Regards,
>> Regis.
>>
> 


-- 
Best Regards,
Regis.

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Daniel Gong <da...@gmail.com>.
Sorry, that's my fault. It seems I have put the wrong version of ant
build...I will correct it and upload it again.

On Wed, Aug 5, 2009 at 3:44 PM, Regis <xu...@gmail.com> wrote:

> Daniel Gong wrote:
>
>> Hi all,
>> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to call it
>> MinJre Toolkit.
>>
>> Now the coding of MinJreToolkit is almost complete. It includes functional
>> classes as well as command line tool and ant task implemented based on
>> them.
>> More, for dynamic tracing, a jvmti agent has been implemented. Both static
>> analysis and dynamic tracing produce a type of result file called cns
>> (Class
>> Name Set) file, which has an associated data structure called ClassNameSet
>> that can be created from a cns file, witten to a cns file and merged with
>> a
>> cns file. The cns file in the conf directory contains the required classes
>> for different jre implementations. Now it only supports Harmony.
>>
>> The toolkit can be used in two steps. First, employ both static analyzer
>> and
>> dynamic tracer in the process of application development and test, and
>> record necessary information in several cns files. Second, employ the jre
>> generator to merge these cns files and generate a new jre from an original
>> one.
>>
>> So far I have written a simple ant build file to handle the whole process
>> including compile, test, pack & javadoc. The compiling of the agent is not
>> in because I'm still learning ant usage. The test is also very simple,
>> just
>> a helloworld app:P
>>
>> I'll improve the toolkit by adding command line script, optimizing ant
>> build, doing more test and improve the algorithm if a better strategy is
>> found.
>>
>> Everyone please feel free to give me advice or report bugs to me~thx:)
>>
>> Daniel Gong
>>
>>
> Well done Daniel!
>
> I'm trying to build the tool. I downloaded minjretoolkit.tar.gz from
> HARMONY-6291, and extract it, then run "ant" or "ant compile", but got a
> error:
>
> c:\download\minijre\build.xml:23: taskdef class
> org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
> yTask cannot be found
>
> Did I miss anything?
>
> --
> Best Regards,
> Regis.
>

Re: [GSOC] The code for smallest class set for customer application in now on JIRA

Posted by Regis <xu...@gmail.com>.
Daniel Gong wrote:
> Hi all,
> I have my code attached in issue HARMONY-6291 on JIRA. I'd like to call it
> MinJre Toolkit.
> 
> Now the coding of MinJreToolkit is almost complete. It includes functional
> classes as well as command line tool and ant task implemented based on them.
> More, for dynamic tracing, a jvmti agent has been implemented. Both static
> analysis and dynamic tracing produce a type of result file called cns (Class
> Name Set) file, which has an associated data structure called ClassNameSet
> that can be created from a cns file, witten to a cns file and merged with a
> cns file. The cns file in the conf directory contains the required classes
> for different jre implementations. Now it only supports Harmony.
> 
> The toolkit can be used in two steps. First, employ both static analyzer and
> dynamic tracer in the process of application development and test, and
> record necessary information in several cns files. Second, employ the jre
> generator to merge these cns files and generate a new jre from an original
> one.
> 
> So far I have written a simple ant build file to handle the whole process
> including compile, test, pack & javadoc. The compiling of the agent is not
> in because I'm still learning ant usage. The test is also very simple, just
> a helloworld app:P
> 
> I'll improve the toolkit by adding command line script, optimizing ant
> build, doing more test and improve the algorithm if a better strategy is
> found.
> 
> Everyone please feel free to give me advice or report bugs to me~thx:)
> 
> Daniel Gong
> 

Well done Daniel!

I'm trying to build the tool. I downloaded minjretoolkit.tar.gz from 
HARMONY-6291, and extract it, then run "ant" or "ant compile", but got a error:

c:\download\minijre\build.xml:23: taskdef class 
org.crazynut.harmony.minjre.anttask.AnalyzeDependenc
yTask cannot be found

Did I miss anything?

-- 
Best Regards,
Regis.