<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/compile.c, branch v1.4.5</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.4.5</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.4.5'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2015-07-29T22:16:01+00:00</updated>
<entry>
<title>py/compile: Give more precise line number for compile errors.</title>
<updated>2015-07-29T22:16:01+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-07-29T22:16:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=cfc4c338015cb65a35228706c44485dd57ec238e'/>
<id>urn:sha1:cfc4c338015cb65a35228706c44485dd57ec238e</id>
<content type='text'>
Previous to this patch there were some cases where line numbers for
errors were 0 (unknown).  Now the compiler attempts to give a better
line number where possible, in some cases giving the line number of the
closest statement, and other cases the line number of the inner-most
scope of the error (eg the line number of the start of the function).
This helps to give good (and sometimes exact) line numbers for
ViperTypeError exceptions.

This patch also makes sure that the first compile error (eg SyntaxError)
that is encountered is reported (previously it was the last one that was
reported).
</content>
</entry>
<entry>
<title>py: For viper compile errors, add traceback with function and filename.</title>
<updated>2015-07-27T21:20:00+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-07-27T21:20:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=84d59c28738b8f84c0581de4f6bba01c1f1e40ef'/>
<id>urn:sha1:84d59c28738b8f84c0581de4f6bba01c1f1e40ef</id>
<content type='text'>
ViperTypeError now includes filename and function name where the error
occurred.  The line number is the line number of the start of the
function definition, which is the best that can be done without a lot
more work.

Partially addresses issue #1381.
</content>
</entry>
<entry>
<title>py: Remove mp_load_const_bytes and instead load precreated bytes object.</title>
<updated>2015-06-25T14:42:13+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-06-25T14:42:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=59fba2d6ea31c134c9c0b88dc73cd25b236f167c'/>
<id>urn:sha1:59fba2d6ea31c134c9c0b88dc73cd25b236f167c</id>
<content type='text'>
Previous to this patch each time a bytes object was referenced a new
instance (with the same data) was created.  With this patch a single
bytes object is created in the compiler and is loaded directly at execute
time as a true constant (similar to loading bignum and float objects).
This saves on allocating RAM and means that bytes objects can now be
used when the memory manager is locked (eg in interrupts).

The MP_BC_LOAD_CONST_BYTES bytecode was removed as part of this.

Generated bytecode is slightly larger due to storing a pointer to the
bytes object instead of the qstr identifier.

Code size is reduced by about 60 bytes on Thumb2 architectures.
</content>
</entry>
<entry>
<title>py: Make viper codegen raise proper exception (ViperTypeError) on error.</title>
<updated>2015-04-20T13:29:31+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-04-20T13:29:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c8b60f013b9d624a74ad502460f2bc7d00c39644'/>
<id>urn:sha1:c8b60f013b9d624a74ad502460f2bc7d00c39644</id>
<content type='text'>
This fixes a long standing problem that viper code generation gave
terrible error messages, and actually no errors on pyboard where
assertions are disabled.

Now all compile-time errors are raised as proper Python exceptions, and
are of type ViperTypeError.

Addresses issue #940.
</content>
</entry>
<entry>
<title>py: Remove old debugging printf's in compile.c.</title>
<updated>2015-04-11T20:52:27+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-04-11T20:52:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=55fe92bb8f26d93015f87ceff2ac657a135b8ee4'/>
<id>urn:sha1:55fe92bb8f26d93015f87ceff2ac657a135b8ee4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Provide typedefs for function types instead of writing them inline.</title>
<updated>2015-04-09T15:31:53+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-04-09T15:31:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=91bc32dc169560d0faf7cba177c3c9cd6b1f88b7'/>
<id>urn:sha1:91bc32dc169560d0faf7cba177c3c9cd6b1f88b7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Adjust some spaces in code style/format, purely for consistency.</title>
<updated>2015-04-09T15:29:54+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-04-09T15:29:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=4dea922610c8ea6af285cd49b0a531d4941d820f'/>
<id>urn:sha1:4dea922610c8ea6af285cd49b0a531d4941d820f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py, compiler: When just bytecode, make explicit calls instead of table.</title>
<updated>2015-03-26T16:52:45+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-03-26T16:44:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=4112590a602fa11b4d9a3df3ed5c55df56c0dc62'/>
<id>urn:sha1:4112590a602fa11b4d9a3df3ed5c55df56c0dc62</id>
<content type='text'>
When just the bytecode emitter is needed there is no need to have a
dynamic method table for the emitter back-end, and we can instead
directly call the mp_emit_bc_XXX functions.  This gives a significant
reduction in code size and a very slight performance boost for the
compiler.

This patch saves 1160 bytes code on Thumb2 and 972 bytes on x86, when
native emitters are disabled.

Overall savings in code over the last 3 commits are:

bare-arm: 1664 bytes.
minimal:  2136 bytes.
stmhal:    584 bytes (it has native emitter enabled).
cc3200:   1736 bytes.
</content>
</entry>
<entry>
<title>py, compiler: Remove emit_pass1 code, using emit_bc to do its job.</title>
<updated>2015-03-26T16:52:45+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-03-26T15:49:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=a210c774f9cfbcde284f5b8a63442b4d6da1ae5b'/>
<id>urn:sha1:a210c774f9cfbcde284f5b8a63442b4d6da1ae5b</id>
<content type='text'>
First pass for the compiler is computing the scope (eg if an identifier
is local or not) and originally had an entire table of methods dedicated
to this, most of which did nothing.  With changes from previous commit,
this set of methods can be removed and the methods from the bytecode
emitter used instead, with very little modification -- this is what is
done in this commit.

This factoring has little to no impact on the speed of the compiler
(tested by compiling 3763 Python scripts and timing it).

This factoring reduces code size by about 270-300 bytes on Thumb2 archs,
and 400 bytes on x86.
</content>
</entry>
<entry>
<title>py, compiler: Refactor load/store/delete_id logic to reduce code size.</title>
<updated>2015-03-26T16:52:45+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-03-26T14:42:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=542bd6b4a1ead90fde42f24d01c82580f9d048de'/>
<id>urn:sha1:542bd6b4a1ead90fde42f24d01c82580f9d048de</id>
<content type='text'>
Saves around 230 bytes on Thumb2 and 750 bytes on x86.
</content>
</entry>
</feed>
