[kaffe] More mipsel jit3

Casey Marshall rsdio at metastatic.org
Tue Mar 9 10:30:03 PST 2004

Hash: SHA1

>>>>> "Kevin" == Kevin D Kissell <kevink at mips.com> writes:

>> >>>>> "Casey" == Casey Marshall <rsdio at metastatic.org> writes:
>> Yeah, ok, I was pretty wrong with the implementations of fcmpl and
>> friends. I think I have it sorted now.

Kevin> One question about that: Did you implement those operations
Kevin> because you thought it would be good for performance, or did
Kevin> you have the impression that the JIT was failing because of
Kevin> their absence?  They did not seem to be broken when I was
Kevin> working on jit3 under 1.0.7/1.0.8.  There are a number of
Kevin> possible jit3 optimizations for MIPS that I noted when I was
Kevin> working on it (though of course I no longer remember what they
Kevin> were- sigh), but I'd suggest getting things working correctly
Kevin> before launching into any optimization campaign!

Even so, it actually was helpful. I am pretty sure now that the
problem is with how parameters are being passed to soft_
functions. The fp comparisons failed (it looks like) because the
parameters to soft_fcmpl (etc...) were not being called with proper
arguments. With that out of the way now that this is being done in
assembler, the call to soft_anewarray fails for a similar reason (you
can trace this in the constructor to HashMap -- it failed for me first
at the check of loadFactor, and now fails when the buckets are

So now the bug appears to be pretty specific: C functions provided
internally by Kaffe are not being called properly.

>> But now my problem appears to be that soft_anewarray is being
>> called with an uninitialized class, which is supposed to be
>> java.util.HashMap$HashEntry. Any ideas of why this would happen?

Kevin> Hmm.  That sounds familiar.  When you say "uninitialized
Kevin> class", do you mean a completely uninitialized class, or an
Kevin> incompletely intialized one that contains a null pointer?

Here's the backtrace when I break at soft_anewarray:

#0  soft_anewarray (elclass=0x100bd4a0, size=269223872)
    at /home/casey/src/kaffe/kaffe/kaffevm/soft.c:111
warning: Warning: GDB can't find the start of the function at 0x100d154c.

(0x100d154c is inside the jitted HashMap constructor)

The `size' parameter is obviously wrong. In fact, it's actually a
pointer to a Hjava_lang_Class:

(gdb) print *((Hjava_lang_Class *) 269223872)
$3 = {head = {dtable = 0x10019c38, lock = 0x0}, lock = 0x0, 
  centry = 0x100c3d98, name = 0x100bd650, packageLength = 9, 
  sourcefile = 0x100cd280 "HashMap.java", accflags = 8, 
  superclass = 0x100c0900, constants = {size = 29, tags = 0x100c08d4 "", 
    data = 0x100c0860}, methods = 0x10064c38, nmethods = 3, msize = 8, 
  fields = 0x100c3db8, bfsize = 20, nfields = 1, nsfields = 0, 
  dtable = 0x100bfa38, interfaces = 0x100c7610, if2itable = 0x100c7620, 
  itable2dtable = 0x100c3f58, interface_len = 0, total_interface_len = 1, 
  implementors = 0x0, impl_index = 2, loader = 0x0, gc_layout = 0x100c7600, 
  state = CSTATE_LINKED, processingThread = 0x10021018, finalizer = 0x0, 
  alloc_type = 0, static_data = 0x0, this_index = 2, this_inner_index = 0, 
  nr_inner_classes = 1, inner_classes = 0x100c7500, gcjPeer = 0x0, live_count = 0}

I think that this class is HashMap itself, but can't really tell.

soft_anewarray should be called here with java.util.HashMap$HashEntry
and 11. 11 appears in two registers at this stack frame: t6 (aka i14)
and s0 (aka i16). The only valid class that I can see in this call is
the one above (*0x100bd4a0 looks like a valid Hjava_lang_Class
structure, but it is completely unititialized).

Kevin> Looking back over my archives, I note that Kapil Vaswani was
Kevin> trying to get jit3 to work on Alpha last April, and was getting
Kevin> similar error messages to what I was seeing in the crashes I
Kevin> described above.  If the Alpha JIT is now working correctly,
Kevin> you might what to take a look at the CVS log of the Alpha tree
Kevin> to see if some change has an analogy in MIPS.

I will do that. Thanks.

- -- 
Casey Marshall || rsdio at metastatic.org
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.7 <http://mailcrypt.sourceforge.net/>


More information about the kaffe mailing list