File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -429,6 +429,10 @@ int pthread_attr_destroy(pthread_attr_t *a)
429429
430430#endif
431431
432+ #if defined(__wasi__ ) & _Py__has_attribute (weak )
433+ extern __attribute__((weak )) unsigned char __stack_high ;
434+ extern __attribute__((weak )) unsigned char __stack_low ;
435+ #endif
432436
433437void
434438_Py_InitializeRecursionLimits (PyThreadState * tstate )
@@ -469,6 +473,14 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate)
469473 return ;
470474 }
471475# endif
476+ #if defined(__wasi__ ) & _Py__has_attribute (weak )
477+ if (__stack_high ) {
478+ _tstate -> c_stack_top = & __stack_high ;
479+ _tstate -> c_stack_soft_limit = & __stack_low + PYOS_STACK_MARGIN_BYTES * 2 ;
480+ _tstate -> c_stack_hard_limit = & __stack_low + PYOS_STACK_MARGIN_BYTES ;
481+ return ;
482+ }
483+ #endif
472484 _tstate -> c_stack_top = _Py_SIZE_ROUND_UP (here_addr , 4096 );
473485 _tstate -> c_stack_soft_limit = _tstate -> c_stack_top - Py_C_STACK_SIZE ;
474486 _tstate -> c_stack_hard_limit = _tstate -> c_stack_top - (Py_C_STACK_SIZE + PYOS_STACK_MARGIN_BYTES );
You can’t perform that action at this time.
0 commit comments