summaryrefslogtreecommitdiff
path: root/tests/run-tests.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-12-05 17:01:30 +1100
committerDamien George <damien@micropython.org>2025-07-16 00:12:47 +1000
commit5e9189d6d1c00c92694888bf9c74276779c40716 (patch)
tree46ac68ccf7dcf59bf53b2efea4c76fb267db133f /tests/run-tests.py
parentaa2362d4de3bed960b65c5e6e66544f68f2e7ed1 (diff)
py/vm: Avoid heap-allocating slices when subscripting built-ins.
This commit adds a fast-path optimisation for when a BUILD_SLICE is immediately followed by a LOAD/STORE_SUBSCR for a native type, to avoid needing to allocate the slice on the heap. In some cases (e.g. `a[1:3] = x`) this can result in no allocations at all. We can't do this for instance types because the get/set/delattr implementation may keep a reference to the slice. Adds more tests to the basic slice tests to ensure that a stack-allocated slice never makes it to Python, and also a heapalloc test that verifies (when using bytecode) that assigning to a slice is no-alloc. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/run-tests.py')
-rwxr-xr-xtests/run-tests.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/run-tests.py b/tests/run-tests.py
index 0eaee5278..fe338d7ff 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -855,6 +855,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
"micropython/emg_exc.py"
) # because native doesn't have proper traceback info
skip_tests.add(
+ "micropython/heapalloc_slice.py"
+ ) # because native doesn't do the stack-allocated slice optimisation
+ skip_tests.add(
"micropython/heapalloc_traceback.py"
) # because native doesn't have proper traceback info
skip_tests.add(