Debian Codegraph @

rpython/translator/c/src/stack.h

raw symbols SCIP
1
2 /************************************************************/
3 /*** C header subsection: stack operations ***/
4
5 #include <src/precommondefs.h>
6
7
8 #ifndef MAX_STACK_SIZE
9 # if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__)
10 /* PowerPC seems to consume the stack very quickly. The default
11 * value of 768 kb is only enough for 406 levels on ppc64, and 792
12 * on ppc64le */
13 # define MAX_STACK_SIZE (11 << 18) /* 2.8 mb */
14 # elif defined(__s390x__)
15 /* S390X as well has pretty large stack frames. */
16 # define MAX_STACK_SIZE (11 << 18) /* 2.8 mb */
17 # else
18 # define MAX_STACK_SIZE (3 << 18) /* 768 kb */
19 # endif
20 #endif
21
22
23 typedef struct {
24 char *stack_end;
25 Signed stack_length;
26 char report_error;
27 } rpy_stacktoobig_t;
28
29 RPY_EXTERN rpy_stacktoobig_t rpy_stacktoobig;
30
31 RPY_EXTERN
32 char LL_stack_too_big_slowpath(Signed); /* returns 0 (ok) or 1 (too big) */
33 RPY_EXTERN
34 void LL_stack_set_length_fraction(double);
35
36 /* some macros referenced from rpython.rlib.rstack */
37 #define LL_stack_get_end() ((Signed)rpy_stacktoobig.stack_end)
38 #define LL_stack_get_length() rpy_stacktoobig.stack_length
39 #define LL_stack_get_end_adr() ((Signed)&rpy_stacktoobig.stack_end) /* JIT */
40 #define LL_stack_get_length_adr() ((Signed)&rpy_stacktoobig.stack_length)/* JIT */
41
42 #define LL_stack_criticalcode_start() (rpy_stacktoobig.report_error = 0)
43 #define LL_stack_criticalcode_stop() (rpy_stacktoobig.report_error = 1)
44
45
46 #ifdef __GNUC__
47 # define PYPY_INHIBIT_TAIL_CALL() asm("/* inhibit_tail_call */")
48 #elif defined(_MSC_VER) && !defined(_WIN64)
49 # define PYPY_INHIBIT_TAIL_CALL() __asm NOP /* inhibit_tail_call */
50 #else
51 # define PYPY_INHIBIT_TAIL_CALL() /* add hints for other compilers here */
52 #endif