| Age | Commit message (Collapse) | Author |
|
On x64, native emitter now passes 70 of the tests.
|
|
Based on the discussion in #433. mp_load_attr() is critical-path function,
so any extra check will slowdown any script. As supporting default val
required only for getattr() builtin, move correspending implementation
there (still as a separate function due to concerns of maintainability
of such almost-duplicated code instances).
|
|
Finishes addressing issue #424.
In the end this was a very neat refactor that now makes things a lot
more consistent across the py code base. It allowed some
simplifications in certain places, now that everything is a dict object.
Also converted builtins tables to dictionaries. This will be useful
when we need to turn builtins into a proper module.
|
|
Towards addressing issue #424.
Had a small increase to ROM usage (order 60 bytes).
|
|
This does not affect code size or performance when debugging turned off.
To address issue #420.
|
|
py: Support 3-arg getattr() builtin (with default value).
|
|
|
|
|
|
That's how CPython has it, in particular, "import __main__" should work.
|
|
|
|
Previous overflow test was inadequate.
|
|
A malloc/realloc fail now throws MemoryError.
|
|
|
|
|
|
It's not completely satisfactory, because a failed call to __getattr__
should not raise an exception.
__setattr__ could be implemented, but it would slow down all stores to a
user created object. Need to implement some caching system.
|
|
Because it's superfluos in the presence of type(), a remenant from Python's
"old classes".
|
|
|
|
|
|
There was thinkos that either send_value or throw_value is specified, but
there were cases with both. Note that send_value is pushed onto generator's
stack - but that's probably only good, because if we throw exception into
gen, it should not ever use send_value, and that will be just extra "assert".
|
|
In this case, the exception is just re-thrown - the ideas is that object
doesn't handle this exception specially, so it will propagated per Python
semantics.
|
|
|
|
Adding this bytecode allows to remove 4 others related to
function/method calls with * and ** support. Will also help with
bytecodes that make functions/closures with default positional and
keyword args.
|
|
"1/0" is sacred idiom, the shortest way to break program execution
(sys.exit() is too long).
|
|
Iterators and ducktype objects can now be arguments of yield from.
|
|
Extends previous implementation with * for function calls to * and **
for both function and method calls.
|
|
Pretty much everyone needs to include map.h, since it's such an integral
part of the Micro Python object implementation. Thus, the definitions
are now in obj.h instead. map.h is removed.
|
|
Mostly just a global search and replace. Except rt_is_true which
becomes mp_obj_is_true.
Still would like to tidy up some of the names, but this will do for now.
|
|
|
|
Addresses issue #388.
|
|
show_bc now decodes the prelude correctly. Moved WRITE_FILE stuff from
runtime.c to emitglue.c.
Addresses issue #385.
|
|
|
|
Rationale: setting up the stack (state for locals and exceptions) is
really part of the "code", it's the prelude of the function. For
example, native code adjusts the stack pointer on entry to the function.
Native code doesn't need to know n_state for any other reason. So
putting the state size in the bytecode prelude is sensible.
It reduced ROM usage on STM by about 30 bytes :) And makes it easier to
pass information about the bytecode between functions.
|
|
py: Support closures with default args.
|
|
|
|
Originally, .methods was used for methods in a ROM class, and
locals_dict for methods in a user-created class. That distinction is
unnecessary, and we can use locals_dict for ROM classes now that we have
ROMable maps.
This removes an entry in the bloated mp_obj_type_t struct, saving a word
for each ROM object and each RAM object. ROM objects that have a
methods table (now a locals_dict) need an extra word in total (removed
the methods pointer (1 word), no longer need the sentinel (2 words), but
now need an mp_obj_dict_t wrapper (4 words)). But RAM objects save a
word because they never used the methods entry.
Overall the ROM usage is down by a few hundred bytes, and RAM usage is
down 1 word per user-defined type/class.
There is less code (no need to check 2 tables), and now consistent with
the way ROM modules have their tables initialised.
Efficiency is very close to equivaluent.
|
|
|
|
Addresses issue #377.
|
|
|
|
|
|
Comes with some refactoring of code and renaming of files. All modules
are now named mod*.[ch].
|
|
|
|
For this, needed to implement DELETE_NAME bytecode (because var bound
in except clause is automatically deleted at its end).
http://docs.python.org/3/reference/compound_stmts.html#except :
"When an exception has been assigned using as target, it is cleared at
the end of the except clause."
|
|
|
|
|
|
|
|
|
|
intdivmod.c and tests/basics/modulo.py.
|
|
arguments). Comment out the errors that aren't needed if memory becomes an issue.
|
|
|
|
|