Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
setjmp_t.c File Reference
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
#include "gcconfig.h"

Go to the source code of this file.

Functions

intnested_sp ()
 main ()
int g (int x)

Variables

struct {
char a_a
char * a_b
a

Function Documentation

int g ( int  x)

Definition at line 111 of file setjmp_t.c.

{
       return(x);
}
main ( void  )

Definition at line 61 of file setjmp_t.c.

{
       int dummy;
       long ps = GETPAGESIZE();
       jmp_buf b;
       register int x = (int)strlen("a");  /* 1, slightly disguised */
       static int y = 0;

       printf("This appears to be a %s running %s\n", MACH_TYPE, OS_TYPE);
       if (nested_sp() < &dummy) {
         printf("Stack appears to grow down, which is the default.\n");
         printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n",
                ((unsigned long)(&dummy) + ps) & ~(ps-1));
       } else {
         printf("Stack appears to grow up.\n");
         printf("Define STACK_GROWS_UP in gc_private.h\n");
         printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n",
                ((unsigned long)(&dummy) + ps) & ~(ps-1));
       }
       printf("Note that this may vary between machines of ostensibly\n");
       printf("the same architecture (e.g. Sun 3/50s and 3/80s).\n");
       printf("On many machines the value is not fixed.\n");
       printf("A good guess for ALIGNMENT on this machine is %ld.\n",
              (unsigned long)(&(a.a_b))-(unsigned long)(&a));
       
       /* Encourage the compiler to keep x in a callee-save register */
       x = 2*x-1;
       printf("");
       x = 2*x-1;
       setjmp(b);
       if (y == 1) {
           if (x == 2) {
              printf("Generic mark_regs code probably wont work\n");
#             if defined(SPARC) || defined(RS6000) || defined(VAX) || defined(MIPS) || defined(M68K) || defined(I386) || defined(NS32K) || defined(RT)
                  printf("Assembly code supplied\n");
#             else
                  printf("Need assembly code\n");
#             endif
           } else if (x == 1) {
              printf("Generic mark_regs code may work\n");
           } else {
              printf("Very strange setjmp implementation\n");
           }
       }
       y++;
       x = 2;
       if (y == 1) longjmp(b,1);
       return(0);
}

Here is the call graph for this function:

int* nested_sp ( )

Definition at line 54 of file setjmp_t.c.

{
    int dummy;
    
    return(&dummy);
}

Here is the caller graph for this function:


Variable Documentation

struct { ... } a