<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/showbc.c, branch master</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=master</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2019-10-08T02:16:11+00:00</updated>
<entry>
<title>mp_bytecode_print_str: avoid undefined behavior</title>
<updated>2019-10-08T02:16:11+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2019-10-08T01:48:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=85f0048d22a31f34d991e56757560f1b39c007b6'/>
<id>urn:sha1:85f0048d22a31f34d991e56757560f1b39c007b6</id>
<content type='text'>
Left shift of negative numbers is undefined in the "C" standard.  Multiplying
by 128 has the intended effect (in the absence of integer overflow, anyway),
can be implemented using the same shift instruction, but does not invoke
undefined behavior.

This problem was found using clang 7's scan-build static analyzer.
</content>
</entry>
<entry>
<title>py: Clean up unary and binary enum list to keep groups together.</title>
<updated>2017-10-04T23:49:44+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-10-03T12:34:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=0864a6957fe4717c3ec40ceeb373b19614a18434'/>
<id>urn:sha1:0864a6957fe4717c3ec40ceeb373b19614a18434</id>
<content type='text'>
2 non-bytecode binary ops (NOT_IN and IN_NOT) are moved out of the
bytecode group, so this change will change the bytecode format.
</content>
</entry>
<entry>
<title>py: Clarify which mp_unary_op_t's may appear in the bytecode.</title>
<updated>2017-09-25T23:35:19+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-09-25T23:35:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=9d836fedbdb1d28bdfc4ba475bbdfc1adb3f007a'/>
<id>urn:sha1:9d836fedbdb1d28bdfc4ba475bbdfc1adb3f007a</id>
<content type='text'>
Not all can, so we don't need to reserve bytecodes for them, and can
use free slots for something else later.
</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: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls.</title>
<updated>2017-04-22T13:39:20+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-04-18T23:45:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=dd11af209d226b7d18d5148b239662e30ed60bad'/>
<id>urn:sha1:dd11af209d226b7d18d5148b239662e30ed60bad</id>
<content type='text'>
This patch allows the following code to run without allocating on the heap:

    super().foo(...)

Before this patch such a call would allocate a super object on the heap and
then load the foo method and call it right away.  The super object is only
needed to perform the lookup of the method and not needed after that.  This
patch makes an optimisation to allocate the super object on the C stack and
discard it right after use.

Changes in code size due to this patch are:

   bare-arm: +128
    minimal: +232
   unix x64: +416
unix nanbox: +364
     stmhal: +184
    esp8266: +340
     cc3200: +128
</content>
</entry>
<entry>
<title>py: Allow bytecode/native to put iter_buf on stack for simple for loops.</title>
<updated>2017-02-16T07:38:06+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-01-09T23:59:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=f4df3aaa72a0460614b1ab8b7b8a7927a1165e31'/>
<id>urn:sha1:f4df3aaa72a0460614b1ab8b7b8a7927a1165e31</id>
<content type='text'>
So that the "for x in it: ..." statement can now work without using the
heap (so long as the iterator argument fits in an iter_buf structure).
</content>
</entry>
<entry>
<title>py/showbc: Make sure to set the const_table before printing bytecode.</title>
<updated>2017-01-27T01:34:09+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-01-27T01:34:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=cc4c1adf6e05dcda54393fe512e47463fc45414e'/>
<id>urn:sha1:cc4c1adf6e05dcda54393fe512e47463fc45414e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/showbc: Make printf's go to the platform print stream.</title>
<updated>2016-09-20T01:30:54+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-09-20T01:30:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=fbddea929d28fa75ecc4e964500eca3f2ac32e4b'/>
<id>urn:sha1:fbddea929d28fa75ecc4e964500eca3f2ac32e4b</id>
<content type='text'>
The system printf is no longer used by the core uPy code.  Instead, the
platform print stream or DEBUG_printf is used.  Using DEBUG_printf in the
showbc functions would mean that the code can't be tested by the test
suite, so use the normal output instead.

This patch also fixes parsing of bytecode-line-number mappings.
</content>
</entry>
<entry>
<title>py: Combine 3 comprehension opcodes (list/dict/set) into 1.</title>
<updated>2016-09-19T02:28:03+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-09-18T22:46:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=adaf0d865cd6c81fb352751566460506392ed55f'/>
<id>urn:sha1:adaf0d865cd6c81fb352751566460506392ed55f</id>
<content type='text'>
With the previous patch combining 3 emit functions into 1, it now makes
sense to also combine the corresponding VM opcodes, which is what this
patch does.  This eliminates 2 opcodes which simplifies the VM and reduces
code size, in bytes: bare-arm:44, minimal:64, unix(NDEBUG,x86-64):272,
stmhal:92, esp8266:200.  Profiling (with a simple script that creates many
list/dict/set comprehensions) shows no measurable change in performance.
</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>
</feed>
