[BACK]Return to dbg_mlc.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / gc / include / private

Annotation of OpenXM_contrib2/asir2000/gc/include/private/dbg_mlc.h, Revision 1.1

1.1     ! noro        1: /*
        !             2:  * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
        !             3:  * Copyright (c) 1991-1995 by Xerox Corporation.  All rights reserved.
        !             4:  * Copyright (c) 1997 by Silicon Graphics.  All rights reserved.
        !             5:  * Copyright (c) 1999 by Hewlett-Packard Company.  All rights reserved.
        !             6:  *
        !             7:  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
        !             8:  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
        !             9:  *
        !            10:  * Permission is hereby granted to use or copy this program
        !            11:  * for any purpose,  provided the above notices are retained on all copies.
        !            12:  * Permission to modify the code and to distribute modified code is granted,
        !            13:  * provided the above notices are retained, and a notice that the code was
        !            14:  * modified is included with the above copyright notice.
        !            15:  */
        !            16:
        !            17: /*
        !            18:  * This is mostly an internal header file.  Typical clients should
        !            19:  * not use it.  Clients that define their own object kinds with
        !            20:  * debugging allocators will probably want to include this, however.
        !            21:  * No attempt is made to keep the namespace clean.  This should not be
        !            22:  * included from header filrd that are frequently included by clients.
        !            23:  */
        !            24:
        !            25: #ifndef _DBG_MLC_H
        !            26:
        !            27: #define _DBG_MLC_H
        !            28:
        !            29: # define I_HIDE_POINTERS
        !            30: # include "gc_priv.h"
        !            31: # ifdef KEEP_BACK_PTRS
        !            32: #   include "gc_backptr.h"
        !            33: # endif
        !            34:
        !            35: # define START_FLAG ((word)0xfedcedcb)
        !            36: # define END_FLAG ((word)0xbcdecdef)
        !            37:        /* Stored both one past the end of user object, and one before  */
        !            38:        /* the end of the object as seen by the allocator.              */
        !            39:
        !            40:
        !            41: /* Object header */
        !            42: typedef struct {
        !            43: #   ifdef KEEP_BACK_PTRS
        !            44:        GC_hidden_pointer oh_back_ptr;
        !            45:            /* We make sure that we only store even valued      */
        !            46:            /* pointers here, so that the hidden version has    */
        !            47:            /* the least significant bit set.  We never         */
        !            48:            /* overwrite a value with the least significant     */
        !            49:            /* bit clear, thus ensuring that we never overwrite */
        !            50:            /* a free list link field.                          */
        !            51:            /* The following are special back pointer values.   */
        !            52:            /* Note that the "hidden" (i.e. bitwise             */
        !            53:            /* complemented version) of these is actually       */
        !            54:            /* stored.                                          */
        !            55: #      define NOT_MARKED (ptr_t)(0)
        !            56: #      define MARKED_FOR_FINALIZATION (ptr_t)(2)
        !            57:            /* Object was marked because it is finalizable.     */
        !            58: #      define MARKED_FROM_REGISTER (ptr_t)(4)
        !            59:            /* Object was marked from a rgister.  Hence the     */
        !            60:            /* source of the reference doesn't have an address. */
        !            61: #       if ALIGNMENT == 1
        !            62:          /* Fudge back pointer to be even.  */
        !            63: #        define HIDE_BACK_PTR(p) HIDE_POINTER(~1 & (GC_word)(p))
        !            64: #      else
        !            65: #        define HIDE_BACK_PTR(p) HIDE_POINTER(p)
        !            66: #      endif
        !            67: #      ifdef ALIGN_DOUBLE
        !            68:          word oh_dummy;
        !            69: #      endif
        !            70: #   endif
        !            71:     char * oh_string;          /* object descriptor string     */
        !            72:     word oh_int;               /* object descriptor integers   */
        !            73: #   ifdef NEED_CALLINFO
        !            74:       struct callinfo oh_ci[NFRAMES];
        !            75: #   endif
        !            76: #   ifndef SHORT_DBG_HDRS
        !            77:       word oh_sz;                      /* Original malloc arg.         */
        !            78:       word oh_sf;                      /* start flag */
        !            79: #   endif /* SHORT_DBG_HDRS */
        !            80: } oh;
        !            81: /* The size of the above structure is assumed not to dealign things,   */
        !            82: /* and to be a multiple of the word length.                            */
        !            83:
        !            84: #define DEBUG_BYTES (sizeof (oh) + sizeof (word))
        !            85: #define USR_PTR_FROM_BASE(p) ((ptr_t)(p) + sizeof(oh))
        !            86:
        !            87: /* There is no reason to ever add a byte at the end explicitly, since we */
        !            88: /* already add a guard word.                                            */
        !            89: #undef ROUNDED_UP_WORDS
        !            90: #define ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1) - 1)
        !            91:
        !            92: #ifdef SAVE_CALL_CHAIN
        !            93: #   define ADD_CALL_CHAIN(base, ra) GC_save_callers(((oh *)(base)) -> oh_ci)
        !            94: #   define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci)
        !            95: #else
        !            96: # ifdef GC_ADD_CALLER
        !            97: #   define ADD_CALL_CHAIN(base, ra) ((oh *)(base)) -> oh_ci[0].ci_pc = (ra)
        !            98: #   define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci)
        !            99: # else
        !           100: #   define ADD_CALL_CHAIN(base, ra)
        !           101: #   define PRINT_CALL_CHAIN(base)
        !           102: # endif
        !           103: #endif
        !           104:
        !           105: # ifdef GC_ADD_CALLER
        !           106: #   define OPT_RA ra,
        !           107: # else
        !           108: #   define OPT_RA
        !           109: # endif
        !           110:
        !           111:
        !           112: /* Check whether object with base pointer p has debugging info */
        !           113: /* p is assumed to point to a legitimate object in our part    */
        !           114: /* of the heap.                                                        */
        !           115: #ifdef SHORT_DBG_HDRS
        !           116: # define GC_has_other_debug_info(p) TRUE
        !           117: #else
        !           118:   GC_bool GC_has_other_debug_info(/* p */);
        !           119: #endif
        !           120:
        !           121: #ifdef KEEP_BACK_PTRS
        !           122: # define GC_HAS_DEBUG_INFO(p) \
        !           123:        ((((oh *)p)->oh_back_ptr & 1) && GC_has_other_debug_info(p))
        !           124: #else
        !           125: # define GC_HAS_DEBUG_INFO(p) GC_has_other_debug_info(p)
        !           126: #endif
        !           127:
        !           128: /* Store debugging info into p.  Return displaced pointer. */
        !           129: /* Assumes we don't hold allocation lock.                 */
        !           130: ptr_t GC_store_debug_info(/* p, sz, string, integer */);
        !           131:
        !           132: #endif /* _DBG_MLC_H */

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