[BACK]Return to gc_nursery.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gc / include

Annotation of OpenXM_contrib/gc/include/gc_nursery.h, Revision 1.1

1.1     ! maekawa     1:
        !             2: /*
        !             3:  * Copyright (c) 1999 by Silicon Graphics.  All rights reserved.
        !             4:  *
        !             5:  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
        !             6:  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
        !             7:  *
        !             8:  * Permission is hereby granted to use or copy this program
        !             9:  * for any purpose,  provided the above notices are retained on all copies.
        !            10:  * Permission to modify the code and to distribute modified code is granted,
        !            11:  * provided the above notices are retained, and a notice that the code was
        !            12:  * modified is included with the above copyright notice.
        !            13:  */
        !            14:
        !            15: /*
        !            16:  * THIS IMPLEMENTATION FOR THIS INTERFACE IS INCOMPLETE.
        !            17:  * NONE OF THIS HAS BEEN TESTED.  DO NOT USE.
        !            18:  *
        !            19:  * Comments on the interface are appreciated, especially from
        !            20:  * potential users of the interface.
        !            21:  *
        !            22:  * This is a Bartlett style copying collector for young objects.
        !            23:  * We assume for now that all objects allocated through this
        !            24:  * mechanism have pointers only in the first BITMAP_BITS words.
        !            25:  * (On a 32-bit machine, BITMAP_BITS is 30.)
        !            26:  * Objects allocated in this manner should be rarely referenced
        !            27:  * by objects not allocated either through this interface, or through
        !            28:  * the typed allocation interface.
        !            29:  * If this interface is used, we assume that type information provided
        !            30:  * through either this or the typed allocation interface is valid
        !            31:  * in a stronger sense:
        !            32:  *
        !            33:  * 1) No pointers are stored in fields not marked as such.
        !            34:  *    (Otherwise it is only necessary that objects referenced by
        !            35:  *    fields marked as nonpointers are also reachable via another
        !            36:  *    path.)
        !            37:  * 2) Values stored in pointer fields are either not addresses in
        !            38:  *    the heap, or they really are pointers.  In the latter case, it
        !            39:  *    is acceptable to move the object they refer to, and to update
        !            40:  *    the pointer.
        !            41:  *
        !            42:  * GC_free may not be invoked on objects allocated with GC_copying_malloc.
        !            43:  *
        !            44:  * No extra space is added to the end of objects allocated through this
        !            45:  * interface.  If the client needs to maintain pointers past the
        !            46:  * end, the size should be explicitly padded.
        !            47:  *
        !            48:  * We assume that calls to this will usually be compiler generated.
        !            49:  * Hence the interface is allowed to be a bit ugly in return for speed.
        !            50:  */
        !            51:
        !            52: #include "gc_copy_descr.h"
        !            53:
        !            54: /* GC_copy_descr.h must define                                         */
        !            55: /* GC_SIZE_FROM_DESCRIPTOR(descr) and                                  */
        !            56: /* GC_BIT_MAP_FROM_DESCRIPTOR(descr).                                  */
        !            57: /* It may either be the GC supplied version of the header file, or a   */
        !            58: /* client specific one that derives the information from a client-     */
        !            59: /* specific type descriptor.                                           */
        !            60:
        !            61: typedef GC_PTR GC_copy_alloc_state;
        !            62:                                /* Current allocator state.     */
        !            63:                                /* Multiple allocation states   */
        !            64:                                /* may be used for concurrent   */
        !            65:                                /* allocation, or to enhance    */
        !            66:                                /* locality.                    */
        !            67:                                /* Should be treated as opaque. */
        !            68:
        !            69: /* Allocate a memory block of size given in the descriptor, and with   */
        !            70: /* pointer layout given by the descriptor.  The resulting block may not        */
        !            71: /* be cleared, and should immediately be initialized by the client.    */
        !            72: /* (A concurrent GC may see an uninitialized pointer field.  If it     */
        !            73: /* points outside the nursery, that's fine.  If it points inside, it   */
        !            74: /* may retain an object, and be relocated.  But that's also fine, since        */
        !            75: /* the new value will be immediately overwritten.                      */
        !            76: /* This variant acquires the allocation lock, and uses a default       */
        !            77: /* global allocation state.                                            */
        !            78: GC_PTR GC_copying_malloc(GC_copy_descriptor);
        !            79:
        !            80: /* A variant of the above that does no locking on the fast path,       */
        !            81: /* and passes an explicit pointer to an allocation state.              */
        !            82: /* The allocation state is updated.                                    */
        !            83: /* There will eventually need to be a macro or inline function version */
        !            84: /* of this.                                                            */
        !            85: GC_PTR GC_copying_malloc2(GC_copy_descriptor, GC_copy_alloc_state *);
        !            86:
        !            87: /* Initialize an allocation state so that it can be used for   */
        !            88: /* allocation.  This implicitly reserves a small section of the        */
        !            89: /* nursery for use with this allocator.                                */
        !            90: void GC_init_copy_alloc_state(GC_copy_alloc_state *);

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>