<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/vm.c, branch cross</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=cross</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=cross'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2016-06-28T10:28:50+00:00</updated>
<entry>
<title>py: Implement a simple global interpreter lock.</title>
<updated>2016-06-28T10:28:50+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-05-26T10:42:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=4cec63a9dbed86c4332b9e7fcd56d092046193e4'/>
<id>urn:sha1:4cec63a9dbed86c4332b9e7fcd56d092046193e4</id>
<content type='text'>
This makes the VM/runtime thread safe, at the cost of not being able to
run code in parallel.
</content>
</entry>
<entry>
<title>py/vm: "yield from" didn't handle MP_OBJ_STOP_ITERATION optimization.</title>
<updated>2016-04-27T23:08:43+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-04-27T22:54:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=eff85bb1dcca0602cef055986ea3b8192dea1d71'/>
<id>urn:sha1:eff85bb1dcca0602cef055986ea3b8192dea1d71</id>
<content type='text'>
E.g. crashed when yielding from already stopped generators.
</content>
</entry>
<entry>
<title>py/vm: Add macros to hook into various points in the VM.</title>
<updated>2016-02-17T09:02:19+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-02-15T22:46:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=40d8430ee3f62d48482439c080f3a058bcc7fd64'/>
<id>urn:sha1:40d8430ee3f62d48482439c080f3a058bcc7fd64</id>
<content type='text'>
These can be used to insert arbitrary checks, polling, etc into the VM.
They are left general because the VM is a highly tuned loop and it should
be up to a given port how that port wants to modify the VM internals.

One common use would be to insert a polling check, but only done after
a certain number of opcodes were executed, so as not to slow down the VM
too much.  For example:

 #define MICROPY_VM_HOOK_COUNT (30)
 #define MICROPY_VM_HOOK_INIT static uint vm_hook_divisor = MICROPY_VM_HOOK_COUNT
 #define MICROPY_VM_HOOK_POLL if (--vm_hook_divisor == 0) { \
     vm_hook_divisor = MICROPY_VM_HOOK_COUNT;
     extern void vm_hook_function(void);
     vm_hook_function();
 }
 #define MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_POLL
 #define MICROPY_VM_HOOK_RETURN MICROPY_VM_HOOK_POLL
</content>
</entry>
<entry>
<title>py/vm: Fix popping of exception block in UNWIND_JUMP opcode.</title>
<updated>2016-02-01T16:07:21+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-02-01T16:07:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=93bb7dffd2a655dd8522114ed014077fb6b7ada7'/>
<id>urn:sha1:93bb7dffd2a655dd8522114ed014077fb6b7ada7</id>
<content type='text'>
Fixes issue #1812.
</content>
</entry>
<entry>
<title>py: Change exception traceback data to use size_t instead of mp_uint_t.</title>
<updated>2016-01-02T22:04:12+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-01-02T22:04:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=3d2daa2d03e300ac64005b8659c31f04a0f7fd53'/>
<id>urn:sha1:3d2daa2d03e300ac64005b8659c31f04a0f7fd53</id>
<content type='text'>
The traceback array stores qstrs and line numbers.  qstrs are typed as
size_t, and line numbers should safely fit in size_t as well.
</content>
</entry>
<entry>
<title>py: Handle case of return within the finally block of try-finally.</title>
<updated>2015-12-24T12:47:39+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-12-24T12:47:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=8047340d7532ec32bc9f2d603bffc0bc9544297f'/>
<id>urn:sha1:8047340d7532ec32bc9f2d603bffc0bc9544297f</id>
<content type='text'>
Addresses issue #1636.
</content>
</entry>
<entry>
<title>py: Fix MICROPY_STACKLESS mode to compile with MICROPY_OBJ_REPR_D.</title>
<updated>2015-12-17T12:32:41+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-12-17T12:32:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7a30e87d2b8c14dadf5021a03740c4ca48178f53'/>
<id>urn:sha1:7a30e87d2b8c14dadf5021a03740c4ca48178f53</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Make UNARY_OP_NOT a first-class op, to agree with Py not semantics.</title>
<updated>2015-12-10T22:19:48+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-12-08T12:28:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=bdbe8c9ae21559f6dc0b8e1ad84b7bbec2a04726'/>
<id>urn:sha1:bdbe8c9ae21559f6dc0b8e1ad84b7bbec2a04726</id>
<content type='text'>
Fixes #1684 and makes "not" match Python semantics.  The code is also
simplified (the separate MP_BC_NOT opcode is removed) and the patch saves
68 bytes for bare-arm/ and 52 bytes for minimal/.

Previously "not x" was implemented as !mp_unary_op(x, MP_UNARY_OP_BOOL),
so any given object only needs to implement MP_UNARY_OP_BOOL (and the VM
had a special opcode to do the ! bit).

With this patch "not x" is implemented as mp_unary_op(x, MP_UNARY_OP_NOT),
but this operation is caught at the start of mp_unary_op and dispatched as
!mp_obj_is_true(x).  mp_obj_is_true has special logic to test for
truthness, and is the correct way to handle the not operation.
</content>
</entry>
<entry>
<title>py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.</title>
<updated>2015-11-29T14:25:35+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-11-27T17:01:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=999cedb90ff0827cdb9dfe0e4faa6ebc1739d271'/>
<id>urn:sha1:999cedb90ff0827cdb9dfe0e4faa6ebc1739d271</id>
<content type='text'>
This allows the mp_obj_t type to be configured to something other than a
pointer-sized primitive type.

This patch also includes additional changes to allow the code to compile
when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of
mp_uint_t, and various casts.
</content>
</entry>
<entry>
<title>py: Add MICROPY_PERSISTENT_CODE so code can persist beyond the runtime.</title>
<updated>2015-11-13T12:49:18+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-11-02T17:27:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c8e9c0d89afa90694790fd48e1bf527487a5beb7'/>
<id>urn:sha1:c8e9c0d89afa90694790fd48e1bf527487a5beb7</id>
<content type='text'>
Main changes when MICROPY_PERSISTENT_CODE is enabled are:

- qstrs are encoded as 2-byte fixed width in the bytecode
- all pointers are removed from bytecode and put in const_table (this
  includes const objects and raw code pointers)

Ultimately this option will enable persistence for not just bytecode but
also native code.
</content>
</entry>
</feed>
