[uim-commit] r2396 - branches/r5rs/sigscheme
kzk at freedesktop.org
kzk at freedesktop.org
Tue Dec 6 08:23:00 PST 2005
Author: kzk
Date: 2005-12-06 08:22:54 -0800 (Tue, 06 Dec 2005)
New Revision: 2396
Modified:
branches/r5rs/sigscheme/sigschemetype-compact.h
branches/r5rs/sigscheme/storage-gc.c
Log:
* sigscheme/sigschemetype-compact.h
- (SCM_IS_UNMARKED): fixed typo
- (SCM_CANBE_MARKED,
SCM_STRIP_TAG_INFO): new macro
* sigscheme/storage-gc.c
- (is_pointer_to_heap):
- reject immediate objects here for efficiency
- hide internal representation of stripping GC bit
Modified: branches/r5rs/sigscheme/sigschemetype-compact.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype-compact.h 2005-12-06 15:31:14 UTC (rev 2395)
+++ branches/r5rs/sigscheme/sigschemetype-compact.h 2005-12-06 16:22:54 UTC (rev 2396)
@@ -700,14 +700,21 @@
#define SCM_EOFP(a) (SCM_TAG_IMM_EOFP(a))
/*============================================================================
- GC Marking & Unmarking
+ GC Related Macros
============================================================================*/
#define SCM_DO_MARK(a) (SCM_SET_DIRECT_CAR((a), (SCM_CAST_CAR_UINT(a) & ~0x1)))
#define SCM_DO_UNMARK(a) (SCM_SET_DIRECT_CAR((a), (SCM_CAST_CAR_UINT(a) | 0x1)))
#define SCM_IS_MARKED(a) ((SCM_CAST_CAR_UINT(a) & SCM_GCBIT_MASK) == 0x0)
-#define SCM_IS_UNMARKED(a) (!SCM_IS_MARKED(obj))
+#define SCM_IS_UNMARKED(a) (!SCM_IS_MARKED(a))
+/* FIXME: currently, NULL value is sometimes passed to this macro.
+ * The invalid objects are always on the c stack, so we missed something.
+ * To reject it, we check the value of (a) temporally, but need to investigate
+ * the further reason of this problem. */
+#define SCM_CANBE_MARKED(a) ((a) && !SCM_TAG_IMMP(a))
+#define SCM_STRIP_TAG_INFO(a) (SCM_CAST_UINT(a) & SCM_VALUE_MASK)
+
/*============================================================================
Predefined Symbols
============================================================================*/
Modified: branches/r5rs/sigscheme/storage-gc.c
===================================================================
--- branches/r5rs/sigscheme/storage-gc.c 2005-12-06 15:31:14 UTC (rev 2395)
+++ branches/r5rs/sigscheme/storage-gc.c 2005-12-06 16:22:54 UTC (rev 2396)
@@ -361,7 +361,7 @@
* representation
*/
/* no need to mark immediates */
- if (INTP(obj) || CHARP(obj) || SCM_CONSTANTP(obj))
+ if (!SCM_CANBE_MARKED(obj))
return;
#else
/* no need to mark constants */
@@ -435,11 +435,11 @@
int i;
#if SCM_OBJ_COMPACT
- /* FIXME: reject immediate objects here for efficiency */
- /* FIXME: hide internal representation by a GC bit stripping macro */
/* The pointer on the stack is 'tagged' to represent its types.
* So we need to ignore the tag to get its real pointer value. */
- ptr = (ScmCell *)(((unsigned int)(obj)) & SCM_VALUE_MASK);
+ ptr = (ScmCell *)SCM_STRIP_TAG_INFO(obj);
+ if (!SCM_CANBE_MARKED(ptr))
+ return 0;
#else
ptr = obj;
#endif
More information about the uim-commit
mailing list