guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scm_remember_upto_here asm volatile


From: Kevin Ryde
Subject: scm_remember_upto_here asm volatile
Date: Mon, 12 May 2003 08:19:21 +1000
User-agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux)

I was contemplating scm_remember_upto_here_1 and friends and wondered
if thought had been given to doing them in gcc as

    #define scm_remember_upto_here_1(x)             \
      do {                                          \
        asm volatile ("" : : "g" (x));              \
      } while (0)

    #define scm_remember_upto_here_2(x, y)          \
      do {                                          \
        scm_remember_upto_here_1 (x);               \
        scm_remember_upto_here_1 (y);               \
      } while (0)

"volatile" stops the asm being moved, though it can still go dead.
"g" will mean the value isn't forced into a register, a stack
reference is ok.  (Though gcc quite likes bringing things into
registers.)

Avoiding function calls should make the resulting code a little
smaller and faster.  numbers.o comes down from 45k to 43k for me (i386
debian gcc 3.2 -O3), which is not huge but better than a poke in the
eye with a burnt stick.

Unfortunately I can't see how to do the varargs scm_remember_upto_here
the same way.  But it's not used in the main guile code as far as I
can tell.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]