~rdoering/ubuntu/intrepid/erlang/fix-535090

« back to all changes in this revision

Viewing changes to erts/emulator/beam/erl_gc.h

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2007-05-01 16:57:10 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070501165710-2sapk0hp2gf3o0ip
Tags: 1:11.b.4-2ubuntu1
* Merge with Debian Unstable. Remaining changes:
  - Add -fno-stack-protector to fix broken crypto_drv.
* DebianMaintainerField update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __ERL_GC_H__
 
2
#define __ERL_GC_H__
 
3
 
 
4
/* GC declarations shared by beam/erl_gc.c and hipe/hipe_gc.c */
 
5
 
 
6
#ifdef DEBUG
 
7
#  define HARDDEBUG 1
 
8
#endif
 
9
 
 
10
#define IS_MOVED(x)     (!is_header((x)))
 
11
 
 
12
#define MOVE_CONS(PTR,CAR,HTOP,ORIG)                                    \
 
13
do {                                                                    \
 
14
    Eterm gval;                                                         \
 
15
                                                                        \
 
16
    HTOP[0] = CAR;              /* copy car */                          \
 
17
    HTOP[1] = PTR[1];           /* copy cdr */                          \
 
18
    gval = make_list(HTOP);     /* new location */                      \
 
19
    *ORIG = gval;               /* redirect original reference */       \
 
20
    PTR[0] = THE_NON_VALUE;     /* store forwarding indicator */        \
 
21
    PTR[1] = gval;              /* store forwarding address */          \
 
22
    HTOP += 2;                  /* update tospace htop */               \
 
23
} while(0)
 
24
 
 
25
#define MOVE_BOXED(PTR,HDR,HTOP,ORIG)                                   \
 
26
do {                                                                    \
 
27
    Eterm gval;                                                         \
 
28
    Sint nelts;                                                         \
 
29
                                                                        \
 
30
    ASSERT(is_header(HDR));                                             \
 
31
    gval = make_boxed(HTOP);                                            \
 
32
    *ORIG = gval;                                                       \
 
33
    *HTOP++ = HDR;                                                      \
 
34
    *PTR++ = gval;                                                      \
 
35
    nelts = header_arity(HDR);                                          \
 
36
    switch ((HDR) & _HEADER_SUBTAG_MASK) {                              \
 
37
    case SUB_BINARY_SUBTAG: nelts++; break;                             \
 
38
    case FUN_SUBTAG: nelts+=((ErlFunThing*)(PTR-1))->num_free+1; break; \
 
39
    }                                                                   \
 
40
    while (nelts--)                                                     \
 
41
        *HTOP++ = *PTR++;                                               \
 
42
} while(0)
 
43
 
 
44
#define in_area(ptr,start,nbytes) \
 
45
 ((unsigned long)((char*)(ptr) - (char*)(start)) < (nbytes))
 
46
 
 
47
#ifdef DEBUG
 
48
int within(Eterm *ptr, Process *p);
 
49
#endif
 
50
 
 
51
#endif /* __ERL_GC_H__ */