summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>2000-05-25 09:21:06 +0000
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>2000-05-25 09:21:06 +0000
commit47457e8a432ec904bad6d98d340df8b76898d44e (patch)
tree0b01b612801ed58a02f35e61553f06c7f30f1337
parentf2f551af7aea06c6f7377235701d5f50e9cfc090 (diff)
downloadguile-47457e8a432ec904bad6d98d340df8b76898d44e.tar.gz
* Replace SCM_UNPACK_CAR appropriately.
* Only access cons cells via SCM_{SET}?C[AD]R. * gc.c: Remove unused struct member variable 'valid'.
-rw-r--r--libguile/ChangeLog12
-rw-r--r--libguile/filesys.h5
-rw-r--r--libguile/fluids.h4
-rw-r--r--libguile/fports.h8
-rw-r--r--libguile/gc.c17
-rw-r--r--libguile/hooks.h4
-rw-r--r--libguile/keywords.h4
-rw-r--r--libguile/numbers.h9
8 files changed, 32 insertions, 31 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index c25b4d8c0..6f1d47d5b 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,15 @@
+2000-05-25 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
+ * filesys.h (SCM_OPDIRP), fluids (SCM_FLUIDP, SCM_FLUID_NUM),
+ fports.h (SCM_OPFPORTP, SCM_OPINFPORTP, SCM_OPOUTFPORTP), hooks.h
+ (SCM_HOOK_ARITY), keywords.h (SCM_KEYWORDP, SCM_KEYWORDSYM),
+ numbers.h (SCM_NUMP, SCM_BIGSIGN, SCM_BDIGITS, SCM_NUMDIGS):
+ Replace SCM_UNPACK_CAR appropriately. Don't access cells via
+ SCM_{SET}?C[AD]R unless they are known to be cons cells.
+
+ * gc.c (scm_heap_seg_data_t, scm_mark_locations, scm_cellp,
+ init_heap_seg): Remove unused struct member variable 'valid'.
+
2000-05-24 Dirk Herrmann <D.Herrmann@tu-bs.de>
* fports.c (fport_write), ports.c (scm_markstream, scm_port_mode,
diff --git a/libguile/filesys.h b/libguile/filesys.h
index 7573b6332..7859cf97b 100644
--- a/libguile/filesys.h
+++ b/libguile/filesys.h
@@ -53,8 +53,9 @@
extern long scm_tc16_dir;
-#define SCM_DIRP(x) (SCM_NIMP(x) && (SCM_TYP16(x)==(scm_tc16_dir)))
-#define SCM_OPDIRP(x) (SCM_NIMP(x) && (SCM_UNPACK_CAR(x)==(scm_tc16_dir | SCM_OPN)))
+#define SCM_DIRP(x) (!SCM_IMP (x) && (SCM_TYP16 (x) == scm_tc16_dir))
+#define SCM_OPDIRP(x) (!SCM_IMP (x) && (SCM_CELL_WORD_0 (x) == (scm_tc16_dir | SCM_OPN)))
+
extern SCM scm_chown (SCM object, SCM owner, SCM group);
diff --git a/libguile/fluids.h b/libguile/fluids.h
index 0058cfd86..1031cbad0 100644
--- a/libguile/fluids.h
+++ b/libguile/fluids.h
@@ -75,8 +75,8 @@
extern long scm_tc16_fluid;
-#define SCM_FLUIDP(x) (SCM_NIMP(x) && (SCM_UNPACK_CAR (x) == scm_tc16_fluid))
-#define SCM_FLUID_NUM(x) SCM_UNPACK (SCM_CDR(x))
+#define SCM_FLUIDP(x) (!SCM_IMP (x) && (SCM_CELL_TYPE (x) == scm_tc16_fluid))
+#define SCM_FLUID_NUM(x) (SCM_CELL_WORD_1 (x))
/* The fastest way to acces/modify the value of a fluid. These macros
do no error checking at all. You should only use them when you know
diff --git a/libguile/fports.h b/libguile/fports.h
index 455c293c5..d3c304b4f 100644
--- a/libguile/fports.h
+++ b/libguile/fports.h
@@ -61,10 +61,10 @@ struct scm_fport {
#define SCM_FSTREAM(x) ((struct scm_fport *) SCM_STREAM (x))
#define SCM_FPORT_FDES(x) (SCM_FSTREAM (x)->fdes)
-#define SCM_FPORTP(x) (SCM_NIMP(x) && (SCM_TYP16S(x)==scm_tc7_port))
-#define SCM_OPFPORTP(x) (SCM_NIMP(x) && (((0xfeff | SCM_OPN) & SCM_UNPACK_CAR (x))==(scm_tc7_port | SCM_OPN)))
-#define SCM_OPINFPORTP(x) (SCM_NIMP(x) && (((0xfeff | SCM_OPN | SCM_RDNG) & SCM_UNPACK_CAR (x))==(scm_tc7_port | SCM_OPN | SCM_RDNG)))
-#define SCM_OPOUTFPORTP(x) (SCM_NIMP(x) && (((0xfeff | SCM_OPN | SCM_WRTNG) & SCM_UNPACK_CAR (x))==(scm_tc7_port | SCM_OPN | SCM_WRTNG)))
+#define SCM_FPORTP(x) (!SCM_IMP (x) && (SCM_TYP16S (x) == scm_tc7_port))
+#define SCM_OPFPORTP(x) (!SCM_IMP (x) && (((0xfeff | SCM_OPN) & SCM_CELL_WORD_0 (x)) == (scm_tc7_port | SCM_OPN)))
+#define SCM_OPINFPORTP(x) (!SCM_IMP (x) && (((0xfeff | SCM_OPN | SCM_RDNG) & SCM_CELL_WORD_0 (x)) == (scm_tc7_port | SCM_OPN | SCM_RDNG)))
+#define SCM_OPOUTFPORTP(x) (!SCM_IMP(x) && (((0xfeff | SCM_OPN | SCM_WRTNG) & SCM_CELL_WORD_0 (x)) == (scm_tc7_port | SCM_OPN | SCM_WRTNG)))
/* test whether fdes supports random access. */
#define SCM_FDES_RANDOM_P(fdes) ((lseek (fdes, 0, SEEK_CUR) == -1) ? 0 : 1)
diff --git a/libguile/gc.c b/libguile/gc.c
index 353bcee00..9c90dc31c 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -282,12 +282,6 @@ typedef struct scm_heap_seg_data_t
/* number of cells per object in this segment */
int span;
-
- /* If SEG_DATA->valid is non-zero, the conservative marking
- functions will apply SEG_DATA->valid to the purported pointer and
- SEG_DATA, and mark the object iff the function returns non-zero.
- At the moment, I don't think anyone uses this. */
- int (*valid) ();
} scm_heap_seg_data_t;
@@ -1266,12 +1260,9 @@ scm_mark_locations (SCM_STACKITEM x[], scm_sizet n)
break;
}
}
- if (!scm_heap_table[seg_id].valid
- || scm_heap_table[seg_id].valid (ptr,
- &scm_heap_table[seg_id]))
- if (scm_heap_table[seg_id].span == 1
- || SCM_DOUBLE_CELLP (* (SCM *) &x[m]))
- scm_gc_mark (* (SCM *) &x[m]);
+ if (scm_heap_table[seg_id].span == 1
+ || SCM_DOUBLE_CELLP (* (SCM *) &x[m]))
+ scm_gc_mark (* (SCM *) &x[m]);
break;
}
@@ -1303,7 +1294,6 @@ scm_cellp (SCM value)
if (SCM_PTR_LE (scm_heap_table[i].bounds[0], ptr)
&& SCM_PTR_GT (scm_heap_table[i].bounds[1], ptr)
- && (!scm_heap_table[i].valid || scm_heap_table[i].valid (ptr, &scm_heap_table[i]))
&& (scm_heap_table[i].span == 1 || SCM_DOUBLE_CELLP (value))) {
return 1;
} else {
@@ -1887,7 +1877,6 @@ init_heap_seg (SCM_CELLPTR seg_org, scm_sizet size, scm_freelist_t *freelist)
++scm_n_heap_segs;
- scm_heap_table[new_seg_index].valid = 0;
scm_heap_table[new_seg_index].span = span;
scm_heap_table[new_seg_index].freelist = freelist;
scm_heap_table[new_seg_index].bounds[0] = ptr;
diff --git a/libguile/hooks.h b/libguile/hooks.h
index 8b89eaa5e..c61a292fd 100644
--- a/libguile/hooks.h
+++ b/libguile/hooks.h
@@ -96,8 +96,8 @@ extern void *scm_c_hook_run (scm_c_hook_t *hook, void *data);
* Scheme level hooks
*/
-#define SCM_HOOKP(x) (SCM_NIMP(x) && (SCM_TYP16 (x) == scm_tc16_hook))
-#define SCM_HOOK_ARITY(hook) (SCM_UNPACK_CAR (hook) >> 16)
+#define SCM_HOOKP(x) (!SCM_IMP (x) && (SCM_TYP16 (x) == scm_tc16_hook))
+#define SCM_HOOK_ARITY(hook) (SCM_CELL_WORD_0 (hook) >> 16)
#define SCM_HOOK_NAME(hook) SCM_CADR (hook)
#define SCM_HOOK_PROCEDURES(hook) SCM_CDDR (hook)
#define SCM_SET_HOOK_PROCEDURES(hook, procs) SCM_SETCDR (SCM_CDR (hook), procs)
diff --git a/libguile/keywords.h b/libguile/keywords.h
index 0eda0e8ac..5858cdaa4 100644
--- a/libguile/keywords.h
+++ b/libguile/keywords.h
@@ -52,8 +52,8 @@
extern int scm_tc16_keyword;
-#define SCM_KEYWORDP(X) (SCM_NIMP(X) && (SCM_UNPACK_CAR (X) == scm_tc16_keyword))
-#define SCM_KEYWORDSYM(X) (SCM_CDR(X))
+#define SCM_KEYWORDP(X) (!SCM_IMP (X) && (SCM_CELL_TYPE (X) == scm_tc16_keyword))
+#define SCM_KEYWORDSYM(X) (SCM_CELL_OBJECT_1 (X))
diff --git a/libguile/numbers.h b/libguile/numbers.h
index b21729e55..ab8bd257c 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -166,14 +166,13 @@
#endif /* ndef SCM_BIGDIG */
#define SCM_NUMBERP(x) (SCM_INUMP(x) || SCM_NUMP(x))
-#define SCM_NUMP(x) \
- (SCM_NIMP(x) && (0xfcff & SCM_UNPACK (SCM_CAR(x))) == scm_tc7_smob)
+#define SCM_NUMP(x) (!SCM_IMP(x) && (0xfcff & SCM_CELL_TYPE (x)) == scm_tc7_smob)
#define SCM_BIGP(x) SCM_SMOB_PREDICATE (scm_tc16_big, x)
#define SCM_BIGSIGNFLAG 0x10000L
#define SCM_BIGSIZEFIELD 17
-#define SCM_BIGSIGN(x) (SCM_UNPACK_CAR (x) & SCM_BIGSIGNFLAG)
-#define SCM_BDIGITS(x) ((SCM_BIGDIG *) SCM_UNPACK (SCM_CDR (x)))
-#define SCM_NUMDIGS(x) ((scm_sizet) (SCM_UNPACK_CAR (x) >> SCM_BIGSIZEFIELD))
+#define SCM_BIGSIGN(x) (SCM_CELL_WORD_0 (x) & SCM_BIGSIGNFLAG)
+#define SCM_BDIGITS(x) ((SCM_BIGDIG *) (SCM_CELL_WORD_1 (x)))
+#define SCM_NUMDIGS(x) ((scm_sizet) (SCM_CELL_WORD_0 (x) >> SCM_BIGSIZEFIELD))
#define SCM_SETNUMDIGS(x, v, sign) \
SCM_SET_CELL_WORD_0 (x, \
scm_tc16_big \