1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Use immutable cells for closures.

* libguile/eval.c (scm_closure): Use `scm_immutable_cell ()' instead
  of `scm_cell ()'.

* libguile/procs.h (SCM_SETCODE, SCM_SETENV): Remove.
This commit is contained in:
Ludovic Courtès 2008-09-15 23:45:37 +02:00
parent d3be55145a
commit 3db825b067
2 changed files with 2 additions and 4 deletions

View file

@ -3654,7 +3654,8 @@ scm_closure (SCM code, SCM env)
{
SCM z;
SCM closcar = scm_cons (code, SCM_EOL);
z = scm_cell (SCM_UNPACK (closcar) + scm_tc3_closure, (scm_t_bits) env);
z = scm_immutable_cell (SCM_UNPACK (closcar) + scm_tc3_closure,
(scm_t_bits) env);
scm_remember_upto_here (closcar);
return z;
}

View file

@ -70,10 +70,7 @@ typedef struct
#define SCM_CLOSURE_BODY(x) SCM_CDR (SCM_CODE (x))
#define SCM_PROCPROPS(x) SCM_CDR (SCM_CLOSCAR (x))
#define SCM_SETPROCPROPS(x, p) SCM_SETCDR (SCM_CLOSCAR (x), p)
#define SCM_SETCODE(x, e) (SCM_SET_CELL_WORD_0 (x, SCM_UNPACK (scm_cons ((e), SCM_EOL)) \
+ scm_tc3_closure))
#define SCM_ENV(x) SCM_CELL_OBJECT_1 (x)
#define SCM_SETENV(x, e) SCM_SET_CELL_OBJECT_1 ((x), (e))
#define SCM_TOP_LEVEL(ENV) (scm_is_null (ENV) || (scm_is_true (scm_procedure_p (SCM_CAR (ENV)))))
/* Procedure-with-setter