| Commit message (Collapse) | Author | Age |
|
|
|
|
| |
Otherwise some compilers (eg without optimisation) will put this read-only
data in RAM instead of ROM.
|
|
|
|
|
|
|
|
| |
They are sugar for marking function as generator, "yield from"
and pep492 python "semantically equivalents" respectively.
@dpgeorge was the original author of this patch, but @pohmelie made
changes to implement `async for` and `async with`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This new compile-time option allows to make the bytecode compiler
configurable at runtime by setting the fields in the mp_dynamic_compiler
structure. By using this feature, the compiler can generate bytecode
that targets any MicroPython runtime/VM, regardless of the host and
target compile-time settings.
Options so far that fall under this dynamic setting are:
- maximum number of bits that a small int can hold;
- whether caching of lookups is used in the bytecode;
- whether to use unicode strings or not (lexer behaviour differs, and
therefore generated string constants differ).
|
|
|
|
|
|
|
|
|
|
|
|
| |
MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler,
which is useful when only loading of pre-compiled bytecode is supported.
It is enabled by default.
MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin
functions. By default they are only included if MICROPY_ENABLE_COMPILER
is enabled.
Disabling both options saves about 40k of code size on 32-bit x86.
|
|
|
|
| |
Eg 0e0 almost looks like a hex number but in fact is a float.
|
| |
|
| |
|
|
|
|
| |
Addresses issue #1390.
|
|
|
|
| |
This allows stmhal to be compiled with MICROPY_DEBUG_PRINTERS.
|
|
|
|
| |
Enabled simply by making the identifier lexing code 8-bit clean.
|
|
|
|
| |
This also pulls out hex_digit from py/lexer.c and makes unichar_hex_digit
|
| |
|
|
|
|
|
|
|
|
|
| |
Previous to this patch, a big-int, float or imag constant was interned
(made into a qstr) and then parsed at runtime to create an object each
time it was needed. This is wasteful in RAM and not efficient. Now,
these constants are parsed straight away in the parser and turned into
objects. This allows constants with large numbers of digits (so
addresses issue #1103) and takes us a step closer to #722.
|
|
|
|
|
| |
Only noticeable difference is how newlines are encoded in triple-quoted
strings. The behaviour now matches CPython3.
|
| |
|
|
|
|
| |
See issue #699.
|
|
|
|
|
|
| |
This patch consolidates all global variables in py/ core into one place,
in a global structure. Root pointers are all located together to make
GC tracing easier and more efficient.
|
|
|
|
| |
Addresses issue #1022.
|
| |
|
|
|
|
|
|
|
|
|
| |
mp_lexer_t type is exposed, mp_token_t type is removed, and simple lexer
functions (like checking current token kind) are now inlined.
This saves 784 bytes ROM on 32-bit unix, 348 bytes on stmhal, and 460
bytes on bare-arm. It also saves a tiny bit of RAM since mp_lexer_t
is a bit smaller. Also will run a bit more efficiently.
|
| |
|
|
|
|
| |
Lexer is now 8-bit clean inside strings.
|
| |
|
| |
|
|
|
|
|
|
| |
It defines types used by all other headers.
Fixes #691.
|
| |
|
|
|
|
|
| |
We still have that char vs byte dichotomy, but majority of string operations
now use byte.
|
|
|
|
|
| |
This allows to have multiple "optimization" levels (CPython has two
(-OO removes docstrings), we can have more).
|
| |
|
|
|
|
|
|
|
|
|
|
| |
MP_ALLOC_* -> MICROPY_ALLOC_*
MICROPY_PATH_MAX -> MICROPY_ALLOC_PATH_MAX
MICROPY_ENABLE_REPL_HELPERS -> MICROPY_HELPER_REPL
MICROPY_ENABLE_LEXER_UNIX -> MICROPY_HELPER_LEXER_UNIX
MICROPY_EXTRA_* -> MICROPY_PORT_*
See issue #35.
|
|
|
|
|
|
|
|
|
| |
__debug__ now resolves to True or False. Its value needs to be set by
mp_set_debug().
TODO: call mp_set_debug in unix/ port.
TODO: optimise away "if False:" statements in compiler.
|
| |
|
|
|
|
|
|
|
| |
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/.
|
| |
|
| |
|
|
|
|
| |
Remove unnecessary includes. Add includes that improve portability.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Each built-in exception is now a type, with base type BaseException.
C exceptions are created by passing a pointer to the exception type to
make an instance of. When raising an exception from the VM, an
instance is created automatically if an exception type is raised (as
opposed to an exception instance).
Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper.
Handling of parse error changed to match new exceptions.
mp_const_type renamed to mp_type_type for consistency.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Can now have null bytes in strings. Can define ROM qstrs per port using
qstrdefsport.h
|
|
|
|
|
| |
Byte code has a map from byte-code offset to source-code line number,
used to give better error messages.
|
|
|
|
|
| |
Parser no longer prints an error, but instead returns an exception ID
and message.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
vstr is initially intended to deal with arbitrary-length strings. By
providing a bit lower-level API calls, it will be also useful to deal
with arbitrary-length I/O buffers (the difference from strings is that
buffers are filled from "outside", via I/O).
Another issue, especially aggravated by I/O buffer use, is alloc size
vs actual size length. If allocated 1Mb for buffer, but actually
read 1 byte, we don't want to keep rest of 1Mb be locked by this I/O
result, but rather return it to heap ASAP ("shrink" buffer before passing
it to qstr_from_str_take()).
|
| |
|
| |
|
| |
|