micropython/tools
Rich Barlow 6e5a40cf3c tools/mpy-tool: Set sane initial dynamic qstr pool size with frozen mods
The first dynamic qstr pool is double the size of the 'alloc' field of
the last const qstr pool. The built in const qstr pool
(mp_qstr_const_pool) has a hardcoded alloc size of 10, meaning that the
first dynamic pool is allocated space for 20 entries. The alloc size
must be less than or equal to the actual number of qstrs in the pool
(the 'len' field) to ensure that the first dynamically created qstr
triggers the creation of a new pool.

When modules are frozen a second const pool is created (generally
mp_qstr_frozen_const_pool) and linked to the built in pool. However,
this second const pool had its 'alloc' field set to the number of qstrs
in the pool. When freezing a large quantity of modules this can result
in thousands of qstrs being in the pool. This means that the first
dynamically created qstr results in a massive allocation. This commit
sets the alloc size of the frozen qstr pool to 10 or less (if the number
of qstrs in the pool is less than 10). The result of this is that the
allocation behaviour when a dynamic qstr is created is identical with an
without frozen code.

Note that there is the potential for a slight memory inefficiency if the
frozen modules have less than 10 qstrs, as the first few dynamic
allocations will have quite a large overhead, but the geometric growth
soon deals with this.
2018-08-01 18:59:31 +10:00
..
.gitattributes micropython-upip: Mark as binary file and re-commit. 2015-06-06 23:09:23 +03:00
.gitignore tools: check-in errordeveloper/tinytest@eb2dbc858f 2014-05-08 01:41:21 +03:00
bootstrap_upip.sh tools/upip: Upgrade upip to 1.2.4. 2018-04-23 16:11:27 +10:00
build-stm-latest.sh tools: Add STM32F4DISC and ESPRUINO_PICO to stmhal build script. 2015-04-21 13:16:41 +00:00
cc1 tools: Add C middle-processor to make builtin tables proper hash tables. 2015-12-31 00:24:33 +00:00
check_code_size.sh all: Update Makefiles and others to build with new ports/ dir layout. 2017-09-06 14:09:13 +10:00
codestats.sh all: Update Makefiles and others to build with new ports/ dir layout. 2017-09-06 14:09:13 +10:00
dfu.py tools/dfu.py: Pad image data to 8 byte alignment to support L476. 2018-07-20 14:23:11 +10:00
file2h.py tools: Fix up pybcdc.inf generation: new lines and hex digits. 2014-04-16 11:45:52 +01:00
gen-changelog.sh Rename "Micro Python" to "MicroPython" in REPL, help, readme's and misc. 2015-10-12 00:06:25 +01:00
gen-cpydiff.py tools/gen-cpydiff.py: Update executable paths to point to new ports dir. 2017-11-28 10:50:32 +11:00
gendoc.py tools: Make gendoc.py able to output RST format. 2014-10-31 01:36:11 +00:00
insert-usb-ids.py various: Spelling fixes 2017-05-29 11:36:05 +03:00
make-frozen.py tools/make-frozen: Update for latest changes in frozen modules support. 2016-05-21 21:39:27 +03:00
mpy-tool.py tools/mpy-tool: Set sane initial dynamic qstr pool size with frozen mods 2018-08-01 18:59:31 +10:00
mpy_bin2res.py tools/mpy_bin2res: Tools to convert binary resources to Python module. 2017-07-27 14:41:27 +03:00
mpy_cross_all.py tools/mpy_cross_all.py: Helper tool to run mpy-cross on the entire project. 2017-05-14 17:51:12 +03:00
pyboard.py tools/pyboard: Update docstring for additional device support. 2017-10-08 00:04:57 +03:00
pydfu.py tools/pydfu.py: Make the DFU tool work again with Python 2. 2018-07-27 16:53:50 +10:00
tinytest-codegen.py tools/tinytest-codegen: Ignore system locale, write output in UTF-8. 2017-12-15 12:04:10 +02:00
upip.py tools/upip: Upgrade upip to 1.2.4. 2018-04-23 16:11:27 +10:00
upip_utarfile.py tools/upip: Upgrade to 1.2.2. 2017-09-29 18:24:11 -07:00