Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
os_dep.c File Reference
#include "gc_priv.h"
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>

Go to the source code of this file.

Defines

#define OPT_PROT_EXEC   PROT_EXEC
#define SIGSET_T   sigset_t
#define SIG_DEL(set, signal)   sigdelset(&(set), (signal))
#define SIG_FILL(set)   sigfillset(&set)
#define SIGSETMASK(old, new)   sigprocmask(SIG_SETMASK, &(new), &(old))
#define CHECK_SIGNALS
#define STACKBOTTOM_ALIGNMENT_M1   ((word)STACK_GRAN - 1)
#define SBRK_ARG_T   int

Functions

void GC_disable_signals ()
void GC_enable_signals ()
void GC_setpagesize ()
ptr_t GC_get_stack_base ()
void GC_register_data_segments ()
ptr_t GC_unix_get_mem (word bytes)
void GC_dirty_init ()
void GC_read_dirty ()
GC_bool GC_page_was_dirty (struct hblk *h)
GC_bool GC_page_was_ever_dirty (struct hblk *h)
void GC_is_fresh (struct hblk *h, word n)
void GC_write_hint (struct hblk *h)

Variables

static GC_bool mask_initialized = FALSE
static SIGSET_T new_mask
static SIGSET_T old_mask
static SIGSET_T dummy
int GC_sig_disabled = 0
word GC_page_size
 OS/2.
void(* GC_push_other_roots )()=0
GC_bool GC_dirty_maintained = FALSE

Define Documentation

Definition at line 302 of file os_dep.c.

#define OPT_PROT_EXEC   PROT_EXEC

Definition at line 139 of file os_dep.c.

Definition at line 1009 of file os_dep.c.

#define SIG_DEL (   set,
  signal 
)    sigdelset(&(set), (signal))

Definition at line 288 of file os_dep.c.

#define SIG_FILL (   set)    sigfillset(&set)

Definition at line 289 of file os_dep.c.

Definition at line 287 of file os_dep.c.

#define SIGSETMASK (   old,
  new 
)    sigprocmask(SIG_SETMASK, &(new), &(old))

Definition at line 290 of file os_dep.c.


Function Documentation

Definition at line 1329 of file os_dep.c.

Here is the caller graph for this function:

Definition at line 306 of file os_dep.c.

{
    if (!mask_initialized) {
       SIG_FILL(new_mask);

       SIG_DEL(new_mask, SIGSEGV);
       SIG_DEL(new_mask, SIGILL);
       SIG_DEL(new_mask, SIGQUIT);
#      ifdef SIGBUS
           SIG_DEL(new_mask, SIGBUS);
#      endif
#      ifdef SIGIOT
           SIG_DEL(new_mask, SIGIOT);
#      endif
#      ifdef SIGEMT
           SIG_DEL(new_mask, SIGEMT);
#      endif
#      ifdef SIGTRAP
           SIG_DEL(new_mask, SIGTRAP);
#      endif 
       mask_initialized = TRUE;
    }
#   ifdef CHECK_SIGNALS
       if (GC_sig_disabled != 0) ABORT("Nested disables");
       GC_sig_disabled++;
#   endif
    SIGSETMASK(old_mask,new_mask);
}

Definition at line 335 of file os_dep.c.

{
#   ifdef CHECK_SIGNALS
       if (GC_sig_disabled != 1) ABORT("Unmatched enable");
       GC_sig_disabled--;
#   endif
    SIGSETMASK(dummy,old_mask);
}

Definition at line 586 of file os_dep.c.

{
    word dummy;
    ptr_t result;

#   define STACKBOTTOM_ALIGNMENT_M1 ((word)STACK_GRAN - 1)

#   ifdef STACKBOTTOM
       return(STACKBOTTOM);
#   else
#      ifdef HEURISTIC1
#         ifdef STACK_GROWS_DOWN
            result = (ptr_t)((((word)(&dummy))
                            + STACKBOTTOM_ALIGNMENT_M1)
                           & ~STACKBOTTOM_ALIGNMENT_M1);
#         else
            result = (ptr_t)(((word)(&dummy))
                           & ~STACKBOTTOM_ALIGNMENT_M1);
#         endif
#      endif /* HEURISTIC1 */
#      ifdef HEURISTIC2
#          ifdef STACK_GROWS_DOWN
              result = GC_find_limit((ptr_t)(&dummy), TRUE);
#             ifdef HEURISTIC2_LIMIT
                  if (result > HEURISTIC2_LIMIT
                      && (ptr_t)(&dummy) < HEURISTIC2_LIMIT) {
                          result = HEURISTIC2_LIMIT;
                  }
#              endif
#          else
              result = GC_find_limit((ptr_t)(&dummy), FALSE);
#             ifdef HEURISTIC2_LIMIT
                  if (result < HEURISTIC2_LIMIT
                      && (ptr_t)(&dummy) > HEURISTIC2_LIMIT) {
                          result = HEURISTIC2_LIMIT;
                  }
#              endif
#          endif

#      endif /* HEURISTIC2 */
#      ifdef STACK_GROWS_DOWN
           if (result == 0) result = (ptr_t)(signed_word)(-sizeof(ptr_t));
#      endif
       return(result);
#   endif /* STACKBOTTOM */
}

