in reply to [Solved] XS debugging "failed to extend arg stack"
For the record, along the way I notice a) that metacpan does not know your module depends on ExtUtils::Depends and Test2::Suite, and b) in the module you appear to invoke Scalar::Util::weaken without loading Scalar::Util.
After confusing myself a few times, I've come to the conclusion that you've hit an unfortunate case - the EXTEND macro evaluates its arguments several times. Along the way it invokes EXTEND_HWM_SET, which looks like this for a debugging build:
# define EXTEND_HWM_SET(p, n) \ STMT_START { \ SSize_t ix = (p) - PL_stack_base + (n); \ if (ix > PL_curstackinfo->si_stack_hwm) \ PL_curstackinfo->si_stack_hwm = ix; \ } STMT_END
So given that n here is the string ix==3 ? 2*n : n, it is quite reasonable things are going to go wrong. If you use some variable other than ix, or (for example) duplicate the EXTEND call inside the if/else blocks to avoid the conditional, then the error goes away.
Update: #19818
HTH, Hugo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XS debugging "failed to extend arg stack"
by ikegami (Patriarch) on Jun 03, 2022 at 16:03 UTC | |
by hv (Prior) on Jun 03, 2022 at 16:59 UTC | |
by Anonymous Monk on Jun 04, 2022 at 04:32 UTC | |
by NERDVANA (Priest) on Jun 03, 2022 at 16:58 UTC | |
|
Re^2: XS debugging "failed to extend arg stack"
by NERDVANA (Priest) on Jun 03, 2022 at 05:18 UTC | |
by khw (Acolyte) on Jul 03, 2022 at 13:04 UTC | |
by NERDVANA (Priest) on Jul 06, 2022 at 01:18 UTC | |
|
Re^2: XS debugging "failed to extend arg stack"
by NERDVANA (Priest) on Jun 03, 2022 at 16:49 UTC |