summaryrefslogtreecommitdiff
path: root/libguile/inline.h
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@lilypond.org>2002-09-08 11:31:32 +0000
committerHan-Wen Nienhuys <hanwen@lilypond.org>2002-09-08 11:31:32 +0000
commit1e71eafb34713a35cb95c459d3a26dd0ad0f38b5 (patch)
tree5de03b2db6466c269df9e7074045367268580f29 /libguile/inline.h
parentdac04e9fb9fe0fcd39a375b57f8380e1798c7ef7 (diff)
downloadguile-1e71eafb34713a35cb95c459d3a26dd0ad0f38b5.tar.gz
* inline.h: include stdio.h
* smob.c (free_print): abort if scm_debug_cell_accesses_p is set
Diffstat (limited to 'libguile/inline.h')
-rw-r--r--libguile/inline.h42
1 files changed, 29 insertions, 13 deletions
diff --git a/libguile/inline.h b/libguile/inline.h
index ea6b51277..31d06d798 100644
--- a/libguile/inline.h
+++ b/libguile/inline.h
@@ -50,6 +50,11 @@
*/
+#if (SCM_DEBUG_CELL_ACCESSES == 1)
+#include <stdio.h>
+
+#endif
+
#include "libguile/pairs.h"
#include "libguile/gc.h"
@@ -94,20 +99,31 @@ scm_cell (scm_t_bits car, scm_t_bits cdr)
#if (SCM_DEBUG_CELL_ACCESSES == 1)
if (scm_debug_cell_accesses_p)
- {
- if (SCM_GC_MARK_P (z))
- {
- fprintf(stderr, "scm_cell tried to allocate a marked cell.\n");
- abort();
- }
- else if (SCM_GC_CELL_TYPE(z) != scm_tc_free_cell)
- {
- fprintf(stderr, "cell from freelist is not a free cell.\n");
- abort();
- }
+ {
+ if (SCM_GC_MARK_P (z))
+ {
+ fprintf(stderr, "scm_cell tried to allocate a marked cell.\n");
+ abort();
+ }
+ else if (SCM_GC_CELL_TYPE(z) != scm_tc_free_cell)
+ {
+ fprintf(stderr, "cell from freelist is not a free cell.\n");
+ abort();
+ }
+ }
+
+ /*
+ Always set mark. Otherwise cells that are alloced before
+ scm_debug_cell_accesses_p is toggled seem invalid.
+ */
+ SCM_SET_GC_MARK (z);
+
+ /*
+ TODO: figure out if this use of mark bits is valid with
+ threading. What if another thread is doing GC at this point
+ ... ?
+ */
- SCM_SET_GC_MARK (z);
- }
#endif