Commit Graph

25 Commits

Author SHA1 Message Date
Scott Shawcroft b4dcbb79b2
Add back printing out code info. Whoops! 2018-10-18 14:23:17 -07:00
Scott Shawcroft 4f9c8b7361
Add debug info to the generated frozen_mpy.c
It adds size info and uses macros for byte code to make it more
readable.
2018-10-17 17:45:47 -07:00
Scott Shawcroft 933add6cd8
Support internationalisation. 2018-08-07 14:58:57 -07:00
Damien George 9ba3de6ea1 tools/mpy-tool.py: Implement freezing of Ellipsis const object. 2017-11-15 12:46:08 +11:00
Damien George 933eab46fc py/bc: Update opcode_format_table to match the bytecode. 2017-10-10 10:37:38 +11:00
Damien George ff93fd4f50 py/persistentcode: Bump .mpy version number to version 3.
The binary and unary ops have changed bytecode encoding.
2017-10-05 10:49:44 +11:00
stijn e4ab404780 tools/mpy-tool.py: Fix missing argument in dump() function
This makes the -d commandline argument usable again.
Pass empty string as parent name as listing starts from the root.
2017-08-16 10:38:19 +02:00
Damien George b6a3289564 tools/mpy-tool.py: Don't generate const_table if it's empty. 2017-08-12 22:26:18 +10:00
Damien George 88c51c3592 tools/mpy-tool.py: Fix regression with freezing floats in obj repr C.
Regression was introduced by ec534609f6
2017-05-16 18:53:02 +10:00
Damien George ec534609f6 tools/mpy-tool.py: Use MP_ROM_xxx macros to support nanbox builds. 2017-05-13 10:08:13 +10:00
Paul Sokolovsky 473e85e2da tools/mpy-tool: Make work if run from another directory.
By making sure we don't add relative paths to sys.path.
2017-05-01 00:01:30 +03:00
Damien George dd11af209d py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls.
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
2017-04-22 23:39:20 +10:00
Damien George 6a11048af1 py/persistentcode: Bump .mpy version due to change in bytecode. 2017-02-17 00:19:34 +11:00
Damien George 98458a46ec tools/mpy-tool.py: Add support for OPT_CACHE_MAP_LOOKUP_IN_BYTECODE.
With caching of map lookups in the bytecode, frozen bytecode can still
work but must be stored in RAM, not ROM.  This patch allows mpy-tool.py to
generate code that works with this optimisation, but it's not recommended
to use it on embedded targets (because of lack of RAM).
2017-01-05 15:52:52 +11:00
Damien George 7df9291b6c py: Update opcode format table because 3 opcodes were removed, 1 added.
LIST_APPEND, MAP_ADD and SET_ADD have been removed, and STORE_COMP has
been added in adaf0d865c.
2016-09-23 12:48:57 +10:00
Damien George c51c883cc8 tools/mpy-tool.py: Support freezing of complex numbers. 2016-09-03 00:19:02 +10:00
Damien George b6bdf18deb tools/mpy-tool.py: Compute the hash value for str/bytes objects.
This makes it more efficient at runtime to hash str/bytes objects.
2016-09-02 15:10:45 +10:00
Damien George b4790afdaf tools/mpy-tool.py: Store qstr config values in global config object.
Makes it easier to access them without passing around another dict of the
config values.
2016-09-02 15:09:21 +10:00
Damien George 72ae3c72c7 tools/mpy-tool.py: Support freezing float literals with obj-repr C.
The tool now generates code for freezing floats in obj-repr A, B or C,
with the specific representation detected at compile time using macros.
2016-08-10 13:26:11 +10:00
Damien George 25a42fb6ef tools/mpy-tool.py: Don't strip directories from the frozen source name.
Directories are now supported by the frozen import system (to implement
frozen packages) so we should keep them.
2016-05-23 13:29:03 +01:00
Damien George 9b4c013823 tools/mpy-tool.py: Include .py extension in frozen filename.
So that it can be correctly stat'd when looking for frozen files.
2016-05-23 12:46:02 +01:00
Damien George 99b4719357 tools/mpy-tool.py: Add checks for critical configuration vars.
When an mpy file is frozen it must know the values of certain
configuration variables.  This patch provides an explicit check in the
generated C file that the configuration variables are what they are
supposed to be.
2016-05-16 23:13:30 +01:00
Damien George 02fd83bcbc tools/mpy-tool: Make sure that all C-level variables are unique.
Fixes issue #2023.
2016-05-03 12:24:39 +01:00
Damien George c3beb16db3 tools/mpy-tool.py: Add support for Python 2.7. 2016-04-15 11:56:10 +01:00
Damien George 0699c6bf9e tools: Add mpy-tool.py, to work with .mpy files.
Currently it can freeze .mpy files.
2016-04-13 16:05:43 +01:00