comparison src/lisp.h @ 888:201c016cfc12

[xemacs-hg @ 2002-06-28 14:24:07 by michaels] 2002-06-27 Mike Sperber <mike@xemacs.org> * data.c (prune_weak_boxes): Rewrite for better readability. 2002-06-23 Martin Köbele <martin@mkoebele.de> Jens Müller <jmueller@informatik.uni-tuebingen.de> Mike Sperber <mike@xemacs.org> * lrecord.h (lrecord_type): add lrecord_type_ephemeron to lrecord_type enumeration. * lisp.h (XEPHEMERON): (XEPHEMERON_REF): (XEPHEMERON_NEXT): (XEPHEMERON_FINALIZER): (XSET_EPHEMERON_NEXT): (XSET_EPHEMERON_VALUE): (XSET_EPHEMERON_KEY): (wrap_ephemeron): (EPHEMERONP): (CHECK_EPHEMERON): (CONCHECK_EPHEMERON): (struct ephemeron): Add representation of ephemerons. * alloc.c (garbage_collect_1): (finish_marking_ephemerons): (prune_ephemerons): Call. * data.c: (finish_marking_ephemerons): (prune_ephemerons): (mark_ephemeron): (print_ephemeron): (ephemeron_equal) (ephemeron_hash):: (make_ephemeron): (Fmake_ephemeron): (Fephemeronp): (Fephemeron_ref): (syms_of_data): (vars_of_data): Add implementation of ephemerons
author michaels
date Fri, 28 Jun 2002 14:24:08 +0000
parents 79c6ff3eef26
children 111c4f2ed9c9
comparison
equal deleted inserted replaced
887:ccc3177ef10b 888:201c016cfc12
2569 #define wrap_weak_box(p) wrap_record (p, weak_box) 2569 #define wrap_weak_box(p) wrap_record (p, weak_box)
2570 #define WEAK_BOXP(x) RECORDP (x, weak_box) 2570 #define WEAK_BOXP(x) RECORDP (x, weak_box)
2571 #define CHECK_WEAK_BOX(x) CHECK_RECORD (x, weak_box) 2571 #define CHECK_WEAK_BOX(x) CHECK_RECORD (x, weak_box)
2572 #define CONCHECK_WEAK_BOX(x) CONCHECK_RECORD (x, weak_box) 2572 #define CONCHECK_WEAK_BOX(x) CONCHECK_RECORD (x, weak_box)
2573 2573
2574 /*--------------------------- ephemerons ----------------------------*/
2575
2576 struct ephemeron
2577 {
2578 struct lcrecord_header header;
2579
2580 Lisp_Object key;
2581
2582 /* This field holds a pair. The cdr of this cons points to the next
2583 ephemeron in Vall_ephemerons. The car points to another pair
2584 whose car is the value and whose cdr is the finalizer.
2585
2586 This representation makes it very easy to unlink an ephemeron
2587 from Vall_ephemerons and chain it into
2588 Vall_ephemerons_to_finalize. */
2589
2590 Lisp_Object cons_chain;
2591
2592 Lisp_Object value;
2593 };
2594
2595 void prune_ephemerons (void);
2596 Lisp_Object ephemeron_value(Lisp_Object ephi);
2597 int finish_marking_ephemerons(void);
2598 Lisp_Object zap_finalize_list(void);
2599 Lisp_Object make_ephemeron(Lisp_Object key, Lisp_Object value, Lisp_Object finalizer);
2600
2601 DECLARE_LRECORD(ephemeron, struct ephemeron);
2602 #define XEPHEMERON(x) XRECORD (x, ephemeron, struct ephemeron)
2603 #define XEPHEMERON_REF(x) (XEPHEMERON (x)->value)
2604 #define XEPHEMERON_NEXT(x) (XCDR (XEPHEMERON(x)->cons_chain))
2605 #define XEPHEMERON_FINALIZER(x) (XCDR (XCAR (XEPHEMERON (x)->cons_chain)))
2606 #define XSET_EPHEMERON_NEXT(x, n) (XSETCDR (XEPHEMERON(x)->cons_chain, n))
2607 #define XSET_EPHEMERON_VALUE(x, v) (XEPHEMERON(x)->value = (v))
2608 #define XSET_EPHEMERON_KEY(x, k) (XEPHEMERON(x)->key = (k))
2609 #define wrap_ephemeron(p) wrap_record (p, ephemeron)
2610 #define EPHEMERONP(x) RECORDP (x, ephemeron)
2611 #define CHECK_EPHEMERON(x) CHECK_RECORD (x, ephemeron)
2612 #define CONCHECK_EPHEMERON(x) CONCHECK_RECORD (x, ephemeron)
2613
2574 2614
2575 /*---------------------------- weak lists ------------------------------*/ 2615 /*---------------------------- weak lists ------------------------------*/
2576 2616
2577 enum weak_list_type 2617 enum weak_list_type
2578 { 2618 {
3366 void mark_object (Lisp_Object obj); 3406 void mark_object (Lisp_Object obj);
3367 int marked_p (Lisp_Object obj); 3407 int marked_p (Lisp_Object obj);
3368 extern int funcall_allocation_flag; 3408 extern int funcall_allocation_flag;
3369 extern int need_to_garbage_collect; 3409 extern int need_to_garbage_collect;
3370 extern int need_to_check_c_alloca; 3410 extern int need_to_check_c_alloca;
3411 extern int need_to_signal_post_gc;
3412 extern Lisp_Object Qpost_gc_hook;
3371 void recompute_funcall_allocation_flag (void); 3413 void recompute_funcall_allocation_flag (void);
3372 3414
3373 #ifdef MEMORY_USAGE_STATS 3415 #ifdef MEMORY_USAGE_STATS
3374 Bytecount malloced_storage_size (void *, Bytecount, struct overhead_stats *); 3416 Bytecount malloced_storage_size (void *, Bytecount, struct overhead_stats *);
3375 Bytecount fixed_type_block_overhead (Bytecount); 3417 Bytecount fixed_type_block_overhead (Bytecount);