~ubuntu-branches/ubuntu/quantal/libgc/quantal

« back to all changes in this revision

Viewing changes to setjmp_t.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2011-02-19 12:19:56 UTC
  • mfrom: (1.3.2 upstream) (0.1.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20110219121956-67rb69xlt5nud3v2
Tags: 1:7.1-5
Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <stdio.h>
25
25
#include <setjmp.h>
26
26
#include <string.h>
27
 
#include "private/gcconfig.h"
 
27
#include "private/gc_priv.h"
28
28
 
29
29
#ifdef OS2
30
30
/* GETPAGESIZE() is set to getpagesize() by default, but that   */
57
57
    return(&dummy);
58
58
}
59
59
 
60
 
main()
 
60
int main()
61
61
{
62
62
        int dummy;
63
63
        long ps = GETPAGESIZE();
82
82
        printf("A good guess for ALIGNMENT on this machine is %ld.\n",
83
83
               (unsigned long)(&(a.a_b))-(unsigned long)(&a));
84
84
        
 
85
        printf("The following is a very dubious test of one root marking"
 
86
               " strategy.\n");
 
87
        printf("Results may not be accurate/useful:\n");
85
88
        /* Encourage the compiler to keep x in a callee-save register */
86
89
        x = 2*x-1;
87
90
        printf("");
89
92
        setjmp(b);
90
93
        if (y == 1) {
91
94
            if (x == 2) {
92
 
                printf("Generic mark_regs code probably wont work\n");
93
 
#               if defined(SPARC) || defined(RS6000) || defined(VAX) || defined(MIPS) || defined(M68K) || defined(I386) || defined(NS32K) || defined(RT)
94
 
                    printf("Assembly code supplied\n");
95
 
#               else
96
 
                    printf("Need assembly code\n");
97
 
#               endif
 
95
                printf("Setjmp-based generic mark_regs code probably wont work.\n");
 
96
                printf("But we rarely try that anymore.  If you have getcontect()\n");
 
97
                printf("this probably doesn't matter.\n");
98
98
            } else if (x == 1) {
99
 
                printf("Generic mark_regs code may work\n");
 
99
                printf("Setjmp-based register marking code may work.\n");
100
100
            } else {
101
 
                printf("Very strange setjmp implementation\n");
 
101
                printf("Very strange setjmp implementation.\n");
102
102
            }
103
103
        }
104
104
        y++;
105
105
        x = 2;
106
106
        if (y == 1) longjmp(b,1);
 
107
        printf("Some GC internal configuration stuff: \n");
 
108
        printf("\tWORDSZ = %d, ALIGNMENT = %d, GC_GRANULE_BYTES = %d\n",
 
109
               WORDSZ, ALIGNMENT, GC_GRANULE_BYTES);
 
110
        printf("\tUsing one mark ");
 
111
#       if defined(USE_MARK_BYTES)
 
112
          printf("byte");
 
113
#       elif defined(USE_MARK_BITS)
 
114
          printf("bit");
 
115
#       endif
 
116
        printf(" per ");
 
117
#       if defined(MARK_BIT_PER_OBJ)
 
118
          printf("object.\n");
 
119
#       elif defined(MARK_BIT_PER_GRANULE)
 
120
          printf("granule.\n");
 
121
#       endif
 
122
#       ifdef THREAD_LOCAL_ALLOC
 
123
          printf("Thread local allocation enabled.\n");
 
124
#       endif
 
125
#       ifdef PARALLEL_MARK
 
126
          printf("Parallel marking enabled.\n");
 
127
#       endif
107
128
        return(0);
108
129
}
109
130