| Commit message (Collapse) | Author | Age |
|
|
|
|
| |
I skipped implementing this initially, but then it causes __name__
of current module be overwritten and relative imports fail.
|
|
|
|
|
| |
Also make consistent use of MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL.
This helps a lot in debugging and understanding of function API.
|
|
|
|
| |
mp_obj_t->subscr now does load/store/delete.
|
| |
|
|\
| |
| | |
Convert sys module to static allocation
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This makes the runtime and object APIs more consistent. mp_store_subscr
functionality now moved into objects (ie list and dict store_item).
|
|
|
|
|
|
|
| |
At this point, all opcodes are now implemented!
Some del opcodes have been combined with store opcodes, with the value
to store being MP_OBJ_NULL.
|
| |
|
|
|
|
| |
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.
|
|/ |
|
|\ |
|
| |
| |
| |
| |
| | |
"1/0" is sacred idiom, the shortest way to break program execution
(sys.exit() is too long).
|
|/
|
|
|
|
|
| |
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.
|
|
|
|
| |
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.
|
| | |
|
| | |
|