| 1 |
struct PMC { |
| 2 |
unsigned flags; |
| 3 |
}; |
| 4 |
|
| 5 |
typedef struct Pcc_cell |
| 6 |
{ |
| 7 |
struct PMC *p; |
| 8 |
long bla; |
| 9 |
long type; |
| 10 |
} Pcc_cell; |
| 11 |
|
| 12 |
extern void abort (); |
| 13 |
extern void Parrot_gc_mark_PMC_alive_fun(int * interp, struct PMC *pmc) |
| 14 |
__attribute__((noinline)); |
| 15 |
|
| 16 |
void Parrot_gc_mark_PMC_alive_fun (int * interp, struct PMC *pmc) |
| 17 |
{ |
| 18 |
abort (); |
| 19 |
} |
| 20 |
|
| 21 |
static void mark_cell(int * interp, Pcc_cell *c) |
| 22 |
__attribute__((__nonnull__(1))) |
| 23 |
__attribute__((__nonnull__(2))) |
| 24 |
__attribute__((noinline)); |
| 25 |
|
| 26 |
static void |
| 27 |
mark_cell(int * interp, Pcc_cell *c) |
| 28 |
{ |
| 29 |
if (c->type == 4 && c->p |
| 30 |
&& !(c->p->flags & (1<<18))) |
| 31 |
Parrot_gc_mark_PMC_alive_fun(interp, c->p); |
| 32 |
} |
| 33 |
|
| 34 |
void foo(int * interp, Pcc_cell *c); |
| 35 |
|
| 36 |
void |
| 37 |
foo(int * interp, Pcc_cell *c) |
| 38 |
{ |
| 39 |
mark_cell(interp, c); |
| 40 |
} |
| 41 |
|
| 42 |
int main() |
| 43 |
{ |
| 44 |
int i; |
| 45 |
Pcc_cell c; |
| 46 |
c.p = 0; |
| 47 |
c.bla = 42; |
| 48 |
c.type = 4; |
| 49 |
foo (&i, &c); |
| 50 |
return 0; |
| 51 |
} |