<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/mpstate.h, branch 4.0.0-beta.7</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=4.0.0-beta.7</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=4.0.0-beta.7'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2019-04-08T23:58:50+00:00</updated>
<entry>
<title>Reorganize board busses into shared-bindings and shared-module.</title>
<updated>2019-04-08T23:58:50+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2019-04-08T23:58:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=0f003ac5b8312fafb120e86e05eefd2431014d8c'/>
<id>urn:sha1:0f003ac5b8312fafb120e86e05eefd2431014d8c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>compiles and runs; hangs on import storage;storage.VfsFat.&lt;tab&gt;</title>
<updated>2018-07-14T02:51:10+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2018-07-14T02:51:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=e2e01efa84d2ed46d004edf48076e4701accc176'/>
<id>urn:sha1:e2e01efa84d2ed46d004edf48076e4701accc176</id>
<content type='text'>
</content>
</entry>
<entry>
<title>WIP: after merge; before testing</title>
<updated>2018-07-11T20:45:30+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2018-07-11T20:45:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7c219600a246d8956d0b23ea3f5d125a820e6b6a'/>
<id>urn:sha1:7c219600a246d8956d0b23ea3f5d125a820e6b6a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>extmod/uos_dupterm: Use native C stream methods on dupterm object.</title>
<updated>2018-06-12T05:06:11+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-06-12T05:06:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=035906419d925bf723dba21f9fbb22ca1c8021f1'/>
<id>urn:sha1:035906419d925bf723dba21f9fbb22ca1c8021f1</id>
<content type='text'>
This patch changes dupterm to call the native C stream methods on the
connected stream objects, instead of calling the Python readinto/write
methods.  This is much more efficient for native stream objects like UART
and webrepl and doesn't require allocating a special dupterm array.

This change is a minor breaking change from the user's perspective because
dupterm no longer accepts pure user stream objects to duplicate on.  But
with the recent addition of uio.IOBase it is possible to still create such
classes just by inheriting from uio.IOBase, for example:

    import uio, uos

    class MyStream(uio.IOBase):
        def write(self, buf):
            # existing write implementation
        def readinto(self, buf):
            # existing readinto implementation

    uos.dupterm(MyStream())
</content>
</entry>
<entry>
<title>Initial implementation of supervisor.reload()</title>
<updated>2018-05-14T20:57:50+00:00</updated>
<author>
<name>Roy Hooper</name>
<email>rhooper@toybox.ca</email>
</author>
<published>2018-05-14T20:57:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=567f3e30a77f286713b697a0f8a85e8b31a4a27a'/>
<id>urn:sha1:567f3e30a77f286713b697a0f8a85e8b31a4a27a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/mpstate.h: Adjust start of root pointer section to exclude non-ptrs.</title>
<updated>2018-05-13T12:53:28+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-12T12:09:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=749b16174b5292b2680ab027a6a1b3874e22ea43'/>
<id>urn:sha1:749b16174b5292b2680ab027a6a1b3874e22ea43</id>
<content type='text'>
This patch moves the start of the root pointer section in mp_state_ctx_t
so that it skips entries that are not pointers and don't need scanning.

Previously, the start of the root pointer section was at the very beginning
of the mp_state_ctx_t struct (which is the beginning of mp_state_thread_t).
This was the original assembler version of the NLR code was hard-coded to
have the nlr_top pointer at the start of this state structure.  But now
that the NLR code is partially written in C there is no longer this
restriction on the location of nlr_top (and a comment to this effect has
been removed in this patch).

So now the root pointer section starts part way through the
mp_state_thread_t structure, after the entries which are not root pointers.

This patch also moves the non-pointer entries for MICROPY_ENABLE_SCHEDULER
outside the root pointer section.

Moving non-pointer entries out of the root pointer section helps to make
the GC more precise and should help to prevent some cases of collectable
garbage being kept.

This patch also has a measurable improvement in performance of the
pystone.py benchmark: on unix x86-64 and stm32 there was an improvement of
roughly 0.6% (tested with both gcc 7.3 and gcc 8.1).
</content>
</entry>
<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>Introduce a long lived section of the heap.</title>
<updated>2018-01-24T18:33:46+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott.shawcroft@gmail.com</email>
</author>
<published>2018-01-24T00:22:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=416abe33ed44e44d8f75342731080217e123278b'/>
<id>urn:sha1:416abe33ed44e44d8f75342731080217e123278b</id>
<content type='text'>
This adapts the allocation process to start from either end of the heap
when searching for free space. The default behavior is identical to the
existing behavior where it starts with the lowest block and looks higher.
Now it can also look from the highest block and lower depending on the
long_lived parameter to gc_alloc. As the heap fills, the two sections may
overlap. When they overlap, a collect may be triggered in order to keep
the long lived section compact. However, free space is always eligable
for each type of allocation.

By starting from either of the end of the heap we have ability to separate
short lived objects from long lived ones. This separation reduces heap
fragmentation because long lived objects are easy to densely pack.

Most objects are short lived initially but may be made long lived when
they are referenced by a type or module. This involves copying the
memory and then letting the collect phase free the old portion.

QSTR pools and chunks are always long lived because they are never freed.

The reallocation, collection and free processes are largely unchanged. They
simply also maintain an index to the highest free block as well as the lowest.
These indices are used to speed up the allocation search until the next collect.

In practice, this change may slightly slow down import statements with the
benefit that memory is much less fragmented afterwards. For example, a test
import into a 20k heap that leaves ~6k free previously had the largest
continuous free space of ~400 bytes. After this change, the largest continuous
free space is over 3400 bytes.
</content>
</entry>
</feed>
