summaryrefslogtreecommitdiff
path: root/tests/cmdline/cmd_showbc.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-06-17 23:14:32 +1000
committerDamien George <damien@micropython.org>2022-06-20 22:28:18 +1000
commita506335524a69fbccad245d486f5f641a0cf8919 (patch)
tree2ca262dceb220610a7608460266a08ed77e1afa5 /tests/cmdline/cmd_showbc.py
parente85a096302e8b186b82c74e7da4e1a29ef62d9c6 (diff)
py/emit: Suppress unreachable bytecode/native code that follows jump.
This new logic tracks when an unconditional jump/raise occurs in the emitted code stream (bytecode or native machine code) and suppresses all subsequent code, until a label is assigned. This eliminates a lot of cases of dead code, with relatively simple logic. This commit combined with the previous one (that removed the existing dead-code finding logic) has the following code size change: bare-arm: -16 -0.028% minimal x86: -60 -0.036% unix x64: -368 -0.070% unix nanbox: -80 -0.017% stm32: -204 -0.052% PYBV10 cc3200: +0 +0.000% esp8266: -232 -0.033% GENERIC esp32: -224 -0.015% GENERIC[incl -40(data)] mimxrt: -192 -0.054% TEENSY40 renesas-ra: -200 -0.032% RA6M2_EK nrf: +28 +0.015% pca10040 rp2: -256 -0.050% PICO samd: -12 -0.009% ADAFRUIT_ITSYBITSY_M4_EXPRESS Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/cmdline/cmd_showbc.py')
-rw-r--r--tests/cmdline/cmd_showbc.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/cmdline/cmd_showbc.py b/tests/cmdline/cmd_showbc.py
index e5874f990..4a2e6500a 100644
--- a/tests/cmdline/cmd_showbc.py
+++ b/tests/cmdline/cmd_showbc.py
@@ -119,12 +119,12 @@ def f():
#from sys import * # tested at module scope
# raise
- raise
- raise 1
+ if a: raise
+ if a: raise 1
# return
- return
- return 1
+ if a: return
+ if a: return 1
# function with lots of locals
def f():