Re: [Sablevm-developer] Re: Running jetty
Brought to you by:
egagnon
From: Etienne G. <gag...@uq...> - 2004-05-21 21:38:19
|
OK. I found the bug. SableVM does depend on classes being prepared before you can use them in operations such as "instanceof". To this end, I have modified SableVM to be a little more eager in linking classes (this is *NOT* initialization, if you care about details such as Chapter 5 of the JVM spec.). The problem was that the System class loader (gnu.java.lang.SystemClassLoader) called java.lang.ClassLoader.defineClass() but not resolveClass(). I could have modified the System class loader to also call resolveClass, but this would have not been a robust fix. defineClass() documentation say: Converts an array of bytes into an instance of class Class. Before the Class can be used it must be resolved. But, I think this can make a VM quite fragile. As the JVM spec allows for it, I have modified SableVM "link" the class in defineClass. I also made sure that no reference to java.lang.Class instances escape to java code before the related class is linked. This should make the VM more robust in face of weaker java code. Laurent, you can try the staging snapshot (staging+2298) in: http://www.info.uqam.ca/~egagnon/staging and report your findings. :-) Thanks a lot for the bug report! Etienne Etienne Gagnon wrote: > Hmmm... > > Laurent Martelli wrote: > >> It's not really a small test case since it relies on Jetty, but it >> triggers ... > > > Somehow, the isAssignableFrom is called at a time when OutputStreamLogSink > is not yet *prepared* (this is even before initialization!). As > preparation > is where the appropriate structures are created for doing constant-time > instanceof checks, it explains why the check fails (as the data used for > the check is invalid). > > So, some code lets a Class reference escape prior to preparation! This > must > be fixed... This will require some hunting. > > Feel free to help. To do so, reconfigure and recompile sablevm: > > $ cd sablevm-staging-... > $ ./configure --enable-debugging-features # then any other option use > previously used > $ make clean > $ make > $ make install > > then, I recommend that you use ddd to debug sablevm: > > $ ddd path-to../bin/sablevm & > > [on Debian, you simply: > $ apt-get install ddd > ] > > Have fun! > > Etienne > -- Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |