Ignore:
Timestamp:
Feb 1, 2009, 12:36:00 PM (11 years ago)
Author:
gb
Message:

Add a mechanism that allows user-defined functions to be used to free
GCable pointers.

Move the xmacptr_flag* constants form architecure-specific headers to
gc.h (they were all identical.) Define xmacptr_flag_user_first and
xmacptr_flag_user_last, so that some xmacptr flags denote user-specified
"dispose" functions.

Define 'register_xmacptr_dispose_function' and add it to imports.s.
This function provides a very simple way to associate a foreign function
with a dynamically-allocated user-defined xmacptr_flag value.

If we discover an umarked xmacptr whose flags denote a user-defined
dispose function, enqueue the macptr for later (postGC) disposal. (We
can't necessarily call the dispose function in the middle of the GC,
since other suspended threads may own locks.) Since we aren't really
sure what fields in the foreign pointer could be used to link pointers
together, we basically have to mark the (otherwise unreachable)
xmacptr object and link it onto a new list via its "class" cell and
arrange for forward_gcable_ptrs() to update this linked list. (The
xmacptr is unreachable and will be GCed next time.)

Make freeGCptrs handle post-GC freeing pf xmacptrs with user-defined
dispose functions.

Note that the order in which user-defined dispose functions are
registered must be consistent (e.g., a saved image must register
the same set of dispose functions in the same order as were registered
before the image was saved.)

All of this fuss is to allow for things like GCable handles.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/ppc-constants64.h

    r10969 r11675  
    360360#define lfbits_noname_mask fixnum_bitmask(29)
    361361
    362 /*
    363   known values of an "extended" (gcable) macptr's flags word:
    364 */
    365 
    366 typedef enum {
    367   xmacptr_flag_none = 0,        /* Maybe already disposed by Lisp */
    368   xmacptr_flag_recursive_lock,  /* recursive-lock */
    369   xmacptr_flag_ptr,             /* malloc/free */
    370   xmacptr_flag_rwlock,          /* read/write lock */
    371   xmacptr_flag_semaphore        /* semaphore */
    372 } xmacptr_flag;
    373362
    374363/* Creole */
Note: See TracChangeset for help on using the changeset viewer.