[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compiling with jikes > 1.13
From: |
Mark Wielaard |
Subject: |
Re: Compiling with jikes > 1.13 |
Date: |
06 Feb 2002 20:41:21 +0100 |
Hi,
On Wed, 2002-02-06 at 20:17, Tom Tromey wrote:
> >>>>> "Mark" == Mark Wielaard <address@hidden> writes:
>
> Mark> I changed the program a little bit to force loading all classes
> Mark> through the same ClassLoader when possible. Now it actually
> Mark> seems to work. But a lot of the VerifyErrors seem to be wrong.
>
> There are probably remaining bugs in the verifier. I'm interested in
> killing these as quickly as possible.
>
> Mark> For example the verifier doesn't like something like the following:
>
> I tried the appended example, which gives nearly identical bytecode.
> It worked fine for me :-(. Could you try it?
That one works now for me. A friend (hi Erwin!) pointed out that my
program was a bit eager with respect to loading java.lang.Throwable and
java.lang.String through my ClassLoader. The verifier got confused about
wether those classes were really assignable to the reference type on the
stack (they were not since they had different ClassLoaders!).
> Thanks, I'll give it a try soon.
Here is a new version that just ignores all java.lang classes.
Still have to debug some more since the program now get
NullPointerExceptions and hangs again on some classes (seems that trying
to fool the SystemClassLoader is not a good idea :) But I have attached
the results so far. I will go through the VerifyErrors I get now to see
if they are real.
Cheers,
Mark
import java.io.*;
public class VerifyClass extends ClassLoader
{
public static void main(String args[])
{
if (args.length == 1)
{
System.out.println("Verifying: " + args[0]);
try
{
if (args[0].indexOf("java/lang/") < 0)
{
VerifyClass verifier = new VerifyClass();
Class c = verifier.load(args[0]);
verifier.resolveClass(c);
}
else
System.out.println("Skipping java.lang class");
}
catch (Throwable t)
{
System.out.println(t);
}
}
else
System.out.println("argument must be a class file");
}
Class load(String classFile) throws IOException
{
InputStream is = new FileInputStream(classFile);
ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] buf = new byte[2048];
int read = is.read(buf);
while(read > 0)
{
os.write(buf, 0, read);
read = is.read(buf);
}
byte[] data = os.toByteArray();
return defineClass(data, 0, data.length);
}
protected Class loadClass(String name, boolean link)
throws java.lang.ClassNotFoundException
{
// System.out.println("Loading: " + name);
if (!name.startsWith("java.lang"))
{
try
{
Class c = load(name.replace('.','/') + ".class");
if (link)
resolveClass(c);
return c;
}
catch(IOException ioe) { }
}
return super.loadClass(name, link);
}
}
Verifying: ./java/lang/VerifyError.class
java.lang.VerifyError: verification failed at PC 64 in
java.util.Collections:shuffle((Ljava.util.List;Ljava.util.Random;)V): array
required
java.lang.VerifyError: verification failed at PC 37 in
java.util.zip.ZipFile:readEntries(()V): incompatible type on stack
java.lang.VerifyError: verification failed at PC 37 in
java.util.zip.ZipFile:readEntries(()V): incompatible type on stack
java.lang.VerifyError: verification failed at PC 54 in
java.net.InetAddress:checkCacheFor((Ljava.lang.String;)[Ljava.net.InetAddress;):
array required
java.lang.VerifyError: verification failed at PC 82 in
java.net.URLDecoder:decode((Ljava.lang.String;Ljava.lang.String;)Ljava.lang.String;):
array type expected
java.lang.VerifyError: verification failed at PC 58 in
java.text.NumberFormat:computeInstance((Ljava.util.Locale;Ljava.lang.String;Ljava.lang.String;)Ljava.text.NumberFormat;):
incompatible return type
java.lang.VerifyError: verification failed at PC 961 in
java.text.SimpleDateFormat:parse((Ljava.lang.String;Ljava.text.ParsePosition;)Ljava.util.Date;):
array type expected
java.lang.VerifyError: verification failed at PC 163 in
java.text.AttributedString:<init>((Ljava.text.AttributedCharacterIterator;II[Ljava.text.AttributedCharacterIterator$Attribute;)V):
incompatible type on stack
java.lang.VerifyError: verification failed at PC 58 in
java.text.NumberFormat:computeInstance((Ljava.util.Locale;Ljava.lang.String;Ljava.lang.String;)Ljava.text.NumberFormat;):
incompatible return type
java.lang.VerifyError: verification failed at PC 12 in
java.beans.beancontext.BeanContextChildSupport:<init>((Ljava.beans.beancontext.BeanContextChild;)V):
incompatible type on stack
java.lang.VerifyError: verification failed at PC 20 in
java.rmi.server.ObjID:<init>(()V): incompatible type on stack
java.lang.VerifyError: verification failed at PC 43 in
gnu.java.rmi.server.UnicastConnectionManager:getInstance((Ljava.lang.String;ILjava.rmi.server.RMIClientSocketFactory;)Lgnu.java.rmi.server.UnicastConnectionManager;):
incompatible type on stack
- Re: Compiling with jikes > 1.13, (continued)
- Re: Compiling with jikes > 1.13, Stuart Ballard, 2002/02/04
- Re: Compiling with jikes > 1.13, Etienne M. Gagnon, 2002/02/04
- Re: Compiling with jikes > 1.13, Mark Wielaard, 2002/02/04
- Re: Compiling with jikes > 1.13, Eric Blake, 2002/02/04
- Re: Compiling with jikes > 1.13, Mark Wielaard, 2002/02/05
- Re: Compiling with jikes > 1.13, Tom Tromey, 2002/02/05
- Re: Compiling with jikes > 1.13, Mark Wielaard, 2002/02/06
- Re: Compiling with jikes > 1.13, Mark Wielaard, 2002/02/06
- Re: Compiling with jikes > 1.13, Mark Wielaard, 2002/02/06
- Re: Compiling with jikes > 1.13, Tom Tromey, 2002/02/06
- Re: Compiling with jikes > 1.13,
Mark Wielaard <=
- Re: Compiling with jikes > 1.13, Mark Wielaard, 2002/02/06
- Re: Compiling with jikes > 1.13, Tom Tromey, 2002/02/06
- Re: Compiling with jikes > 1.13, Mark Wielaard, 2002/02/06
- Re: Compiling with jikes > 1.13, Tom Tromey, 2002/02/06
- Re: Compiling with jikes > 1.13, Mark Wielaard, 2002/02/06
- Re: Compiling with jikes > 1.13, Mark Wielaard, 2002/02/06
- Re: Compiling with jikes > 1.13, Tom Tromey, 2002/02/06
- Re: Compiling with jikes > 1.13, Eric Blake, 2002/02/06
- Re: Compiling with jikes > 1.13, Mark Wielaard, 2002/02/07
- Re: Compiling with jikes > 1.13, Eric Blake, 2002/02/07