mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 23:50:19 +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
|
@ -182,7 +182,7 @@ scm_makflo (x)
|
|||
return scm_flo0;
|
||||
SCM_NEWCELL (z);
|
||||
SCM_DEFER_INTS;
|
||||
SCM_CAR (z) = scm_tc_flo;
|
||||
SCM_SETCAR (z, scm_tc_flo);
|
||||
SCM_FLO (z) = x;
|
||||
SCM_ALLOW_INTS;
|
||||
return z;
|
||||
|
@ -501,7 +501,7 @@ scm_make_ra (ndim)
|
|||
SCM_DEFER_INTS;
|
||||
SCM_SETCDR (ra, scm_must_malloc ((long) (sizeof (scm_array) + ndim * sizeof (scm_array_dim)),
|
||||
"array"));
|
||||
SCM_CAR (ra) = ((long) ndim << 17) + scm_tc16_array;
|
||||
SCM_SETCAR (ra, ((long) ndim << 17) + scm_tc16_array);
|
||||
SCM_ARRAY_V (ra) = scm_nullvect;
|
||||
SCM_ALLOW_INTS;
|
||||
return ra;
|
||||
|
@ -583,7 +583,7 @@ scm_dimensions_to_uniform_array (dims, prot, fill)
|
|||
SCM_ASSERT (SCM_NULLP (dims) || (SCM_NIMP (dims) && SCM_CONSP (dims)),
|
||||
dims, SCM_ARG1, s_dimensions_to_uniform_array);
|
||||
ra = scm_shap2ra (dims, s_dimensions_to_uniform_array);
|
||||
SCM_CAR (ra) |= SCM_ARRAY_CONTIGUOUS;
|
||||
SCM_SETOR_CAR (ra, SCM_ARRAY_CONTIGUOUS);
|
||||
s = SCM_ARRAY_DIMS (ra);
|
||||
k = SCM_ARRAY_NDIM (ra);
|
||||
while (k--)
|
||||
|
@ -653,14 +653,14 @@ scm_ra_set_contp (ra)
|
|||
{
|
||||
if (inc != SCM_ARRAY_DIMS (ra)[k].inc)
|
||||
{
|
||||
SCM_CAR (ra) &= ~SCM_ARRAY_CONTIGUOUS;
|
||||
SCM_SETAND_CAR (ra, ~SCM_ARRAY_CONTIGUOUS);
|
||||
return;
|
||||
}
|
||||
inc *= (SCM_ARRAY_DIMS (ra)[k].ubnd
|
||||
- SCM_ARRAY_DIMS (ra)[k].lbnd + 1);
|
||||
}
|
||||
}
|
||||
SCM_CAR (ra) |= SCM_ARRAY_CONTIGUOUS;
|
||||
SCM_SETOR_CAR (ra, SCM_ARRAY_CONTIGUOUS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -736,7 +736,7 @@ scm_make_shared_array (oldra, mapfunc, dims)
|
|||
{
|
||||
if (s[k].ubnd > s[k].lbnd)
|
||||
{
|
||||
SCM_CAR (indptr) = SCM_MAKINUM (SCM_INUM (SCM_CAR (indptr)) + 1);
|
||||
SCM_SETCAR (indptr, SCM_MAKINUM (SCM_INUM (SCM_CAR (indptr)) + 1));
|
||||
imap = scm_apply (mapfunc, scm_reverse (inds), SCM_EOL);
|
||||
if (SCM_ARRAYP (oldra))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue