blob: 5effacb3981dda20221f0bfae225fb4a16d89634 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
* %CopyrightBegin%
*
* Copyright Ericsson AB 2001-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* %CopyrightEnd%
*/
/*
* HiPE-specific process fields
*/
#ifndef HIPE_PROCESS_H
#define HIPE_PROCESS_H
#include "erl_alloc.h"
struct hipe_process_state {
Eterm *nsp; /* Native stack pointer. */
Eterm *nstack; /* Native stack block start. */
Eterm *nstend; /* Native stack block end (start+size). */
/* XXX: ncallee and closure could share space in a union */
void (*ncallee)(void); /* Native code callee (label) to invoke. */
Eterm closure; /* Used to pass a closure from native code. */
Eterm *nstgraylim; /* Gray/white stack boundary. */
Eterm *nstblacklim; /* Black/gray stack boundary. Must exist if
graylim exists. Ignored if no graylim. */
void (*ngra)(void); /* Saved original RA from graylim frame. */
#if defined(__i386__) || defined(__x86_64__)
Eterm *ncsp; /* Saved C stack pointer. */
#endif
#if defined(__sparc__) || defined(__powerpc__) || defined(__ppc__) || defined(__powerpc64__) || defined(__arm__)
void (*nra)(void); /* Native code return address. */
#endif
unsigned int narity; /* Arity of BIF call, for stack walks. */
};
extern void hipe_arch_print_pcb(struct hipe_process_state *p);
static __inline__ void hipe_init_process(struct hipe_process_state *p)
{
p->nsp = NULL;
p->nstack = NULL;
p->nstend = NULL;
p->nstgraylim = NULL;
p->nstblacklim = NULL;
p->ngra = NULL;
#if defined(__sparc__) || defined(__powerpc__) || defined(__ppc__) || defined(__powerpc64__) || defined(__arm__)
p->nra = NULL;
#endif
p->narity = 0;
}
static __inline__ void hipe_delete_process(struct hipe_process_state *p)
{
if (p->nstack)
erts_free(ERTS_ALC_T_HIPE, (void*)p->nstack);
}
#ifdef ERTS_SMP
struct hipe_process_state_smp {
int have_receive_locks;
};
static __inline__ void hipe_init_process_smp(struct hipe_process_state_smp *p)
{
p->have_receive_locks = 0;
}
#endif
#endif /* HIPE_PROCESS_H */
|