[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bugs in Soot (fwd)
Hi,
getting closer
A small parenthesis on something I don't know if it is good or bad :
The sooted classes have something like
.source Maine.jasmin
if they go only through javac, they would have instead
.source Maine.java
So that if we get an exception in the code, we have a printing like
Exception in thread "main" java.lang.NullPointerException
at Maine.main(Maine.jasmin)
instead of
Exception in thread "main" java.lang.NullPointerException
at Maine.main(Maine.java:16)
Does this look awkward? wrong? Or maybe it's good for knowing what's going
on. but it's not good if our sooted files will be redistributed, as in my
case.
Now,
For some reason when I do
java soot.Main -O -c -d lib --soot-classpath $SOOT_CLASSPATH --process-path
lib
only the kaffe and com packages get sooted, leaving java and javax unsooted
So I wrote my own directories recursive descent program.
Now it seems Soot breaks java.lang.Object, since while sooting every file in
turn, if I stop the process right before going through Object, kaffe works,
but if I sootify Object, it then core
dumps.
Also, if I sootify all the packages, but replace Object by one I had kept
aside before sootifying, it works
Attached Object.j is the dejava of Object.class not sootified, Object.j.soot
is the one sootified. Object.java is the source.
It would be nice if it worked with process-path cause my way takes more than
an hour.
Anybody know if the best (speed, size) byte code generated is through javac
then Soot?
For example, jikes is fast but bad on code generation.
Regards,
--
Philippe Laporte
Optimization Engineer Tel: (510) 527-4025 ext 14
Transvirtual Technologies, Inc., Fax: (510) 559-3287
Berkeley, CA, USA. Email: philippe@transvirtual.com
Winghong Felix KWOK wrote:
> Hi, Philippe.
>
> Apparently, there is something wrong with the reading of the
> SOOT_CLASSPATH environment variable. For a temporary fix, add the option
> --soot-classpath $SOOT_CLASSPATH in the command line. So you would do
> something like
>
> java soot.Main -O -c -d lib --soot-classpath $SOOT_CLASSPATH
> --process-path lib
>
> This should work.
>
> > More questions:
> >
> ...<snip>...
>
> I am not very familiar with peephole optimizations, but I'll forward your
> question to someone who does.
>
> Hope that helps.
>
> Felix
;>> Object.class <<
;
; Output created by D-Java (Jun 29 2000)
; mailto:umsilve1@cc.umanitoba.ca
; Copyright (c) 1996-1997 Shawn Silverman
;
;Classfile version:
; Major: 45
; Minor: 3
.source Object.java
.class public java/lang/Object
; ACC_SUPER bit is set
.super java/lang/Object
; >> METHOD 1 <<
.method public <init>()V
.limit stack 0
.limit locals 1
.line 14
return
.end method
; >> METHOD 2 <<
.method protected native clone()Ljava/lang/Object;
.throws java/lang/CloneNotSupportedException
.end method
; >> METHOD 3 <<
.method public equals(Ljava/lang/Object;)Z
.limit stack 2
.limit locals 2
.line 19
aload_0
aload_1
if_acmpne Label1
iconst_1
goto Label2
Label1:
iconst_0
Label2:
ireturn
.end method
; >> METHOD 4 <<
.method protected finalize()V
.throws java/lang/Throwable
.limit stack 0
.limit locals 1
.line 24
return
.end method
; >> METHOD 5 <<
.method public final native getClass()Ljava/lang/Class;
.end method
; >> METHOD 6 <<
.method public native hashCode()I
.end method
; >> METHOD 7 <<
.method public final native notify()V
.end method
; >> METHOD 8 <<
.method public final native notifyAll()V
.end method
; >> METHOD 9 <<
.method public toString()Ljava/lang/String;
.limit stack 2
.limit locals 1
.line 35
new java/lang/StringBuffer
dup
invokespecial java/lang/StringBuffer/<init>()V
aload_0
invokevirtual java/lang/Object/getClass()Ljava/lang/Class;
invokevirtual java/lang/Class/getName()Ljava/lang/String;
invokevirtual java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;
bipush 64
invokevirtual java/lang/StringBuffer/append(C)Ljava/lang/StringBuffer;
aload_0
invokevirtual java/lang/Object/hashCode()I
invokestatic java/lang/Integer/toHexString(I)Ljava/lang/String;
invokevirtual java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;
invokevirtual java/lang/StringBuffer/toString()Ljava/lang/String;
areturn
.end method
; >> METHOD 10 <<
.method public final wait()V
.throws java/lang/InterruptedException
.limit stack 3
.limit locals 1
.line 40
aload_0
lconst_0
invokevirtual java/lang/Object/wait(J)V
.line 41
return
.end method
; >> METHOD 11 <<
.method public final wait(J)V
.throws java/lang/InterruptedException
.limit stack 4
.limit locals 3
.line 44
invokestatic java/lang/Thread/currentThread()Ljava/lang/Thread;
aload_0
lload_1
invokevirtual java/lang/Thread/waitOn(Ljava/lang/Object;J)V
.line 45
return
.end method
; >> METHOD 12 <<
.method public final wait(JI)V
.throws java/lang/InterruptedException
.limit stack 4
.limit locals 4
.line 49
iload_3
iflt Label1
iload_3
ldc 999999
if_icmple Label2
.line 50
Label1:
new java/lang/IllegalArgumentException
dup
ldc "nanos out or range"
invokespecial java/lang/IllegalArgumentException/<init>(Ljava/lang/String;)V
athrow
.line 52
Label2:
lload_1
lconst_0
lcmp
ifne Label3
iload_3
ifle Label3
.line 53
lload_1
lconst_1
ladd
lstore_1
.line 55
Label3:
aload_0
lload_1
invokevirtual java/lang/Object/wait(J)V
.line 56
return
.end method
; >> METHOD 13 <<
.method final native wait0(J)V
.end method
;>> Object.class <<
;
; Output created by D-Java (Jun 29 2000)
; mailto:umsilve1@cc.umanitoba.ca
; Copyright (c) 1996-1997 Shawn Silverman
;
;Classfile version:
; Major: 45
; Minor: 3
.source java.lang.Object.jasmin
.class public java/lang/Object
; ACC_SUPER bit is set
.super java/lang/Object
; >> METHOD 1 <<
.method public <init>()V
.limit stack 0
.limit locals 1
return
.end method
; >> METHOD 2 <<
.method protected native clone()Ljava/lang/Object;
.end method
; >> METHOD 3 <<
.method public equals(Ljava/lang/Object;)Z
.limit stack 2
.limit locals 2
aload_0
aload_1
if_acmpne Label1
iconst_1
istore_1
goto Label2
Label1:
iconst_0
istore_1
Label2:
iload_1
ireturn
.end method
; >> METHOD 4 <<
.method protected finalize()V
.limit stack 0
.limit locals 1
return
.end method
; >> METHOD 5 <<
.method public final native getClass()Ljava/lang/Class;
.end method
; >> METHOD 6 <<
.method public native hashCode()I
.end method
; >> METHOD 7 <<
.method public final native notify()V
.end method
; >> METHOD 8 <<
.method public final native notifyAll()V
.end method
; >> METHOD 9 <<
.method public toString()Ljava/lang/String;
.limit stack 2
.limit locals 1
new java/lang/StringBuffer
dup
invokespecial java/lang/StringBuffer/<init>()V
aload_0
invokevirtual java/lang/Object/getClass()Ljava/lang/Class;
invokevirtual java/lang/Class/getName()Ljava/lang/String;
invokevirtual java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;
bipush 64
invokevirtual java/lang/StringBuffer/append(C)Ljava/lang/StringBuffer;
aload_0
invokevirtual java/lang/Object/hashCode()I
invokestatic java/lang/Integer/toHexString(I)Ljava/lang/String;
invokevirtual java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;
invokevirtual java/lang/StringBuffer/toString()Ljava/lang/String;
areturn
.end method
; >> METHOD 10 <<
.method public final wait()V
.limit stack 3
.limit locals 1
aload_0
lconst_0
invokevirtual java/lang/Object/wait(J)V
return
.end method
; >> METHOD 11 <<
.method public final wait(J)V
.limit stack 4
.limit locals 3
invokestatic java/lang/Thread/currentThread()Ljava/lang/Thread;
aload_0
lload_1
invokevirtual java/lang/Thread/waitOn(Ljava/lang/Object;J)V
return
.end method
; >> METHOD 12 <<
.method public final wait(JI)V
.limit stack 4
.limit locals 4
iload_3
iflt Label1
iload_3
ldc 999999
if_icmple Label2
Label1:
new java/lang/IllegalArgumentException
dup
ldc "nanos out or range"
invokespecial java/lang/IllegalArgumentException/<init>(Ljava/lang/String;)V
athrow
Label2:
lload_1
lconst_0
lcmp
ifne Label3
iload_3
ifle Label3
lload_1
lconst_1
ladd
lstore_1
Label3:
aload_0
lload_1
invokevirtual java/lang/Object/wait(J)V
return
.end method
; >> METHOD 13 <<
.method final native wait0(J)V
.end method
/*
* Java core library component.
*
* Copyright (c) 1997, 1998
* Transvirtual Technologies, Inc. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
* of this file.
*/
package java.lang;
public class Object
{
native protected Object clone() throws CloneNotSupportedException;
public boolean equals(Object obj) {
return (this==obj); /* Well either its equal or it aint! */
}
protected void finalize() throws Throwable {
/* Does nothing for Object class */
}
final native public Class getClass();
native public int hashCode();
final native public void notify();
final native public void notifyAll();
public String toString() {
return getClass().getName()+'@'+Integer.toHexString(hashCode());
}
final public void wait() throws InterruptedException {
/* Just wait forever */
wait(0);
}
final public void wait(long timeout) throws InterruptedException {
Thread.currentThread().waitOn(this, timeout);
}
final public void wait(long timeout, int nanos) throws InterruptedException {
/* Ignore nanos, except avoid clipping a non-zero quantity to zero */
if (nanos < 0 || nanos > 999999) {
throw new IllegalArgumentException("nanos out or range");
}
if (timeout == 0 && nanos > 0) {
timeout++;
}
wait(timeout);
}
final native void wait0(long timeout);
}