Extra Zero/Shark patches for review

Gary Benson gbenson at redhat.com
Thu Nov 19 06:05:57 PST 2009


Kurt Miller wrote:
> On OpenBSD we continue to use gcc 3.x on most archs since 4.x is
> substantially slower on older and slower architectures (among other
> reasons). In the cases where custom asm has been written to support
> an arch I think we should use it and fall back to the gcc builtins
> if gcc is being used.
> 
> For example:
> 
> >  inline jint Atomic::add(jint add_value, volatile jint* dest) {
> > -#ifdef ARM
> > -  return arm_add_and_fetch(dest, add_value);
> > -#else
> > -#ifdef M68K
> > -  return m68k_add_and_fetch(dest, add_value);
> > -#else
> > -  return __sync_add_and_fetch(dest, add_value);
> > -#endif // M68K
> > -#endif // ARM
> > +  atomic_add_int((volatile u_int*) dest, add_value);
> > +  return *dest;
> >  }
> 
> Would look something like:
> 
> inline jint Atomic::add(jint add_value, volatile jint* dest) {
> #if defined(ARM)
>   return arm_add_and_fetch(dest, add_value);
> #elif defined(M68K)
>   return m68k_add_and_fetch(dest, add_value);
> #elif defined(__GNUC__)
>   #if defined (__GNUC_MINOR__) && ((4 < __GNUC__) || (4 == __GNUC__ && 1
> <= __GNUC_MINOR__))
>     return __sync_add_and_fetch(dest, add_value);
>   #else
>     atomic_add_int((volatile u_int*) dest, add_value);
>   #endif // GCC ver
> #else
>   #error "No atomic add implementation"
> #endif // GNUC
> 
> Does that sound reasonable?

Sounds perfect.

Cheers,
Gary

-- 
http://gbenson.net/



More information about the bsd-port-dev mailing list