Re: gcj 4.3.0 on mpc860 kernel 2.4.24

Andrew Haley <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
Ben Gardiner wrote:
> 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>

Aha!  At the segfault, do something like

x/4i $pc

> ------------------------------------------------------------------------
> 
> 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.

I doubt it.  gcj needs something that really works.

It really, really, really is worth trying to get a real compare_and_swap
that is written for your hardware.  

Andrew.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.