circuitpython/tests/stress
Damien George bd556b6996 py: Fix compiling and decoding of *args at large arg positions.
There were two issues with the existing code:

1. "1 << i" is computed as a 32-bit number so would overflow when
   executed on 64-bit machines (when mp_uint_t is 64-bit).  This meant that
   *args beyond 32 positions would not be handled correctly.

2. star_args must fit as a positive small int so that it is encoded
   correctly in the emitted code.  MP_SMALL_INT_BITS is too big because it
   overflows a small int by 1 bit.  MP_SMALL_INT_BITS - 1 does not work
   because it produces a signed small int which is then sign extended when
   extracted (even by mp_obj_get_int_truncated), and this sign extension
   means that any position arg after *args is also treated as a star-arg.
   So the maximum bit position is MP_SMALL_INT_BITS - 2.  This means that
   MP_OBJ_SMALL_INT_VALUE() can be used instead of
   mp_obj_get_int_truncated() to get the value of star_args.

These issues are fixed by this commit, and a test added.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-01 09:20:42 +11:00
..
bytecode_limit.py py/emitbc: Add check for bytecode jump offset overflow. 2022-03-28 15:41:51 +11:00
bytecode_limit.py.exp py/emitbc: Add check for bytecode jump offset overflow. 2022-03-28 15:41:51 +11:00
dict_copy.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
dict_create.py tests: Add new subdir "stress/" specifically for stress tests. 2016-03-15 13:20:18 +00:00
dict_create_max.py tests/stress: Add test to create a dict beyond "maximum" rehash size. 2018-02-24 23:14:39 +11:00
fun_call_limit.py py: Fix compiling and decoding of *args at large arg positions. 2022-04-01 09:20:42 +11:00
fun_call_limit.py.exp py: Fix compiling and decoding of *args at large arg positions. 2022-04-01 09:20:42 +11:00
gc_trace.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
list_sort.py tests: Add new subdir "stress/" specifically for stress tests. 2016-03-15 13:20:18 +00:00
qstr_limit.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
qstr_limit.py.exp tests/stress/qstr_limit: Tune params to run with stm32 port. 2019-12-13 15:58:28 +11:00
recursion.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
recursive_data.py tests: Move recursive tests to the tests/stress/ subdir. 2018-04-10 14:43:52 +10:00
recursive_data.py.exp tests: Move recursive tests to the tests/stress/ subdir. 2018-04-10 14:43:52 +10:00
recursive_gen.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
recursive_iternext.py tests/stress/recursive_iternext.py: Increase large depth to 5000. 2019-07-17 15:52:41 +10:00
recursive_iternext.py.exp tests: Move recursive tests to the tests/stress/ subdir. 2018-04-10 14:43:52 +10:00