mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
* pairs.h, eval.c, gc.c, init.c, ioext.c, ports.c, ports.h,
srcprop.h, tags.h, throw.c, unif.c: Added new selectors SCM_SETAND_CAR, SCM_SETAND_CDR, SCM_SETOR_CAR and SCM_SETOR_CDR. Motivation: Safer use. Some other macros are defined in terms of these operations. If these are defined using the SCM_SETCXR (<e1>, SCM_CXR (<e1>) <op> <e2>) pattern a complex <e1> will lead to inefficiency and an <e1> with side-effects could potentially break. Also, these particular operations are heavily utilized in the garbage collector. In unoptimized code there will be a measurable speedup. * alist.c, arbiters.c, continuations.c, debug.c, debug.h, eval.c, eval.h, feature.c, filesys.c, fports.c, gc.c, gsubr.c, init.c, ioext.c, kw.c, list.c, load.c, mallocs.c, numbers.c, numbers.h, pairs.c, pairs.h, ports.c, ports.h, posix.c, procprop.c, procs.c, procs.h, ramap.c, read.c, root.c, srcprop.c, srcprop.h, strports.c, symbols.c, tags.h, throw.c, unif.c, variable.c, vports.c: Cleaned up use of pairs: Don't make any special assumptions about the internal structure of selectors and mutators: SCM_CXR (<e1>) = <e2> --> SCM_SETCXR (<e1>, <e2>), SCM_CXR (<e1>) &= <e2> --> SCM_SETAND_CXR (<e1>, <e2>) etc. (Among other things, this change makes it easier to build Guile with certain compilers which have problems with casted lvalues.)
This commit is contained in:
parent
3f46d95978
commit
898a256f91
8 changed files with 34 additions and 32 deletions
|
@ -62,8 +62,8 @@ static int scm_tc16_jmpbuffer;
|
|||
|
||||
#define SCM_JMPBUFP(O) (SCM_TYP16(O) == scm_tc16_jmpbuffer)
|
||||
#define JBACTIVE(O) (SCM_CAR (O) & (1L << 16L))
|
||||
#define ACTIVATEJB(O) (SCM_CAR (O) |= (1L << 16L))
|
||||
#define DEACTIVATEJB(O) (SCM_CAR (O) &= ~(1L << 16L))
|
||||
#define ACTIVATEJB(O) (SCM_SETOR_CAR (O, (1L << 16L)))
|
||||
#define DEACTIVATEJB(O) (SCM_SETAND_CAR (O, ~(1L << 16L)))
|
||||
|
||||
#ifndef DEBUG_EXTENSIONS
|
||||
#define JBJMPBUF(O) ((jmp_buf*)SCM_CDR (O) )
|
||||
|
@ -71,7 +71,7 @@ static int scm_tc16_jmpbuffer;
|
|||
#else
|
||||
#define SCM_JBDFRAME(O) ((scm_debug_frame*)SCM_CAR (SCM_CDR (O)) )
|
||||
#define JBJMPBUF(O) ((jmp_buf*)SCM_CDR (SCM_CDR (O)) )
|
||||
#define SCM_SETJBDFRAME(O,X) SCM_CAR(SCM_CDR (O)) = (SCM)(X)
|
||||
#define SCM_SETJBDFRAME(O,X) SCM_SETCAR (SCM_CDR (O), (SCM)(X))
|
||||
#define SETJBJMPBUF(O,X) SCM_SETCDR(SCM_CDR (O), X)
|
||||
|
||||
static scm_sizet freejb SCM_P ((SCM jbsmob));
|
||||
|
@ -122,7 +122,7 @@ make_jmpbuf ()
|
|||
char *mem = scm_must_malloc (sizeof (scm_cell), "jb");
|
||||
SCM_SETCDR (answer, (SCM) mem);
|
||||
#endif
|
||||
SCM_CAR(answer) = scm_tc16_jmpbuffer;
|
||||
SCM_SETCAR (answer, scm_tc16_jmpbuffer);
|
||||
SETJBJMPBUF(answer, (jmp_buf *)0);
|
||||
DEACTIVATEJB(answer);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue