gcj 4.3.0 on mpc860 kernel 2.4.24

Ben Gardiner BenGardiner@nanometrics.ca
Fri May 9 15:07:00 GMT 2008


Andrew Haley wrote:
> Linuxthreads?  I don't like the sound of that.  gcj doesn't have any
> explicit dependencies on NPTL, but it doesn't get tested on Linuxthreads.
>   
I see. That's important information, thank you.
> Where does it segfault?  I mean, where *exactly*?
>   
It segfaults in _Jv_MonitorEnter at locks.h:44 (compare_and_swap); here 
is a full bt up to prims.cc:1666 ( _Jv_InitClass 
(&java::lang::ClassLoader::class$); ) :

-------------------------------------------------------------------------
#0  _Jv_MonitorEnter (obj=<value optimized out>) at sysdep/locks.h:44
        addr = 264790936
        address = 0
        he = (hash_entry *) 0xff83458
        self = 16384
        was_heavy = <value optimized out>
#1  0x0eaa36e0 in _Jv_StringFindSlot (data=0x7ffffae8, len=<value 
optimized out>, hash=<value optimized out>)
    at 
/usr/src/debug/cross-powerpc-unknown-linux-gnu/gcc-4.3.0-r1/gcc-4.3.0/libjava/gcj/cni.h:99
        start_index = <value optimized out>
        deleted_index = <value optimized out>
        index = <value optimized out>
        step = <value optimized out>
#2  0x0eaa3df0 in _Jv_NewStringUtf8Const (str=<value optimized out>)
    at 
/usr/src/debug/cross-powerpc-unknown-linux-gnu/gcc-4.3.0-r1/gcc-4.3.0/libjava/java/lang/natString.cc:294
        chrs = (jchar *) 0x7ffffae8
        buffer = {106, 97, 118, 97, 46, 115, 101, 99, 117, 114, 105, 
116, 121, 46, 109, 97, 110, 97, 103, 101, 114, 6, 9216, 66, 32767, 64272,
  4020, 520, 0, 6, 12293, 48248, 4017, 46096, 32767, 64304, 32767, 
64368, 3753, 56304, 0, 0, 0, 0, 3943, 3654, 0, 0, 0, 0, 0, 0, 0, 72, 0, 1,
  0, 0, 0, 0, 0, 1, 4020, 520, 4017, 41732, 0, 0, 32767, 64400, 3748, 
61164, 32767, 64488, 0, 18, 32767, 64416, 3943, 3648, 4017, 42580, 0,
  18, 12293, 48248, 3943, 3648, 4017, 42580, 4040, 2600, 32767, 64480, 
3750, 15376, 32767, 64884, 0, 0}
        jstr = (jstring) 0x0
        data = <value optimized out>
        limit = (unsigned char *) 0xf671bfa ""
        length = 0
        hash = 0
        ptr = <value optimized out>
#3  0x0ea63db0 in _Jv_Linker::ensure_class_linked (klass=0xfc80a28)
    at 
/usr/src/debug/cross-powerpc-unknown-linux-gnu/gcc-4.3.0-r1/gcc-4.3.0/libjava/link.cc:1742
        str = <value optimized out>
        index = <value optimized out>
#4  0x0ea640f0 in _Jv_Linker::wait_for_state (klass=0xfc80a28, state=9)
    at 
/usr/src/debug/cross-powerpc-unknown-linux-gnu/gcc-4.3.0-r1/gcc-4.3.0/libjava/link.cc:2057
        save = (struct java::lang::Thread *) 0x0
        self = (struct java::lang::Thread *) 0x0
#5  0x0ea9b99c in java::lang::Class::initializeClass (this=0xfc80a28)
    at 
/usr/src/debug/cross-powerpc-unknown-linux-gnu/gcc-4.3.0-r1/gcc-4.3.0/libjava/java/lang/natClass.cc:717
        self = <value optimized out>
#6  0x0ea9d510 in _Jv_InitClass (klass=<value optimized out>)
    at 
/usr/src/debug/cross-powerpc-unknown-linux-gnu/gcc-4.3.0-r1/gcc-4.3.0/libjava/java/lang/Class.h:742
No locals.
#7  0x0ea4f6c8 in _Jv_CreateJavaVM (vm_args=0x0) at 
/usr/src/debug/cross-powerpc-unknown-linux-gnu/gcc-4.3.0-r1/gcc-4.3.0/libjava/prims.cc:1666
No locals.
------------------------------------------------------------------------

and here is my locks.h around 44:
------------------------------------------------------------------------
30      compare_and_swap (volatile obj_addr_t *addr, obj_addr_t old,
31                        obj_addr_t new_val)
32      {
33        obj_addr_t ret;
34
35        __asm__ __volatile__ (
36                 "0:    " _LARX "%0,0,%1 \n"
37                 "      xor. %0,%3,%0\n"
38                 "      bne 1f\n"
39                 "      " _STCX "%2,0,%1\n"
40                 "      bne- 0b\n"
41                 "1:   \n"
42              : "=&r" (ret)
43              : "r" (addr), "r" (new_val), "r" (old)
44              : "cr0", "memory");
45
46        /* This version of __compare_and_swap is to be used when acquiring
47           a lock, so we don't need to worry about whether other memory
48           operations have completed, but we do need to be sure that 
any loads
49           after this point really occur after we have acquired the 
lock.  */
50        __asm__ __volatile__ ("isync" : : : "memory");
51        return ret == 0;
52      }
-------------------------------------------------------------------------

I did a diff and discovered that this file is the 
libjava/sysdep/powerpc/locks.h file (no surprise). I'm not an expert in 
PPC assembly and I don't know if those instructions are supported on the 
mpc860; I will look into that. In the meantime, I may try to get the ' 
--enable-portable-native-sync' configure option from 4.2.3 to work with 
4.3.0. I'm thinking I might have better luck with sysdep/generic/locks.h.

Thanks for you help so far. I hope to hear more of your thoughts on this 
matter.
,Ben



More information about the Java mailing list