Dev Tools

Hey all,

First of all, great project. Was really excited to see it out there and looks like it would be very interesting to work on.

I've seen the debugger shell thing while running it, but being used to my nice little world running/debugging/profiling applications in IntelliJ/OptimizeIt it would be hard to transition into development using only that and System.out type logging. But this isn't a request for software, I'm up for writing part of a toolchain for platform development (unless there's something else out there?). Had a few questions after reviewing the code though.

-Is there anything describing where the hand-offs are between bytecode and compiled code at run time? There are a lot of assembly classes, ClassLoaders and whatnot, but not being able to debug I can't quite see the line between compile- and run-time. Any help on that would be greatly appreciated.

-My read of JVMPI/TVMTI is that they are more for inserting C code on the target and the client and then using that to profile/debug. And my read of JNode is that that model is fundamentally flawed. Anyone know if both of those are correct assumptions?

-Given the above, is there a way to cleanly replace the byte code of a class while the system is up and running? Are there any BCEL/Javassist type byte code modifiers around in the current code base? Opposition to including one?

Sorry for the long-winded post (if you've gotten this far) but a bunch of ideas bouncing around in my head for the past few days and just had to get them out there.

Thanks.
-Casey

Hi Casey, you're very

Hi Casey,

you're very welcome, we love to see new developers Smiling

I can't answer all your questions, but I'll try to give some hints to you, to go on. First about debugging, we have two other possibilities to debug: kdb (kernel debugger), it's logging to the serial line (with vmware pipe it to a file). kdb is able to debug the stuff in core/ if you supply "kdb" or "kdb=on" in kernel command line. In grub press "e" and append "kdb", then press "b" Smiling The other option is to use updout, so you could log via network and configure the systemlogger to use that instead of sysout. I didn't use that one myself yet, but there's doc about it here in our forum.
(For JPDA we'd "only" need the VM link. The API itself is in classpath and JNode afaik)

I guess you're aware of the fact, that we don't have a interpreter anymore. We have two compilers (stub and l1a), where l1a is the real JIT. I'm not sure what helps you best, so I simply name you some stuff you could have a look at. If it doesn't help, just ask again Eye-wink

"/core/src/core/org/jnode/vm/compiler/" and "/core/src/core/org/jnode/vm/x86/compiler" contains all compiler (JIT) stuff. E.g. l1b/X86Level1BCompiler.java is the class you could use to compile class files to native code. Mind the "inlineMethods"!

Look at "/shell/src/shell/org/jnode/shell/command/CompileCommand.java"
or "/core/src/test/org/jnode/test/core/CompilerTest.java" to see how the compiler gets used. Btw, l1a is nearlly the same as l1b, though l1b is thought to be used for testing stuff Eye-wink

I don't understand the question about JVMPI/TVMTI, so hopefully someone else will help you there Smiling

About the last question: There is a way to replace the bytecode of a class, yes. You can not change the class layout though (i.e. field order, number,..) and you might get trouble with inlined methods, since afaik we don't keep track for a method if it got inlined and if so, where it got inlined. Again, have a look at
"/shell/src/shell/org/jnode/shell/command/CompileCommand.java", it is able to recompile code with another JIT. You might also want to have a look at the jikes branch in our repository. It's not working fully yet, but it can give you some ideas too Eye-wink And another one is
"/core/src/core/org/jnode/vm/classmgr/VmType.java". This class is responsible to load a class, link it, compile the method code and initialize it (static {...} and stuff).

I hope I could help you a bit,

Peter

p.s. consider also to join IRC, for questions and code discussions it's sometimes more simple to do it in realtime Smiling