Commit Graph

74 Commits

Author SHA1 Message Date
Damien George
04b9147e15 Add license header to (almost) all files.
Blanket wide to all .c and .h files.  Some files originating from ST are
difficult to deal with (license wise) so it was left out of those.

Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-05-03 23:27:38 +01:00
Damien George
2827d62e8b py: Implement keyword-only args.
Implements 'def f(*, a)' and 'def f(*a, b)', but not default
keyword-only args, eg 'def f(*, a=1)'.

Partially addresses issue #524.
2014-04-27 15:50:52 +01:00
Damien George
6d3c5e4301 Add ARRAY_SIZE macro, and use it where possible. 2014-04-26 10:47:29 +01:00
Damien George
e5f8a77db6 py: Add 'align' and 'data' meta-instructions to inline assembler. 2014-04-21 13:33:15 +01:00
Damien George
90edf9e13b inlinethumb: Add wfi, cpsid and cpsie instructions. 2014-04-18 16:56:54 +01:00
Damien George
df8127a17e py: Remove unique_codes from emitglue.c. Replace with pointers.
Attempt to address issue #386.  unique_code_id's have been removed and
replaced with a pointer to the "raw code" information.  This pointer is
stored in the actual byte code (aligned, so the GC can trace it), so
that raw code (ie byte code, native code and inline assembler) is kept
only for as long as it is needed.  In memory it's now like a tree: the
outer module's byte code points directly to its children's raw code.  So
when the outer code gets freed, if there are no remaining functions that
need the raw code, then the children's code gets freed as well.

This is pretty much like CPython does it, except that CPython stores
indexes in the byte code rather than machine pointers.  These indices
index the per-function constant table in order to find the relevant
code.
2014-04-13 11:04:33 +01:00
Damien George
8721087661 py: Big improvements to inline assembler.
Improved the Thumb assembler back end.  Added many more Thumb
instructions to the inline assembler.  Improved parsing of assembler
instructions and arguments.  Assembler functions can now be passed the
address of any object that supports the buffer protocol (to get the
address of the buffer).  Added an example of how to sum numbers from
an array in assembler.
2014-04-13 00:30:32 +01:00
Damien George
a26dc50968 py: Improve inline assembler; improve compiler constant folding. 2014-04-12 17:54:52 +01:00
Damien George
6f355fd3b9 py: Make labels unsigned ints (converted from int).
Labels should never be negative, and this modified type signature
reflects that.
2014-04-10 14:11:31 +01:00
Damien George
47e1b85d9c py: Improve inline assembler; add a few more opcodes. 2014-04-08 18:28:33 +01:00
Damien George
2326d52d20 py: Factor out code from runtime.c to emitglue.c. 2014-03-27 23:26:35 +00:00
xbe
efe3422394 py: Clean up includes.
Remove unnecessary includes. Add includes that improve portability.
2014-03-17 02:43:40 -07:00
Paul Sokolovsky
56e5ef203b parse: Refactor parse node encoding to support full range of small ints.
Based on suggestion by @dpgeorge at
https://github.com/micropython/micropython/pull/313
2014-02-22 16:39:45 +02:00
Paul Sokolovsky
520e2f58a5 Replace global "static" -> "STATIC", to allow "analysis builds". Part 2. 2014-02-12 18:31:30 +02:00
Damien George
41d02b654e py: Improve freeing of emitters in mp_compile.
There can be multiple emitters allocated during compile (eg byte code
and native).
2014-01-24 22:42:28 +00:00
Damien George
55baff4c9b Revamp qstrs: they now include length and hash.
Can now have null bytes in strings.  Can define ROM qstrs per port using
qstrdefsport.h
2014-01-21 21:40:13 +00:00
Damien
d99b05282d Change object representation from 1 big union to individual structs.
A big change.  Micro Python objects are allocated as individual structs
with the first element being a pointer to the type information (which
is itself an object).  This scheme follows CPython.  Much more flexible,
not necessarily slower, uses same heap memory, and can allocate objects
statically.

Also change name prefix, from py_ to mp_ (mp for Micro Python).
2013-12-21 18:17:45 +00:00
Damien
1a6633a74d Implement more thumb branch instructions. 2013-11-03 13:58:19 +00:00
Damien
3ef4abb446 Change ifdef/if defined to simple if's. 2013-10-12 16:53:13 +01:00
Damien
c025ebb2dc Separate out mpy core and unix version. 2013-10-12 14:30:21 +01:00
Damien
dc83382903 Make runtime able to call inline asm with 1 argument. 2013-10-06 01:01:01 +01:00
Damien
03d4124320 Add b_n opcode to inline thumb asm. 2013-10-06 00:36:05 +01:00
Damien
a2f2f7db1f Almost supports arguments for inline asm functions. 2013-10-06 00:14:13 +01:00
Damien
826005c60b Add support for inline thumb assembly. 2013-10-05 23:17:28 +01:00