Re: [Jastadd] [bug report] absence of AbstractWildcardType.createQualifiedAccess()

From: Jesper Öqvist <jesper.oqvist_at_cs.lth.se>
Date: Tue, 01 May 2012 17:52:34 +0200

Hello Hyunik,

First of all thank you for the information! I should now be able to
reproduce your build conditions and also the original error.

Building OpenJDK seems to be a very useful test for JastAddJ. More bugs
found is a good thing, that means we can try to fix them!

I noticed that the build script you use is a bit slow. The reason is
that the JVM is restarted for each source file that is compiled.
Considering the large number of source files (7819 in openjdk-6-b24),
you get a large overhead for starting/stopping the host JVM (especially
if you use a server VM):

On 04/26/2012 04:02 AM, Na, Hyunik wrote:
>
> rm -rf ./build/*
>
> for i in $(find . -name *.java)
>
> do
>
> echo "### compiling $i"
>
> java -cp $HOME/install/JastAddJ/Java1.5Backend JavaCompiler -verbose
> -bootclasspath .:./build:$Openjdk16/build/linux-i586/classes -extdirs
> . -classpath . -d build $i
>
> echo "### result = $?, compiled $i"
>
> done
>
>

So if you want to build this faster, you could try to use the following
program I wrote. It seems to have sped up the build for me:

BatchCompiler.java:
============
import java.io.*;
import java.util.*;

public class BatchCompiler {

     public static void main(String[] args) {

         int fileList = -1;

         for (int i = 0; i < args.length; ++i) {
             if (args[i].startsWith("_at_")) {
                 fileList = i;
                 break;
             }
         }

         if (fileList == -1) {
             System.err.println("No file list argument found!");
             System.exit(1);
         }

         String[] compileArgs = new String[args.length];
         for (int i = 0; i < args.length; ++i) {
             if (i > fileList) {
                 compileArgs[i-1] = args[i];
             } else {
                 compileArgs[i] = args[i];
             }
         }

         try {
             Scanner scanner = new Scanner(new FileInputStream(
                         args[fileList].substring(1)));

             while (scanner.hasNextLine()) {
                 String fileName = scanner.nextLine();
                 compileArgs[args.length-1] = fileName;
                 System.out.println("### compiling " + fileName);
                 boolean result = false;
                 try {
                     result = JavaCompiler.compile(compileArgs);
                 } catch (Throwable t) {
                     t.printStackTrace();
                 }
                 System.out.println("### result = " +
                         (result ? 0 : 1) + ", compiled " + fileName);
             }
         } catch (IOException e) {
             e.printStackTrace();
             System.err.println("Batch compile aborted!");
             System.exit(1);
         }

     }
}
============

BatchCompiler simply invokes JastAddJ once for each line in the supplied
argument file, with the same command line arguments (except the argument
file option - it's difficult to explain this, hopefully my code is
clearer!).

I modified your build script to compile and invoke BatchCompiler:

============
#!/bin/sh

OPENJDK6=$HOME/jdk/openjdk6-b24
JASTADDJ=$HOME/svn/JastAddJ

echo "Preparing JastAddJ"
ant -f $JASTADDJ/Java1.5Backend/build.xml

find . -name '*.java' | grep -v 'BatchCompiler\.java' > files

rm -rf build
mkdir build

javac -cp $JASTADDJ/Java1.5Backend BatchCompiler.java
java -cp .:$JASTADDJ/Java1.5Backend BatchCompiler -verbose \
-bootclasspath .:./build:OPENJDK6/build/linux-amd64/classes \
-extdirs . -classpath . -d build _at_files 2>&1 | tee output.txt
============

It seems to compile the Java files much faster. Your results may vary.

/Jesper
Received on Tue May 01 2012 - 17:51:00 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 16 2014 - 17:19:06 CEST