Use immutable cells for closures.
authorLudovic Courtès <ludo@gnu.org>
Mon, 15 Sep 2008 21:45:37 +0000 (23:45 +0200)
committerLudovic Courtès <ludo@gnu.org>
Mon, 15 Sep 2008 21:45:37 +0000 (23:45 +0200)
* libguile/eval.c (scm_closure): Use `scm_immutable_cell ()' instead
  of `scm_cell ()'.

* libguile/procs.h (SCM_SETCODE, SCM_SETENV): Remove.

libguile/eval.c
libguile/procs.h

index 5aba969..49f1b58 100644 (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;
 }
index 9e4b132..734ce7b 100644 (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