<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/mpstate.h, branch v1.9.4</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.9.4</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.9.4'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2018-04-04T04:24:03+00:00</updated>
<entry>
<title>py: Don't include mp_optimise_value or opt_level() if compiler disabled.</title>
<updated>2018-04-04T04:24:03+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-04-04T04:24:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=3f420c0c27bd6daa5af39517925be55b9b9a9ab3'/>
<id>urn:sha1:3f420c0c27bd6daa5af39517925be55b9b9a9ab3</id>
<content type='text'>
Without the compiler enabled the mp_optimise_value is unused, and the
micropython.opt_level() function is not useful, so exclude these from the
build to save RAM and code size.
</content>
</entry>
<entry>
<title>py/mpstate.h: Add repl_line state for MICROPY_REPL_EVENT_DRIVEN.</title>
<updated>2018-02-26T05:08:58+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-02-26T05:08:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=9d8347a9aac40f8cc168b0226c2e74f776a7d4bf'/>
<id>urn:sha1:9d8347a9aac40f8cc168b0226c2e74f776a7d4bf</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/gc: Make GC stack pointer a local variable.</title>
<updated>2018-02-19T05:05:46+00:00</updated>
<author>
<name>Ayke van Laethem</name>
<email>aykevanlaethem@gmail.com</email>
</author>
<published>2018-02-15T16:22:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=736faef2233fe9c721b940a108b28808d4c7f7a0'/>
<id>urn:sha1:736faef2233fe9c721b940a108b28808d4c7f7a0</id>
<content type='text'>
This saves a bit in code size, and saves some precious .bss RAM:

                 .text  .bss
minimal CROSS=1: -28    -4
unix (64-bit):   -64    -8
</content>
</entry>
<entry>
<title>py/mpstate.h: Remove obsolete comment about nlr_top being coded in asm.</title>
<updated>2017-12-11T11:51:52+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-12-11T11:51:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d3f82bc42576ccd80206a17a4941fd5c28c56530'/>
<id>urn:sha1:d3f82bc42576ccd80206a17a4941fd5c28c56530</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Introduce a Python stack for scoped allocation.</title>
<updated>2017-12-11T02:49:09+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-11-26T12:28:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=02d830c035aca166d70551e485ccd2d1658189c9'/>
<id>urn:sha1:02d830c035aca166d70551e485ccd2d1658189c9</id>
<content type='text'>
This patch introduces the MICROPY_ENABLE_PYSTACK option (disabled by
default) which enables a "Python stack" that allows to allocate and free
memory in a scoped, or Last-In-First-Out (LIFO) way, similar to alloca().

A new memory allocation API is introduced along with this Py-stack.  It
includes both "local" and "nonlocal" LIFO allocation.  Local allocation is
intended to be equivalent to using alloca(), whereby the same function must
free the memory.  Nonlocal allocation is where another function may free
the memory, so long as it's still LIFO.

Follow-up patches will convert all uses of alloca() and VLA to the new
scoped allocation API.  The old behaviour (using alloca()) will still be
available, but when MICROPY_ENABLE_PYSTACK is enabled then alloca() is no
longer required or used.

The benefits of enabling this option are (or will be once subsequent
patches are made to convert alloca()/VLA):
- Toolchains without alloca() can use this feature to obtain correct and
  efficient scoped memory allocation (compared to using the heap instead
  of alloca(), which is slower).
- Even if alloca() is available, enabling the Py-stack gives slightly more
  efficient use of stack space when calling nested Python functions, due to
  the way that compilers implement alloca().
- Enabling the Py-stack with the stackless mode allows for even more
  efficient stack usage, as well as retaining high performance (because the
  heap is no longer used to build and destroy stackless code states).
- With Py-stack and stackless enabled, Python-calling-Python is no longer
  recursive in the C mp_execute_bytecode function.

The micropython.pystack_use() function is included to measure usage of the
Python stack.
</content>
</entry>
<entry>
<title>extmod/uos_dupterm: Update uos.dupterm() and helper funcs to have index.</title>
<updated>2017-10-13T09:01:57+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-10-13T09:01:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=37282f8fc135a16ff36e2afe0de907cbde531ed0'/>
<id>urn:sha1:37282f8fc135a16ff36e2afe0de907cbde531ed0</id>
<content type='text'>
The uos.dupterm() signature and behaviour is updated to reflect the latest
enhancements in the docs.  It has minor backwards incompatibility in that
it no longer accepts zero arguments.

The dupterm_rx helper function is moved from esp8266 to extmod and
generalised to support multiple dupterm slots.

A port can specify multiple slots by defining the MICROPY_PY_OS_DUPTERM
config macro to an integer, being the number of slots it wants to have;
0 means to disable the dupterm feature altogether.

The unix and esp8266 ports are updated to work with the new interface and
are otherwise unchanged with respect to functionality.
</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>all: Unify header guard usage.</title>
<updated>2017-07-18T01:57:39+00:00</updated>
<author>
<name>Alexander Steffen</name>
<email>devel.20.webmeister@spamgourmet.com</email>
</author>
<published>2017-06-29T21:14:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=299bc625864b9e624ed599c94a5f95870516139a'/>
<id>urn:sha1:299bc625864b9e624ed599c94a5f95870516139a</id>
<content type='text'>
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.

This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.

The rules are as follows.

Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _

In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.

py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
</content>
</entry>
<entry>
<title>py: Make sure that static emg-exc-buffer is aligned to size of mp_obj_t.</title>
<updated>2017-04-10T06:02:56+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-04-10T06:02:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=ee86de1f1a22c45548bc39916fcd2b72dd26ebca'/>
<id>urn:sha1:ee86de1f1a22c45548bc39916fcd2b72dd26ebca</id>
<content type='text'>
This buffer is used to allocate objects temporarily, and such objects
require that their underlying memory be correctly aligned for their data
type.  Aligning for mp_obj_t should be sufficient for emergency exceptions,
but in general the memory buffer should aligned to the maximum alignment of
the machine (eg on a 32-bit machine with mp_obj_t being 4 bytes, a double
may not be correctly aligned).

This patch fixes a bug for certain nan-boxing builds, where mp_obj_t is 8
bytes and must be aligned to 8 bytes (even though the machine is 32 bit).
</content>
</entry>
<entry>
<title>py: Remove MP_STATE_CTX, use MP_STATE_THREAD instead (it's an alias).</title>
<updated>2017-03-24T07:43:28+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-03-24T07:43:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=64a4f11b2d6f880aa6fb1aaa10b2603d3faa1cd0'/>
<id>urn:sha1:64a4f11b2d6f880aa6fb1aaa10b2603d3faa1cd0</id>
<content type='text'>
MP_STATE_CTX was recently aliased to MP_STATE_THREAD and can now be
removed.
</content>
</entry>
</feed>
