<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/objfun.c, branch 2.2.0-rc.2</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=2.2.0-rc.2</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=2.2.0-rc.2'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2017-08-15T01:53:36+00:00</updated>
<entry>
<title>py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE.</title>
<updated>2017-08-15T01:53:36+00:00</updated>
<author>
<name>Stefan Naumann</name>
<email>me@stefannaumann.de</email>
</author>
<published>2017-07-24T16:55:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=ace9fb54053c29574bdf81ffacc5ddcf9d4b45d9'/>
<id>urn:sha1:ace9fb54053c29574bdf81ffacc5ddcf9d4b45d9</id>
<content type='text'>
It enables all the DEBUG_printf outputs in the py/ source code.
</content>
</entry>
<entry>
<title>all: Use the name MicroPython consistently in comments</title>
<updated>2017-07-31T08:35:40+00:00</updated>
<author>
<name>Alexander Steffen</name>
<email>devel.20.webmeister@spamgourmet.com</email>
</author>
<published>2017-06-30T07:22:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=55f33240f3d7051d4213629e92437a36f1fac50e'/>
<id>urn:sha1:55f33240f3d7051d4213629e92437a36f1fac50e</id>
<content type='text'>
There were several different spellings of MicroPython present in comments,
when there should be only one.
</content>
</entry>
<entry>
<title>py: Provide mp_decode_uint_skip() to help reduce stack usage.</title>
<updated>2017-06-09T03:36:33+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-06-09T03:31:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=a8a5d1e8c8db3b7c64e1921005ceb5a5d47280f4'/>
<id>urn:sha1:a8a5d1e8c8db3b7c64e1921005ceb5a5d47280f4</id>
<content type='text'>
Taking the address of a local variable leads to increased stack usage, so
the mp_decode_uint_skip() function is added to reduce the need for taking
addresses.  The changes in this patch reduce stack usage of a Python call
by 8 bytes on ARM Thumb, by 16 bytes on non-windowing Xtensa archs, and by
16 bytes on x86-64.  Code size is also slightly reduced on most archs by
around 32 bytes.
</content>
</entry>
<entry>
<title>py: Change mp_uint_t to size_t for mp_obj_str_get_data len arg.</title>
<updated>2017-03-29T01:56:45+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-03-25T08:48:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=6b341075376705ee1fe9e003b76b09afa59778f4'/>
<id>urn:sha1:6b341075376705ee1fe9e003b76b09afa59778f4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Convert mp_uint_t to size_t for tuple/list accessors.</title>
<updated>2017-03-29T01:56:17+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-03-25T08:35:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=6213ad7f466df12c734dc527993bbb46c9d9eb5c'/>
<id>urn:sha1:6213ad7f466df12c734dc527993bbb46c9d9eb5c</id>
<content type='text'>
This patch changes mp_uint_t to size_t for the len argument of the
following public facing C functions:

mp_obj_tuple_get
mp_obj_list_get
mp_obj_get_array

These functions take a pointer to the len argument (to be filled in by the
function) and callers of these functions should update their code so the
type of len is changed to size_t.  For ports that don't use nan-boxing
there should be no change in generate code because the size of the type
remains the same (word sized), and in a lot of cases there won't even be a
compiler warning if the type remains as mp_uint_t.

The reason for this change is to standardise on the use of size_t for
variables that count memory (or memory related) sizes/lengths.  It helps
builds that use nan-boxing.
</content>
</entry>
<entry>
<title>py: Reduce size of mp_code_state_t structure.</title>
<updated>2017-03-17T05:39:13+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-03-17T03:54:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=71a3d6ec3bd02c5bd13334537e1bd146bb643bad'/>
<id>urn:sha1:71a3d6ec3bd02c5bd13334537e1bd146bb643bad</id>
<content type='text'>
Instead of caching data that is constant (code_info, const_table and
n_state), store just a pointer to the underlying function object from which
this data can be derived.

This helps reduce stack usage for the case when the mp_code_state_t
structure is stored on the stack, as well as heap usage when it's stored
on the heap.

The downside is that the VM becomes a little more complex because it now
needs to derive the data from the underlying function object.  But this
doesn't impact the performance by much (if at all) because most of the
decoding of data is done outside the main opcode loop.  Measurements using
pystone show that little to no performance is lost.

This patch also fixes a nasty bug whereby the bytecode can be reclaimed by
the GC during execution.  With this patch there is always a pointer to the
function object held by the VM during execution, since it's stored in the
mp_code_state_t structure.
</content>
</entry>
<entry>
<title>py: Use mp_obj_get_array where sequence may be a tuple or a list.</title>
<updated>2017-03-07T05:48:16+00:00</updated>
<author>
<name>Krzysztof Blazewicz</name>
<email>blazewicz.krzysztof@gmail.com</email>
</author>
<published>2017-03-04T11:29:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7e480e8a30e5e293586bd4806f02a481a08648ca'/>
<id>urn:sha1:7e480e8a30e5e293586bd4806f02a481a08648ca</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/objfun: Convert mp_uint_t to size_t where appropriate.</title>
<updated>2017-02-16T05:51:16+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-02-16T05:34:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=dbcdb9f8d8d5dd56ede1f0705355679a11b75658'/>
<id>urn:sha1:dbcdb9f8d8d5dd56ede1f0705355679a11b75658</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Allow inline-assembler emitter to be generic.</title>
<updated>2016-12-09T06:06:21+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-12-09T02:17:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=ad297a1950c74c35c90dd655ae9a69d33ed28dc0'/>
<id>urn:sha1:ad297a1950c74c35c90dd655ae9a69d33ed28dc0</id>
<content type='text'>
This patch refactors some code so that it is easier to integrate new
inline assemblers for different architectures other than ARM Thumb.
</content>
</entry>
<entry>
<title>py: Specialise builtin funcs to use separate type for fixed arg count.</title>
<updated>2016-10-21T05:26:01+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-10-18T00:49:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=571e6f26dbd7e0e38441bc402f76d293303063b2'/>
<id>urn:sha1:571e6f26dbd7e0e38441bc402f76d293303063b2</id>
<content type='text'>
Builtin functions with a fixed number of arguments (0, 1, 2 or 3) are
quite common.  Before this patch the wrapper for such a function cost
3 machine words.  After this patch it only takes 2, which can reduce the
code size by quite a bit (and pays off even more, the more functions are
added).  It also makes function dispatch slightly more efficient in CPU
usage, and furthermore reduces stack usage for these cases.  On x86 and
Thumb archs the dispatch functions are now tail-call optimised by the
compiler.

The bare-arm port has its code size increase by 76 bytes, but stmhal drops
by 904 bytes.  Stack usage by these builtin functions is decreased by 48
bytes on Thumb2 archs.
</content>
</entry>
</feed>
