~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to erts/emulator/hipe/hipe_sparc_gc.h

  • Committer: Bazaar Package Importer
  • Author(s): Erlang Packagers, Sergei Golovan
  • Date: 2006-12-03 17:07:44 UTC
  • mfrom: (2.1.11 feisty)
  • Revision ID: james.westby@ubuntu.com-20061203170744-rghjwupacqlzs6kv
Tags: 1:11.b.2-4
[ Sergei Golovan ]
Fixed erlang-base and erlang-base-hipe prerm scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id$
 
2
 * Stack walking helpers for native stack GC procedures.
 
3
 */
 
4
#ifndef HIPE_SPARC_GC_H
 
5
#define HIPE_SPARC_GC_H
 
6
 
 
7
struct nstack_walk_state {
 
8
    const struct sdesc *sdesc0; /* .sdesc0 must be a pointer rvalue */
 
9
};
 
10
 
 
11
static inline int nstack_walk_init_check(const Process *p)
 
12
{
 
13
    return p->hipe.nra ? 1 : 0;
 
14
}
 
15
 
 
16
static inline Eterm *nstack_walk_nsp_begin(const Process *p)
 
17
{
 
18
    return p->hipe.nsp - 1;
 
19
}
 
20
 
 
21
static inline const struct sdesc*
 
22
nstack_walk_init_sdesc(const Process *p, struct nstack_walk_state *state)
 
23
{
 
24
    const struct sdesc *sdesc = hipe_find_sdesc((unsigned long)p->hipe.nra);
 
25
    state->sdesc0 = sdesc;
 
26
    return sdesc;
 
27
}
 
28
 
 
29
static inline void nstack_walk_update_trap(Process *p, const struct sdesc *sdesc0)
 
30
{
 
31
    hipe_update_stack_trap(p, sdesc0);
 
32
}
 
33
 
 
34
static inline Eterm *nstack_walk_nsp_end(const Process *p)
 
35
{
 
36
    return p->hipe.nstack;
 
37
}
 
38
 
 
39
static inline void nstack_walk_kill_trap(Process *p, Eterm *nsp_end)
 
40
{
 
41
    /* remove gray/white boundary trap */
 
42
    if( (unsigned long)p->hipe.nra == (unsigned long)nbif_stack_trap_ra ) {
 
43
        p->hipe.nra = p->hipe.ngra;
 
44
    } else {
 
45
        for(;;) {
 
46
            ++nsp_end;
 
47
            if( nsp_end[0] == (unsigned long)nbif_stack_trap_ra ) {
 
48
                nsp_end[0] = (unsigned long)p->hipe.ngra;
 
49
                break;
 
50
            }
 
51
        }
 
52
    }
 
53
}
 
54
 
 
55
static inline int nstack_walk_gray_passed_black(const Eterm *gray, const Eterm *black)
 
56
{
 
57
    return gray < black;
 
58
}
 
59
 
 
60
static inline int nstack_walk_nsp_reached_end(const Eterm *nsp, const Eterm *nsp_end)
 
61
{
 
62
    return nsp <= nsp_end;
 
63
}
 
64
 
 
65
static inline unsigned int nstack_walk_frame_size(const struct sdesc *sdesc)
 
66
{
 
67
    return sdesc_fsize(sdesc) + sdesc_arity(sdesc);
 
68
}
 
69
 
 
70
static inline Eterm *nstack_walk_frame_index(Eterm *nsp, unsigned int i)
 
71
{
 
72
    return &nsp[-i];
 
73
}
 
74
 
 
75
static inline unsigned long
 
76
nstack_walk_frame_ra(const Eterm *nsp, const struct sdesc *sdesc)
 
77
{
 
78
    return nsp[1-sdesc_fsize(sdesc)];
 
79
}
 
80
 
 
81
static inline Eterm *nstack_walk_next_frame(Eterm *nsp, unsigned int sdesc_size)
 
82
{
 
83
    return nsp - sdesc_size;
 
84
}
 
85
 
 
86
#endif /* HIPE_SPARC_GC_H */