<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/vm.c, branch 4.0.0-alpha.3</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-alpha.3</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=4.0.0-alpha.3'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2018-08-25T11:14:58+00:00</updated>
<entry>
<title>Revert "py/vm: Improve performance of opcode dispatch when using switch stmt."</title>
<updated>2018-08-25T11:14:58+00:00</updated>
<author>
<name>Noralf Trønnes</name>
<email>noralf@tronnes.org</email>
</author>
<published>2018-08-25T11:14:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=2d1fecc80430618ff295498c421064be28796822'/>
<id>urn:sha1:2d1fecc80430618ff295498c421064be28796822</id>
<content type='text'>
This reverts commit 869024dd6e62905b7e1069b547856a769b3b24ba.

Ctrl-C stopped producing KeyboardInterrupt with this change on CircuitPython.

The Unix and stm32 ports handles Ctrl-C differently with a handler which is
probably why they where not affected.

Fixes #1092
</content>
</entry>
<entry>
<title>Compress all translated strings with Huffman coding.</title>
<updated>2018-08-17T00:40:57+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2018-08-16T01:32:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=de5a9d72dcdaacdd5048195cd5bab007f4b2baef'/>
<id>urn:sha1:de5a9d72dcdaacdd5048195cd5bab007f4b2baef</id>
<content type='text'>
This saves code space in builds which use link-time optimization.
The optimization drops the untranslated strings and replaces them
with a compressed_string_t struct. It can then be decompressed to
a c string.

Builds without LTO work as well but include both untranslated
strings and compressed strings.

This work could be expanded to include QSTRs and loaded strings if
a compress method is added to C. Its tracked in #531.
</content>
</entry>
<entry>
<title>py/objtype: Don't expose mp_obj_instance_attr().</title>
<updated>2018-06-08T01:48:25+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-25T07:08:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=bace1a16d056cc755f12f525b9f2bfb3cb4b4b50'/>
<id>urn:sha1:bace1a16d056cc755f12f525b9f2bfb3cb4b4b50</id>
<content type='text'>
mp_obj_is_instance_type() can be used instead to check for instance types.
</content>
</entry>
<entry>
<title>py/vm: Improve performance of opcode dispatch when using switch stmt.</title>
<updated>2018-05-18T01:47:03+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-18T01:47:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=869024dd6e62905b7e1069b547856a769b3b24ba'/>
<id>urn:sha1:869024dd6e62905b7e1069b547856a769b3b24ba</id>
<content type='text'>
Before this patch, when using the switch statement for dispatch in the VM
(not computed goto) a pending exception check was done after each opcode.
This is not necessary and this patch makes the pending exception check only
happen when explicitly requested by certain opcodes, like jump.  This
improves performance of the VM by about 2.5% when using the switch.
</content>
</entry>
<entry>
<title>py/vm: Use enum names instead of magic numbers in multi-opcode dispatch.</title>
<updated>2018-05-18T01:44:26+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-18T01:44:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=46ce395130305ce3299ae0dfd42502d29837c39f'/>
<id>urn:sha1:46ce395130305ce3299ae0dfd42502d29837c39f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/vm: Adjust #if logic for gil_divisor so braces are balanced.</title>
<updated>2018-05-16T02:33:39+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-16T02:33:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=1b7487e519c2e2a66f2f5a45ebd238d0773ca3d3'/>
<id>urn:sha1:1b7487e519c2e2a66f2f5a45ebd238d0773ca3d3</id>
<content type='text'>
Having balanced braces { and } makes it easier to navigate the function.
</content>
</entry>
<entry>
<title>py/vm: Optimise handling of stackless mode when pystack is enabled.</title>
<updated>2018-04-03T14:51:10+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-04-03T14:51:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=bc36521386a2c608be06fa8a5bf110b050dd1052'/>
<id>urn:sha1:bc36521386a2c608be06fa8a5bf110b050dd1052</id>
<content type='text'>
When pystack is enabled mp_obj_fun_bc_prepare_codestate() will always
return a valid pointer, and if there is no more pystack available then it
will raise an exception (a RuntimeError).  So having pystack enabled with
stackless enabled automatically gives strict stackless mode.  There is
therefore no need to have code for strict stackless mode when pystack is
enabled, and this patch optimises the VM for such a case.
</content>
</entry>
<entry>
<title>py/vm: Don't do unnecessary updates of ip and sp variables.</title>
<updated>2018-04-03T14:46:31+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-04-03T14:46:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c7f880eda38783817bd490b8f2f0b60412c3b73c'/>
<id>urn:sha1:c7f880eda38783817bd490b8f2f0b60412c3b73c</id>
<content type='text'>
Neither the ip nor sp variables are used again after the execution of the
RAISE_VARARGS opcode, so they don't need to be updated.
</content>
</entry>
<entry>
<title>py/vm: Simplify handling of special-case STOP_ITERATION in yield from.</title>
<updated>2018-02-27T04:48:09+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-02-27T04:48:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=a9f6d4921829195d7310aa8b07a4a705577161a5'/>
<id>urn:sha1:a9f6d4921829195d7310aa8b07a4a705577161a5</id>
<content type='text'>
There's no need to have MP_OBJ_NULL a special case, the code can re-use
the MP_OBJ_STOP_ITERATION value to signal the special case and the VM can
detect this with only one check (for MP_OBJ_STOP_ITERATION).
</content>
</entry>
<entry>
<title>py/vm: Fix case of handling raised StopIteration within yield from.</title>
<updated>2018-02-27T04:39:31+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-02-27T04:39:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=22ade2f5c4ac88c90a013cbf4b81c8d795487f33'/>
<id>urn:sha1:22ade2f5c4ac88c90a013cbf4b81c8d795487f33</id>
<content type='text'>
This patch concerns the handling of an NLR-raised StopIteration, raised
during a call to mp_resume() which is handling the yield from opcode.

Previously, commit 6738c1dded8e436686f85008ec0a4fc47406ab7a introduced code
to handle this case, along with a test.  It seems that it was lucky that
the test worked because the code did not correctly handle the stack pointer
(sp).

Furthermore, commit 79d996a57b351e0ef354eb1e2f644b194433cc73 improved the
way mp_resume() propagated certain exceptions: it changed raising an NLR
value to returning MP_VM_RETURN_EXCEPTION.  This change meant that the
test introduced in gen_yield_from_ducktype.py was no longer hitting the
code introduced in 6738c1dded8e436686f85008ec0a4fc47406ab7a.

The patch here does two things:

1. Fixes the handling of sp in the VM for the case that yield from is
   interrupted by a StopIteration raised via NLR.

2. Introduces a new test to check this handling of sp and re-covers the
   code in the VM.
</content>
</entry>
</feed>
