mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 03:30:27 +02:00
Add `scm_immutable_cell ()'.
* libguile/inline.h (scm_immutable_cell): New.
This commit is contained in:
parent
d6c74168a7
commit
53ea4fdf99
1 changed files with 21 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
@ -124,6 +125,26 @@ scm_cell (scm_t_bits car, scm_t_bits cdr)
|
|||
return cell;
|
||||
}
|
||||
|
||||
#ifndef SCM_INLINE_C_INCLUDING_INLINE_H
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue