Mercurial > hg > xemacs-beta
comparison src/symbols.c @ 3263:d674024a8674
[xemacs-hg @ 2006-02-27 16:29:00 by crestani]
- Introduce a fancy asynchronous finalization strategy on C level.
- Merge the code conditioned on MC_ALLOC into the code conditioned on
NEW_GC.
- Remove the possibility to free objects manually outside garbage
collections when the new collector is enabled.
author | crestani |
---|---|
date | Mon, 27 Feb 2006 16:29:29 +0000 |
parents | b7f26b2f78bd |
children | 959746c534f6 |
comparison
equal
deleted
inserted
replaced
3262:79d41cfd8e6b | 3263:d674024a8674 |
---|---|
3250 #endif | 3250 #endif |
3251 #ifndef Qnull_pointer | 3251 #ifndef Qnull_pointer |
3252 Lisp_Object Qnull_pointer; | 3252 Lisp_Object Qnull_pointer; |
3253 #endif | 3253 #endif |
3254 | 3254 |
3255 #ifndef MC_ALLOC | 3255 #ifndef NEW_GC |
3256 /* some losing systems can't have static vars at function scope... */ | 3256 /* some losing systems can't have static vars at function scope... */ |
3257 static const struct symbol_value_magic guts_of_unbound_marker = | 3257 static const struct symbol_value_magic guts_of_unbound_marker = |
3258 { /* struct symbol_value_magic */ | 3258 { /* struct symbol_value_magic */ |
3259 { /* struct old_lcrecord_header */ | 3259 { /* struct old_lcrecord_header */ |
3260 { /* struct lrecord_header */ | 3260 { /* struct lrecord_header */ |
3268 0, /* free */ | 3268 0, /* free */ |
3269 }, | 3269 }, |
3270 0, /* value */ | 3270 0, /* value */ |
3271 SYMVAL_UNBOUND_MARKER | 3271 SYMVAL_UNBOUND_MARKER |
3272 }; | 3272 }; |
3273 #endif /* not MC_ALLOC */ | 3273 #endif /* not NEW_GC */ |
3274 | 3274 |
3275 void | 3275 void |
3276 init_symbols_once_early (void) | 3276 init_symbols_once_early (void) |
3277 { | 3277 { |
3278 INIT_LRECORD_IMPLEMENTATION (symbol); | 3278 INIT_LRECORD_IMPLEMENTATION (symbol); |
3300 } | 3300 } |
3301 | 3301 |
3302 { | 3302 { |
3303 /* Required to get around a GCC syntax error on certain | 3303 /* Required to get around a GCC syntax error on certain |
3304 architectures */ | 3304 architectures */ |
3305 #ifdef MC_ALLOC | 3305 #ifdef NEW_GC |
3306 struct symbol_value_magic *tem = (struct symbol_value_magic *) | 3306 struct symbol_value_magic *tem = (struct symbol_value_magic *) |
3307 mc_alloc (sizeof (struct symbol_value_magic)); | 3307 mc_alloc (sizeof (struct symbol_value_magic)); |
3308 MARK_LRECORD_AS_LISP_READONLY (tem); | 3308 MARK_LRECORD_AS_LISP_READONLY (tem); |
3309 MARK_LRECORD_AS_NOT_FREE (tem); | 3309 MARK_LRECORD_AS_NOT_FREE (tem); |
3310 tem->header.type = lrecord_type_symbol_value_forward; | 3310 tem->header.type = lrecord_type_symbol_value_forward; |
3313 tem->type = SYMVAL_UNBOUND_MARKER; | 3313 tem->type = SYMVAL_UNBOUND_MARKER; |
3314 #ifdef ALLOC_TYPE_STATS | 3314 #ifdef ALLOC_TYPE_STATS |
3315 inc_lrecord_stats (sizeof (struct symbol_value_magic), | 3315 inc_lrecord_stats (sizeof (struct symbol_value_magic), |
3316 (const struct lrecord_header *) tem); | 3316 (const struct lrecord_header *) tem); |
3317 #endif /* ALLOC_TYPE_STATS */ | 3317 #endif /* ALLOC_TYPE_STATS */ |
3318 #else /* not MC_ALLOC */ | 3318 #else /* not NEW_GC */ |
3319 const struct symbol_value_magic *tem = &guts_of_unbound_marker; | 3319 const struct symbol_value_magic *tem = &guts_of_unbound_marker; |
3320 #endif /* not MC_ALLOC */ | 3320 #endif /* not NEW_GC */ |
3321 | 3321 |
3322 Qunbound = wrap_symbol_value_magic (tem); | 3322 Qunbound = wrap_symbol_value_magic (tem); |
3323 } | 3323 } |
3324 | 3324 |
3325 XSYMBOL (Qnil)->function = Qunbound; | 3325 XSYMBOL (Qnil)->function = Qunbound; |
3452 #else | 3452 #else |
3453 #define check_sane_subr(subr, sym) /* nothing */ | 3453 #define check_sane_subr(subr, sym) /* nothing */ |
3454 #endif | 3454 #endif |
3455 | 3455 |
3456 #ifdef HAVE_SHLIB | 3456 #ifdef HAVE_SHLIB |
3457 #ifndef MC_ALLOC | 3457 #ifndef NEW_GC |
3458 /* | 3458 /* |
3459 * If we are not in a pure undumped Emacs, we need to make a duplicate of | 3459 * If we are not in a pure undumped Emacs, we need to make a duplicate of |
3460 * the subr. This is because the only time this function will be called | 3460 * the subr. This is because the only time this function will be called |
3461 * in a running Emacs is when a dynamically loaded module is adding a | 3461 * in a running Emacs is when a dynamically loaded module is adding a |
3462 * subr, and we need to make sure that the subr is in allocated, Lisp- | 3462 * subr, and we need to make sure that the subr is in allocated, Lisp- |
3512 memcpy (newsubr, subr, sizeof (Lisp_Subr)); \ | 3512 memcpy (newsubr, subr, sizeof (Lisp_Subr)); \ |
3513 subr->doc = (const char *)newsubr; \ | 3513 subr->doc = (const char *)newsubr; \ |
3514 subr = newsubr; \ | 3514 subr = newsubr; \ |
3515 } \ | 3515 } \ |
3516 } while (0) | 3516 } while (0) |
3517 #else /* MC_ALLOC */ | 3517 #else /* NEW_GC */ |
3518 /* | 3518 /* |
3519 * If we have the new allocator enabled, we do not need to make a | 3519 * If we have the new allocator enabled, we do not need to make a |
3520 * duplicate of the subr. The new allocator already does allocate all | 3520 * duplicate of the subr. The new allocator already does allocate all |
3521 * subrs in Lisp-accessible memory rather than have it in the static | 3521 * subrs in Lisp-accessible memory rather than have it in the static |
3522 * subr struct. | 3522 * subr struct. |
3550 f = XSYMBOL (sym)->function; \ | 3550 f = XSYMBOL (sym)->function; \ |
3551 if (!UNBOUNDP (f) && (!CONSP (f) || !EQ (XCAR (f), Qautoload))) \ | 3551 if (!UNBOUNDP (f) && (!CONSP (f) || !EQ (XCAR (f), Qautoload))) \ |
3552 signal_ferror (Qdll_error, "Attempt to redefine %s", subr_name (subr)); \ | 3552 signal_ferror (Qdll_error, "Attempt to redefine %s", subr_name (subr)); \ |
3553 } \ | 3553 } \ |
3554 } while (0) | 3554 } while (0) |
3555 #endif /* MC_ALLOC */ | 3555 #endif /* NEW_GC */ |
3556 #else /* ! HAVE_SHLIB */ | 3556 #else /* ! HAVE_SHLIB */ |
3557 #define check_module_subr(subr) | 3557 #define check_module_subr(subr) |
3558 #endif | 3558 #endif |
3559 | 3559 |
3560 void | 3560 void |