Well, I know the __asm__ fairly well from the times, when I wrote device drivers. Its not so bad and its documented, but the documentation is hard to read.

To make my point clear: instead of using the clobber list of the __asm__ statement, we could write two __asm__ statements, one to store the registers on the stack and a second one to restore them. This way, we must choose the right register set. I prefer the compiler to choose the right registers.

Am 14.07.2011 00:42, schrieb Richard Tew:
On Thu, Jul 14, 2011 at 6:14 AM, Anselm Kruis
<[email protected]>  wrote:
3. Using the clobber mechanism is a mixed blessing. On the one hand the 
compiler knows what to preserve. On the other hand, we have no guarantee, at 
which point in time the compiler restores the registers. The compile may 
restore the values immediately after the first __asm__ statement. Fortunately
current gcc versions don't do it.

When I had problems with __asm__ in gcc, I went to the gcc mailing
list and it was advised that I write actual assembly.  This is why the
arm thumb switch implementation completely written in assembly.  It's
a bit more work, but if you really wanted to make sure this wouldn't
happen, it's probably the way to go.

Jeff, you got time to test this on your end?  And maybe check it in,
if it looks okay?

We should really double check the assembler output of the compiler on darwin. On darwin the configure.in sets the -fomit-frame-pointer option and I have seen incorrect assembly code for older gcc versions in that case. The rbp register was not preserved. I didn't change configure.in, because I have no way to test it, but I'm in doubt that the special case for darwin is required at all.


Regards
  Anselm


Cheers,
Richard.

_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

--
 Dipl. Phys. Anselm Kruis                       science + computing ag
 Senior Solution Architect                      Ingolstädter Str. 22
 email [email protected]             80807 München, Germany
 phone +49 89 356386 874  fax 737               www.science-computing.de

--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Philippe Miltin
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196


_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to