| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The STATIC macro was introduced a very long time ago in commit
d5df6cd44a433d6253a61cb0f987835fbc06b2de. The original reason for this was
to have the option to define it to nothing so that all static functions
become global functions and therefore visible to certain debug tools, so
one could do function size comparison and other things.
This STATIC feature is rarely (if ever) used. And with the use of LTO and
heavy inline optimisation, analysing the size of individual functions when
they are not static is not a good representation of the size of code when
fully optimised.
So the macro does not have much use and it's simpler to just remove it.
Then you know exactly what it's doing. For example, newcomers don't have
to learn what the STATIC macro is and why it exists. Reading the code is
also less "loud" with a lowercase static.
One other minor point in favour of removing it, is that it stops bugs with
`STATIC inline`, which should always be `static inline`.
Methodology for this commit was:
1) git ls-files | egrep '\.[ch]$' | \
xargs sed -Ei "s/(^| )STATIC($| )/\1static\2/"
2) Do some manual cleanup in the diff by searching for the word STATIC in
comments and changing those back.
3) "git-grep STATIC docs/", manually fixed those cases.
4) "rg -t python STATIC", manually fixed codegen lines that used STATIC.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of being an explicit field, it's now a slot like all the other
methods.
This is a marginal code size improvement because most types have a make_new
(100/138 on PYBV11), however it improves consistency in how types are
declared, removing the special case for make_new.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changes:
MP_DEFINE_CONST_OBJ_TYPE(
...
#if FOO
...
#endif
...
);
to:
MP_DEFINE_CONST_OBJ_TYPE(
...
FOO_TYPE_ATTR
...
);
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
|
|
|
|
|
|
| |
In preparation for upcoming rework of mp_obj_type_t layout.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change in code size is:
bare-arm: -36 -0.062%
minimal x86: -92 -0.056%
unix x64: -72 -0.014%
unix nanbox: -276 -0.060%
stm32: +0 +0.000% PYBV10
stm32: -40 +0.021% NUCLEO_L073RZ
cc3200: -16 -0.009%
esp8266: +176 +0.025% GENERIC
esp32: -28 -0.002% GENERIC
mimxrt: -56 -0.016% TEENSY40
renesas-ra: +0 +0.000% RA6M2_EK
nrf: +0 +0.000% pca10040
rp2: -64 -0.013% PICO
samd: -32 -0.023% ADAFRUIT_ITSYBITSY_M4_EXPRESS
Ports like stm32 that build the VM with -O3 have no change because the
savings from the inlining are offset by additional gcc performance
optimisations in the VM.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This replaces occurences of
foo_t *foo = m_new_obj(foo_t);
foo->base.type = &foo_type;
with
foo_t *foo = mp_obj_malloc(foo_t, &foo_type);
Excludes any places where base is a sub-field or when new0/memset is used.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
|
|
|
|
| |
This is run with uncrustify 0.70.1, and black 19.10b0.
|
|
|
|
|
| |
There were several different spellings of MicroPython present in comments,
when there should be only one.
|
|
|
|
|
|
|
|
|
| |
This allows the mp_obj_t type to be configured to something other than a
pointer-sized primitive type.
This patch also includes additional changes to allow the code to compile
when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of
mp_uint_t, and various casts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previous to this patch the printing mechanism was a bit of a tangled
mess. This patch attempts to consolidate printing into one interface.
All (non-debug) printing now uses the mp_print* family of functions,
mainly mp_printf. All these functions take an mp_print_t structure as
their first argument, and this structure defines the printing backend
through the "print_strn" function of said structure.
Printing from the uPy core can reach the platform-defined print code via
two paths: either through mp_sys_stdout_obj (defined pert port) in
conjunction with mp_stream_write; or through the mp_plat_print structure
which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
on the platform. The former is only used when MICROPY_PY_IO is defined.
With this new scheme printing is generally more efficient (less layers
to go through, less arguments to pass), and, given an mp_print_t*
structure, one can call mp_print_str for efficiency instead of
mp_printf("%s", ...). Code size is also reduced by around 200 bytes on
Thumb2 archs.
|
| |
|
|
|
|
| |
See issue #699.
|
|
|
|
| |
Addresses issue #1022.
|
|
|
|
|
|
|
| |
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/.
|
|
|
|
|
| |
Well, it is bound to "detailed error reporting", but that's closest what we
have now without creating new entities.
|
|
|
|
| |
Specifically, nlr.h does.
|
| |
|
|
|
|
|
|
| |
Towards addressing issue #424.
Had a small increase to ROM usage (order 60 bytes).
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Ultimately all static strings should be qstr. This entry in the type
structure is only used for printing error messages (to tell the type of
the bad argument), and printing objects that don't supply a .print method.
|
|
|
|
|
| |
Can now have null bytes in strings. Can define ROM qstrs per port using
qstrdefsport.h
|
|\
| |
| |
| |
| |
| |
| | |
ian-v-cplusplus
Conflicts:
py/objcomplex.c
|
|/ |
|
| |
|
|
|
|
| |
Now much more inline with how CPython does types.
|
|
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).
|