Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
mallocx.c File Reference
#include <stdio.h>
#include "gc_priv.h"

Go to the source code of this file.

Functions

ptr_t GC_clear_stack ()
void GC_extend_size_map ()
GC_bool GC_alloc_reclaim_list ()
ptr_t GC_generic_malloc_inner_ignore_off_page (size_t lb, int k)
ptr_t GC_generic_malloc_ignore_off_page (size_t lb, int k)
char * GC_malloc_ignore_off_page (size_t lb)
char * GC_malloc_atomic_ignore_off_page (size_t lb)
ptr_t GC_generic_malloc_words_small (word lw, int k)
GC_PTR GC_malloc_uncollectable (size_t lb)

Variables

ptr_t *CONST GC_objfreelist_ptr = GC_objfreelist
ptr_t *CONST GC_aobjfreelist_ptr = GC_aobjfreelist
ptr_t *CONST GC_uobjfreelist_ptr = GC_uobjfreelist

Function Documentation

Definition at line 72 of file mallocx.c.

{
    register ptr_t result;
    DCL_LOCK_STATE;
    
    GC_INVOKE_FINALIZERS();
    DISABLE_SIGNALS();
    LOCK();
    result = GC_generic_malloc_inner_ignore_off_page(lb,k);
    UNLOCK();
    ENABLE_SIGNALS();
    if (0 == result) {
        return((*GC_oom_fn)(lb));
    } else {
        return(result);
    }
}

Here is the call graph for this function:

Definition at line 43 of file mallocx.c.

{
    register struct hblk * h;
    register word n_blocks;
    register word lw;
    register ptr_t op;

    if (lb <= HBLKSIZE)
        return(GC_generic_malloc_inner((word)lb, k));
    n_blocks = divHBLKSZ(ADD_SLOP(lb) + HDR_BYTES + HBLKSIZE-1);
    if (!GC_is_initialized) GC_init_inner();
    /* Do our share of marking work */
    if(GC_incremental && !GC_dont_gc)
        GC_collect_a_little_inner((int)n_blocks);
    lw = ROUNDED_UP_WORDS(lb);
    while ((h = GC_allochblk(lw, k, IGNORE_OFF_PAGE)) == 0
           && GC_collect_or_expand(n_blocks, TRUE));
    if (h == 0) {
        op = 0;
    } else {
        op = (ptr_t) (h -> hb_body);
        GC_words_wasted += BYTES_TO_WORDS(n_blocks * HBLKSIZE) - lw;
    }
    GC_words_allocd += lw;
    return((ptr_t)op);
}

Here is the call graph for this function:

Definition at line 132 of file mallocx.c.

{
register ptr_t op;
register ptr_t *opp;
register struct obj_kind * kind = GC_obj_kinds + k;
DCL_LOCK_STATE;

    GC_INVOKE_FINALIZERS();
    DISABLE_SIGNALS();
    LOCK();
    opp = &(kind -> ok_freelist[lw]);
    if( (op = *opp) == 0 ) {
        if (!GC_is_initialized) {
            GC_init_inner();
        }
       if (kind -> ok_reclaim_list != 0 || GC_alloc_reclaim_list(kind)) {
           op = GC_clear_stack(GC_allocobj((word)lw, k));
       }
       if (op == 0) {
           UNLOCK();
           ENABLE_SIGNALS();
           return ((*GC_oom_fn)(WORDS_TO_BYTES(lw)));
       }
    }
    *opp = obj_link(op);
    obj_link(op) = 0;
    GC_words_allocd += lw;
    UNLOCK();
    ENABLE_SIGNALS();
    return((ptr_t)op);
}

Here is the call graph for this function:

char* GC_malloc_atomic_ignore_off_page ( size_t  lb)

Definition at line 105 of file mallocx.c.

Here is the call graph for this function:

Here is the caller graph for this function:

char* GC_malloc_ignore_off_page ( size_t  lb)

Definition at line 95 of file mallocx.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 244 of file mallocx.c.

{
register ptr_t op;
register ptr_t *opp;
register word lw;
DCL_LOCK_STATE;

    if( SMALL_OBJ(lb) ) {
#       ifdef MERGE_SIZES
#        ifdef ADD_BYTE_AT_END
           if (lb != 0) lb--;
                /* We don't need the extra byte, since this won't be  */
                /* collected anyway.                                  */
#        endif
         lw = GC_size_map[lb];
#      else
         lw = ALIGNED_WORDS(lb);
#       endif
       opp = &(GC_uobjfreelist[lw]);
       FASTLOCK();
        if( FASTLOCK_SUCCEEDED() && (op = *opp) != 0 ) {
            /* See above comment on signals.     */
            *opp = obj_link(op);
            obj_link(op) = 0;
            GC_words_allocd += lw;
            /* Mark bit ws already set on free list.  It will be      */
           /* cleared only temporarily during a collection, as a      */
           /* result of the normal free list mark bit clearing.       */
            GC_non_gc_bytes += WORDS_TO_BYTES(lw);
            FASTUNLOCK();
            return((GC_PTR) op);
        }
        FASTUNLOCK();
        op = (ptr_t)GC_generic_malloc((word)lb, UNCOLLECTABLE);
    } else {
       op = (ptr_t)GC_generic_malloc((word)lb, UNCOLLECTABLE);
    }
    if (0 == op) return(0);
    /* We don't need the lock here, since we have an undisguised      */
    /* pointer.  We do need to hold the lock while we adjust          */
    /* mark bits.                                              */
    {
       register struct hblk * h;
       
       h = HBLKPTR(op);
       lw = HDR(h) -> hb_sz;
       
       DISABLE_SIGNALS();
       LOCK();
       GC_set_mark_bit(op);
       GC_non_gc_bytes += WORDS_TO_BYTES(lw);
       UNLOCK();
       ENABLE_SIGNALS();
       return((GC_PTR) op);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 34 of file mallocx.c.

Definition at line 33 of file mallocx.c.

Definition at line 35 of file mallocx.c.