[haiku-development] Re: Changing ByteOrder.h

  • From: Paweł Dziepak <pdziepak@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 3 May 2014 12:55:39 +0200

2014-05-03 11:26 GMT+02:00 Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>:
> Hi,
>
> In ticket #10800, initially I thought problems with the byteswap
> implementations was related to calling conventions, however, digging
> deeper and after some clarification by tqh, it's obviously not the
> case.
>
> It was also suggested to use GCC builtins to replace the existing
> byteswap functions, and I have the beginnings of a patch:
> https://dev.haiku-os.org/attachment/ticket/10800/0001-Replace-arch-dependent-integer-byteswap-routines-wit.patch
>
> Is this the right place to do this? Is it sufficient to assume this
> will be okay on all our platforms, or do we still want the builtins
> abstracted? If so, can that be done without losing the ability to
> inline them?

GCC builtins are available on all platforms but in some cases they
result in a call to a helper function (and that might be suboptimal).
However, such thing doesn't happen on x86[_64] and ARM architectures
so the patch is good.

Sooner or later we will need arch specific public headers, though.
There are many functions that should be inlined and do not have GCC
builtin equivalents (e.g. system_time() or tls_{address, get, set}()).
Actually, tls_*() functions are already inlined on x86 but it is
achieved in quite crude way (cf. /headers/os/support/TLS.h).

Please note that removal of __swap_int*() functions would break ABI. I
am not sure if we can do this in GCC2 builds.

Paweł

Other related posts: