Hi,

let's discuss some of the possibilities to prevent the compiler from
optimizing our C implementation of mempcy()/memset() via a call to
memcpy()/memset().

I noticed Martin has already started to replace the C implementations
with implementations written in assembly. This will surely stop GCC from
creating this recursion, but is this the most elegant/maintainable thing
to do?

I experimented a little bit and it seems that each of the following
works too:

- making all pointers to the destination buffer in mempcy/memset
  volatile

- adding memcpy and memset __attribute__ ((optimize(2)))

The benefit is that we don't have to provide a dozen of asm implementations.

I also wonder whether we are not confusing gcc ourselves. On one had, we
build with -ffreestanding and -fno-builtin, but on the other hand we
define memcpy/memset as __builtin_memcpy/memset and provide our own
implementation. This looks like an open invitation for this recursion.

Jakub

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/cgi-bin/listinfo/helenos-devel

Reply via email to