comparison src/elhash.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 141c2920ea48
children aa28d959af41
comparison
equal deleted inserted replaced
3262:79d41cfd8e6b 3263:d674024a8674
415 #else 415 #else
416 htentry *hentries, 416 htentry *hentries,
417 #endif 417 #endif
418 #ifdef ERROR_CHECK_STRUCTURES 418 #ifdef ERROR_CHECK_STRUCTURES
419 size_t size 419 size_t size
420 #else 420 #else /* not (NEW_GC && ! ERROR_CHECK_STRUCTURES) */
421 size_t UNUSED (size) 421 size_t UNUSED (size)
422 #endif 422 #endif /* not (NEW_GC && ! ERROR_CHECK_STRUCTURES) */
423 ) 423 )
424 { 424 {
425 #ifdef NEW_GC 425 #ifdef NEW_GC
426 #ifdef ERROR_CHECK_STRUCTURES 426 #ifdef ERROR_CHECK_STRUCTURES
427 htentry *e, *sentinel; 427 htentry *e, *sentinel;
441 if (!DUMPEDP (hentries)) 441 if (!DUMPEDP (hentries))
442 xfree (hentries, htentry *); 442 xfree (hentries, htentry *);
443 #endif /* not NEW_GC */ 443 #endif /* not NEW_GC */
444 } 444 }
445 445
446 #ifndef NEW_GC
446 static void 447 static void
447 finalize_hash_table (void *header, int for_disksave) 448 finalize_hash_table (void *header, int for_disksave)
448 { 449 {
449 if (!for_disksave) 450 if (!for_disksave)
450 { 451 {
451 Lisp_Hash_Table *ht = (Lisp_Hash_Table *) header; 452 Lisp_Hash_Table *ht = (Lisp_Hash_Table *) header;
452 free_hentries (ht->hentries, ht->size); 453 free_hentries (ht->hentries, ht->size);
453 ht->hentries = 0; 454 ht->hentries = 0;
454 } 455 }
455 } 456 }
457 #endif /* not NEW_GC */
456 458
457 static const struct memory_description htentry_description_1[] = { 459 static const struct memory_description htentry_description_1[] = {
458 { XD_LISP_OBJECT, offsetof (htentry, key) }, 460 { XD_LISP_OBJECT, offsetof (htentry, key) },
459 { XD_LISP_OBJECT, offsetof (htentry, value) }, 461 { XD_LISP_OBJECT, offsetof (htentry, value) },
460 { XD_END } 462 { XD_END }
513 { &htentry_union_description } }, 515 { &htentry_union_description } },
514 { XD_LO_LINK, offsetof (Lisp_Hash_Table, next_weak) }, 516 { XD_LO_LINK, offsetof (Lisp_Hash_Table, next_weak) },
515 { XD_END } 517 { XD_END }
516 }; 518 };
517 519
520 #ifdef NEW_GC
521 DEFINE_LRECORD_IMPLEMENTATION ("hash-table", hash_table,
522 1, /*dumpable-flag*/
523 mark_hash_table, print_hash_table,
524 0, hash_table_equal, hash_table_hash,
525 hash_table_description,
526 Lisp_Hash_Table);
527 #else /* not NEW_GC */
518 DEFINE_LRECORD_IMPLEMENTATION ("hash-table", hash_table, 528 DEFINE_LRECORD_IMPLEMENTATION ("hash-table", hash_table,
519 1, /*dumpable-flag*/ 529 1, /*dumpable-flag*/
520 mark_hash_table, print_hash_table, 530 mark_hash_table, print_hash_table,
521 finalize_hash_table, 531 finalize_hash_table,
522 hash_table_equal, hash_table_hash, 532 hash_table_equal, hash_table_hash,
523 hash_table_description, 533 hash_table_description,
524 Lisp_Hash_Table); 534 Lisp_Hash_Table);
535 #endif /* not NEW_GC */
525 536
526 static Lisp_Hash_Table * 537 static Lisp_Hash_Table *
527 xhash_table (Lisp_Object hash_table) 538 xhash_table (Lisp_Object hash_table)
528 { 539 {
529 /* #### What's going on here? Why the gc_in_progress check? */ 540 /* #### What's going on here? Why the gc_in_progress check? */