C+Java profiling, debugging, and a feedback infrastructure

Patrick Tullmann kaffe@rufus.w3.org
Thu, 11 May 2000 13:32:11 -0600


Hi,

Thanks to excellent work by Tim Stack of our group at the University
of Utah, in support of our work on `Janos', an active networks platform,
we've added one major and two auxiliary enhancements to Kaffe:
   * C+Java cross-language gprof support
   * C+Java cross-language gdb support
   * Basic feedback system

The major work is a system for combined profiling of C and JIT'ed
Java code in Kaffe.  This makes it possible to produce timing and call
graph data covering both languages in a format that can be understood
by GNU gprof.  The implementation works much like regular C profiling:
it gets timing information by regularly sampling the current value of
the PC and adds a call to an `mcount'-like function to the beginning
of JIT'ed methods.  Then, at exit, the profiling data is written out,
as well as an assembler file containing symbol information for the
JIT'ed code.  Finally, the JIT'ed code symbol file and a symbol file
created from the Kaffe executable are assembled and fed into gprof to
create the output.

In addition, we have implemented basic functionality to support cross
language debugging in gdb.  Cross language debugging simply takes the
line debugging information from the Java class and outputs it to an
assembler file using the same code the profiler used.  Then, while
executing in gdb you can assemble the current output file and add the
symbols to gdb's current state, allowing it to report the current
file/line information for JIT'ed Java code.

Finally, we have implemented a basic system for feeding JIT
information back into subsequent runs of Kaffe.  The feedback system
allows Kaffe to save certain bits of state to a file so that it can
optimize future runs based on past information.  Currently, this is
only used for preloading libraries and pre-JIT'ing methods.  However,
it should be flexible enough to hold more data that can be used to do
other tricks.

More information, a patch (187K), and a complete Kaffe source
distribution (both based on early May, 2000 CVS snapshots) can be
found on our Janos Kaffe page:
	http://www.cs.utah.edu/flux/janos/kaffe.html

More information about these additions can be found in the
FAQ.xprofiler, FAQ.xdebugging, and FAQ.feedback files (which
are also on the web page).

Before asking that this stuff get committed to the main tree, we're
looking for some feedback on it.  So please send any comments to this
list, the Janos list (janos-discuss@flux.cs.utah.edu) or to myself
(tullmann@cs.utah.edu) and Tim Stack (stack@cs.utah.edu).

Tim Stack, our most recent Kaffe wizard at Utah, actually implemented
all of this.  I'm just announcing it.

For those interested in what was actually changed, here is a ChangeLog
entry:

Tim Stack <stack@cs.utah.edu>:
	* FAQ/FAQ.xprofiler, FAQ/FAQ.xdebugging, FAQ/FAQ.feedback,
	kaffe/scripts/kaffexprof.in, kaffe/scripts/nm2as.awk,
	kaffe/libraries/clib/management/XProfiler.c,
	kaffe/libraries/javalib/kaffe/management/XProfiler.java,
	configure.in, kaffe/kaffe/main.c, config/i386/jit3-i386.def,
	config/i386/freebsd2/md.h, config/i386/linux/md.h,
	include/Makefile.am, include/Makefile.in, kaffe/Makefile.am,
	kaffe/Makefile.in, kaffe/kaffe/Makefile.am,
	kaffe/kaffe/Makefile.in,
	kaffe/kaffevm/systems/unix-jthreads/Makefile.am,
	kaffe/kaffevm/Makefile.am, kaffe/kaffevm/Makefile.in,
	kaffe/kaffevm/jit3/Makefile.am,
	kaffe/kaffevm/jit3/Makefile.in, kaffe/kaffevm/baseClasses.c,
	kaffe/kaffevm/classMethod.c, kaffe/kaffevm/external.c,
	kaffe/kaffevm/external.h, kaffe/kaffevm/jni.c,
	kaffe/kaffevm/methodCache.c, kaffe/kaffevm/methodCache.h,
	kaffe/kaffevm/stringSupport.h, kaffe/kaffevm/utf8const.c,
	kaffe/kaffevm/jit3/machine.c, kaffe/xprof,
	kaffe/xprof/Makefile.am, kaffe/xprof/Makefile.in,
	kaffe/xprof/callGraph.h, kaffe/xprof/callGraph.c,
	kaffe/xprof/debugFile.h, kaffe/xprof/debugFile.c,
	kaffe/xprof/feedback.h, kaffe/xprof/feedback.c,
	kaffe/xprof/fileSections.h, kaffe/xprof/fileSections.c,
	kaffe/xprof/gmonFile.h, kaffe/xprof/gmonFile.c,
	kaffe/xprof/gmon_out.h, kaffe/xprof/mangle.h,
	kaffe/xprof/mangle.c, kaffe/xprof/memorySamples.h,
	kaffe/xprof/memorySamples.c, kaffe/xprof/sectionFile.h,
	kaffe/xprof/sectionFile.c, kaffe/xprof/xprofiler.h,
	kaffe/xprof/xprofiler.c: Added/modified to support xprofiling,
	xdebugging, and feedback.

-Pat

----- ----- ---- ---  ---  --   -    -      -         -               -
Pat Tullmann                                       tullmann@cs.utah.edu
 Indifference may cause the downfall of mankind, but who really cares?