Here is the caller graph for this function:

void GC_is_fresh ( struct hblk h,
word  n 
)

Definition at line 1366 of file os_dep.c.

{
}
GC_bool GC_page_was_dirty ( struct hblk h)

Definition at line 1344 of file os_dep.c.

{
    return(TRUE);
}

Definition at line 1359 of file os_dep.c.

{
    return(TRUE);
}

Definition at line 1336 of file os_dep.c.

{}

Here is the caller graph for this function:

Definition at line 935 of file os_dep.c.

{
#   if !defined(PCR) && !defined(SRC_M3) && !defined(NEXT) && !defined(MACOS)
#     if defined(REDIRECT_MALLOC) && defined(SOLARIS_THREADS)
       /* As of Solaris 2.3, the Solaris threads implementation       */
       /* allocates the data structure for the initial thread with    */
       /* sbrk at process startup.  It needs to be scanned, so that   */
       /* we don't lose some malloc allocated data structures         */
       /* hanging from it.  We're on thin ice here ...                */
        extern caddr_t sbrk();

       GC_add_roots_inner(DATASTART, (char *)sbrk(0), FALSE);
#     else
       GC_add_roots_inner(DATASTART, (char *)(DATAEND), FALSE);
#     endif
#   endif
#   if !defined(PCR) && defined(NEXT)
      GC_add_roots_inner(DATASTART, (char *) get_end(), FALSE);
#   endif
#   if defined(MACOS)
    {
#   if defined(THINK_C)
       extern void* GC_MacGetDataStart(void);
       /* globals begin above stack and end at a5. */
       GC_add_roots_inner((ptr_t)GC_MacGetDataStart(),
                        (ptr_t)LMGetCurrentA5(), FALSE);
#   else
#     if defined(__MWERKS__)
#       if !__POWERPC__
         extern void* GC_MacGetDataStart(void);
         /* MATTHEW: Function to handle Far Globals (CW Pro 3) */
#         if __option(far_data)
         extern void* GC_MacGetDataEnd(void);
#         endif
         /* globals begin above stack and end at a5. */
         GC_add_roots_inner((ptr_t)GC_MacGetDataStart(),
                          (ptr_t)LMGetCurrentA5(), FALSE);
         /* MATTHEW: Handle Far Globals */                          
#         if __option(far_data)
      /* Far globals follow he QD globals: */
         GC_add_roots_inner((ptr_t)LMGetCurrentA5(),
                          (ptr_t)GC_MacGetDataEnd(), FALSE);
#         endif
#       else
         extern char __data_start__[], __data_end__[];
         GC_add_roots_inner((ptr_t)&__data_start__,
                          (ptr_t)&__data_end__, FALSE);
#       endif /* __POWERPC__ */
#     endif /* __MWERKS__ */
#   endif /* !THINK_C */
    }
#   endif /* MACOS */

    /* Dynamic libraries are added at every collection, since they may  */
    /* change.                                                        */
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 374 of file os_dep.c.

Here is the caller graph for this function:

Definition at line 1076 of file os_dep.c.

{
  ptr_t result;
# ifdef IRIX5
    /* Bare sbrk isn't thread safe.  Play by malloc rules.     */
    /* The equivalent may be needed on other systems as well.  */
    __LOCK_MALLOC();
# endif
  {
    ptr_t cur_brk = (ptr_t)sbrk(0);
    SBRK_ARG_T lsbs = (word)cur_brk & (GC_page_size-1);
    
    if ((SBRK_ARG_T)bytes < 0) return(0); /* too big */
    if (lsbs != 0) {
        if((ptr_t)sbrk(GC_page_size - lsbs) == (ptr_t)(-1)) return(0);
    }
    result = (ptr_t)sbrk((SBRK_ARG_T)bytes);
    if (result == (ptr_t)(-1)) result = 0;
  }
# ifdef IRIX5
    __UNLOCK_MALLOC();
# endif
  return(result);
}

Here is the call graph for this function:

void GC_write_hint ( struct hblk h)

Definition at line 1375 of file os_dep.c.

{
}

Variable Documentation

SIGSET_T dummy [static]

Definition at line 299 of file os_dep.c.

Definition at line 1318 of file os_dep.c.

OS/2.

Definition at line 355 of file os_dep.c.

Definition at line 1170 of file os_dep.c.

Definition at line 303 of file os_dep.c.

Definition at line 293 of file os_dep.c.

SIGSET_T new_mask [static]

Definition at line 295 of file os_dep.c.

SIGSET_T old_mask [static]

Definition at line 297 of file os_dep.c.