blob: 60d09ea1c93d43e2eba9b23e2649638cd7568bd2 (
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
81
82
83
84
85
86
87
88
89
90
|
/*
* %CopyrightBegin%
*
* Copyright Ericsson AB 2001-2011. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* %CopyrightEnd%
*/
/*
* HiPE-specific process fields
*/
#ifndef HIPE_PROCESS_H
#define HIPE_PROCESS_H
#include "erl_alloc.h"
#include "export.h"
struct hipe_process_state {
Eterm *nsp; /* Native stack pointer. */
Eterm *nstack; /* Native stack block start. */
Eterm *nstend; /* Native stack block end (start+size). */
union {
void (*ncallee)(void); /* Native code callee (label) to invoke. */
Eterm closure; /* Used to pass a closure from native code. */
Export* callee_exp; /* Used to pass export entry from native code */
}u;
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. */
#ifdef NO_FPE_SIGNALS
double float_result; /* to be checked for inf/NaN by hipe_emulate_fpe */
#endif
#if defined(ERTS_ENABLE_LOCK_CHECK) && defined(ERTS_SMP)
void (*bif_callee)(void); /* When calling BIF's via debug wrapper */
#endif
};
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 */
|