summaryrefslogtreecommitdiff
path: root/libguile/inline.h
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2008-09-15 23:28:35 +0200
committerLudovic Courtès <ludo@gnu.org>2008-09-15 23:28:35 +0200
commit53ea4fdf99878eb603c8f650a09b91f0c92fc6f5 (patch)
treec7135774f979df4296b39ab572b9439492031ed5 /libguile/inline.h
parentd6c74168a7312dd574dbb33e4f2933473fc05e7d (diff)
downloadguile-53ea4fdf99878eb603c8f650a09b91f0c92fc6f5.tar.gz
Add `scm_immutable_cell ()'.
* libguile/inline.h (scm_immutable_cell): New.
Diffstat (limited to 'libguile/inline.h')
-rw-r--r--libguile/inline.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/libguile/inline.h b/libguile/inline.h
index 3fae97c17..3a4302afc 100644
--- a/libguile/inline.h
+++ b/libguile/inline.h
@@ -80,6 +80,7 @@
SCM_API SCM scm_cell (scm_t_bits car, scm_t_bits cdr);
+SCM_API SCM scm_immutable_cell (scm_t_bits car, scm_t_bits cdr);
SCM_API SCM scm_double_cell (scm_t_bits car, scm_t_bits cbr,
scm_t_bits ccr, scm_t_bits cdr);
@@ -128,6 +129,26 @@ scm_cell (scm_t_bits car, scm_t_bits cdr)
SCM_C_EXTERN_INLINE
#endif
SCM
+scm_immutable_cell (scm_t_bits car, scm_t_bits cdr)
+{
+ SCM cell = SCM_PACK ((scm_t_bits) (GC_MALLOC_STUBBORN (sizeof (scm_t_cell))));
+
+ /* Initialize the type slot last so that the cell is ignored by the GC
+ until it is completely initialized. This is only relevant when the GC
+ can actually run during this code, which it can't since the GC only runs
+ when all other threads are stopped. */
+ SCM_GC_SET_CELL_WORD (cell, 1, cdr);
+ SCM_GC_SET_CELL_WORD (cell, 0, car);
+
+ GC_END_STUBBORN_CHANGE ((void *) cell);
+
+ return cell;
+}
+
+#ifndef SCM_INLINE_C_INCLUDING_INLINE_H
+SCM_C_EXTERN_INLINE
+#endif
+SCM
scm_double_cell (scm_t_bits car, scm_t_bits cbr,
scm_t_bits ccr, scm_t_bits cdr)
{