35
35
}
36
36
37
37
/*
38
- * Include pycore_slp_platformselect.h with SLP_EVAL defined.
39
- * If the macro SLP_EVAL is defined, pycore_slp_platformselect.h defines
40
- * the static function int slp_switch(void).
38
+ * Platform Selection for Stackless
41
39
*/
42
- #define SLP_EVAL
43
- #ifdef PYCORE_SLP_PLATFORMSELECT_H
44
- #undef PYCORE_SLP_PLATFORMSELECT_H
40
+ #define SLP_EVAL /* enable code generation in the included header */
41
+
42
+ #if defined(MS_WIN32 ) && !defined(MS_WIN64 ) && defined(_M_IX86 )
43
+ #include "pycore_slp_switch_x86_msvc.h" /* MS Visual Studio on X86 */
44
+ #elif defined(MS_WIN64 ) && defined(_M_X64 )
45
+ #include "pycore_slp_switch_x64_msvc.h" /* MS Visual Studio on X64 */
46
+ #elif defined(__GNUC__ ) && defined(__i386__ )
47
+ #include "pycore_slp_switch_x86_unix.h" /* gcc on X86 */
48
+ #elif defined(__GNUC__ ) && defined(__amd64__ )
49
+ #include "pycore_slp_switch_amd64_unix.h" /* gcc on amd64 */
50
+ #elif defined(__GNUC__ ) && defined(__PPC__ ) && defined(__linux__ )
51
+ #include "pycore_slp_switch_ppc_unix.h" /* gcc on PowerPC */
52
+ #elif defined(__GNUC__ ) && defined(__ppc__ ) && defined(__APPLE__ )
53
+ #include "pycore_slp_switch_ppc_macosx.h" /* Apple MacOS X on PowerPC */
54
+ #elif defined(__GNUC__ ) && defined(sparc ) && defined(sun )
55
+ #include "pycore_slp_switch_sparc_sun_gcc.h" /* SunOS sparc with gcc */
56
+ #elif defined(__GNUC__ ) && defined(__s390__ ) && defined(__linux__ )
57
+ #include "pycore_slp_switch_s390_unix.h" /* Linux/S390 */
58
+ #elif defined(__GNUC__ ) && defined(__s390x__ ) && defined(__linux__ )
59
+ #include "pycore_slp_switch_s390_unix.h" /* Linux/S390 zSeries (identical) */
60
+ #elif defined(__GNUC__ ) && defined(__arm__ ) && defined(__thumb__ )
61
+ #include "pycore_slp_switch_arm_thumb_gcc.h" /* gcc using arm thumb */
62
+ #elif defined(__GNUC__ ) && defined(__arm32__ )
63
+ #include "pycore_slp_switch_arm32_gcc.h" /* gcc using arm32 */
64
+ #elif defined(__GNUC__ ) && defined(__mips__ ) && defined(__linux__ )
65
+ #include "pycore_slp_switch_mips_unix.h" /* MIPS */
66
+ #elif defined(SN_TARGET_PS3 )
67
+ #include "pycore_slp_switch_ps3_SNTools.h" /* Sony PS3 */
45
68
#endif
46
- #include "pycore_slp_platformselect.h"
47
-
48
69
#ifndef STACKLESS
49
70
* * * * * * * * * *
50
71
If you see this error message ,
@@ -54,6 +75,30 @@ or disable the STACKLESS flag.
54
75
* * * * * * * * * *
55
76
#endif
56
77
78
+ /* default definitions if not defined in above files */
79
+
80
+
81
+ /* a good estimate how much the cstack level differs between
82
+ initialisation and main C-Python(r) code. Not critical, but saves time.
83
+ Note that this will vanish with the greenlet approach. */
84
+
85
+ #ifndef SLP_CSTACK_GOODGAP
86
+ #define SLP_CSTACK_GOODGAP 4096
87
+ #endif
88
+
89
+ /* stack size in pointer to trigger stack spilling */
90
+
91
+ #ifndef SLP_CSTACK_WATERMARK
92
+ #define SLP_CSTACK_WATERMARK 16384
93
+ #endif
94
+
95
+ /* define direction of stack growth */
96
+
97
+ #ifndef SLP_CSTACK_DOWNWARDS
98
+ #define SLP_CSTACK_DOWNWARDS 1 /* 0 for upwards */
99
+ #endif
100
+
101
+
57
102
/*
58
103
* Call SLP_DO_NOT_OPTIMIZE_AWAY(pointer) to ensure that pointer will be
59
104
* computed even post-optimization. Use it for pointers that are computed but
@@ -101,6 +146,24 @@ extern uint8_t* volatile slp_do_not_opimize_away_sink;
101
146
#endif
102
147
#endif /* #ifndef SLP_DO_NOT_OPTIMIZE_AWAY */
103
148
149
+ /**************************************************************
150
+
151
+ Don't change definitions below, please.
152
+
153
+ **************************************************************/
154
+
155
+ #if SLP_CSTACK_DOWNWARDS == 1
156
+ #define SLP_CSTACK_COMPARE (a , b ) (a) < (b)
157
+ #define SLP_CSTACK_SUBTRACT (a , b ) (a) - (b)
158
+ #else
159
+ #define SLP_CSTACK_COMPARE (a , b ) (a) > (b)
160
+ #define SLP_CSTACK_SUBTRACT (a , b ) (b) - (a)
161
+ #endif
162
+
163
+ /**************************************************************
164
+ * End of definitions
165
+ ***************************************************************/
166
+
104
167
SLP_DO_NOT_OPTIMIZE_AWAY_DEFINITIONS
105
168
106
169
#ifdef SLP_EXTERNAL_ASM
@@ -262,6 +325,14 @@ slp_transfer(PyCStackObject **cstprev, PyCStackObject *cst,
262
325
return result ;
263
326
}
264
327
328
+ #ifdef Py_DEBUG
329
+ int
330
+ slp_transfer_return (PyCStackObject * cst )
331
+ {
332
+ return slp_transfer (NULL , cst , NULL );
333
+ }
334
+ #endif
335
+
265
336
int
266
337
slp_cstack_save_now (const PyThreadState * tstate , const void * pstackvar )
267
338
{
@@ -293,12 +364,4 @@ slp_cstack_set_base_and_goodgap(PyThreadState *tstate, const void * pstackvar, P
293
364
return (void * )1 ;
294
365
}
295
366
296
- #ifdef Py_DEBUG
297
- int
298
- slp_transfer_return (PyCStackObject * cst )
299
- {
300
- return slp_transfer (NULL , cst , NULL );
301
- }
302
- #endif
303
-
304
367
#endif
0 commit comments