aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-10-13docs/machine.Pin: Add note regarding irq handler argument.Peter Hinch
2018-10-13lib/utils/pyexec: Forcefully unlock the heap if locked and REPL active.Damien George
Otherwise there is really nothing that can be done, it can't be unlocked by the user because there is no way to allocate memory to execute the unlock. See issue #4205 and #4209.
2018-10-13tests/uctypes_sizeof_od: Test for using OrderedDict as struct descriptorPaul Sokolovsky
Just a copy of uctypes_sizeof.py with minimal changes.
2018-10-13extmod/moductypes: Accept OrderedDict as a structure description.Paul Sokolovsky
Using OrderedDict (i.e. stable order of fields) would for example allow to automatically calculate field offsets in structures.
2018-10-13py/emitnative: Remove unused ptr argument from ASM_CALL_IND macro.Damien George
2018-10-13py/asmthumb: Remove unused fun_ptr arg from asm_thumb_bl_ind function.Damien George
2018-10-13py/asmarm: Simplify asm_arm_bl_ind to only load via index, not literal.Damien George
The maximum index into mp_fun_table is currently less than 1024 and should stay that way to keep things efficient for all architectures, so there is no need to handle loading the pointer directly via a literal in this function.
2018-10-13py/emitnative: Load native fun table ptr from const table for all archs.Damien George
All architectures now have a dedicated register to hold the pointer to the native function table mp_fun_table, and so they all need to load this register at the start of the native function. This commit makes the loading of this register uniform across architectures by passing the pointer in the constant table for the native function, and then loading the register from the constant table. Doing it this way means that the pointer is not stored in the assembly code, helping to make the code more portable.
2018-10-13py/asmx86: Change indirect calls to load fun ptr from the native table.Damien George
Instead of storing the function pointer directly in the assembly code. This makes the generated code more independent of the runtime (so easier to relocate the code), and reduces the generated code size.
2018-10-13py/asmx86: Change stack management to reference locals by esp not ebp.Damien George
The esp register is always a fixed distance below ebp, and using esp to reference locals on the stack frees up the ebp register for general purpose use (which is important for an architecture with only 8 user registers).
2018-10-13py/asmx64: Change indirect calls to load fun ptr from the native table.Damien George
Instead of storing the function pointer directly in the assembly code. This makes the generated code more independent of the runtime (so easier to relocate the code), and reduces the generated code size.
2018-10-13py/asmx64: Change stack management to reference locals by rsp not rbp.Damien George
The rsp register is always a fixed distance below rbp, and using rsp to reference locals on the stack frees up the rbp register for general purpose use.
2018-10-11nrf/bluetooth: Set GAP_ADV_MAX_SIZE to 31 (s132/s140).Glenn Ruben Bakke
For s132 and s140, GAP_ADV_MAX_SIZE was currently set to BLE_GATT_ATT_MTU_DEFAULT, which is 23. The correct value should have been 31, but there are no define for this in the s132/s140 header files as for s110. Updating define in ble_drv.c to the correct value of 31.
2018-10-05stm32/main: Add configuration macros for board to set heap start/end.Andrew Leech
The macros are MICROPY_HEAP_START and MICROPY_HEAP_END, and if not defined by a board then the default values will be used (maximum heap from SRAM as defined by linker symbols). As part of this commit the SDRAM initialisation is moved to much earlier in main() to potentially make it available to other peripherals and avoid re-initialisation on soft-reboot. On boards with SDRAM enabled the heap has been set to use that.
2018-10-05windows/msvc: Implement file/directory type query.stijn
Add some more POSIX compatibility by adding a d_type field to the dirent structure and defining corresponding macros so listdir_next in the unix' port modos.c can use it, end result being uos.ilistdir now reports the file type.
2018-10-05windows/msvc: Fix incorrect indentation in dirent.c.stijn
2018-10-05extmod/moductypes: Remove BITFIELD from aggregate types enum.Paul Sokolovsky
This value is unused. It was an artifact of early draft design, but bitfields were optimized to use scalar one-word encoding, to allow compact encoding of typical multiple bitfields in MCU control registers.
2018-10-05docs/uselect: Describe more aspects of poll.register/modify behavior.Paul Sokolovsky
E.g., register() can be called again for the same object, while modify() will raise exception if object was not register()ed before.
2018-10-05tests/uselect_poll_basic: Add basic test for uselect.poll invariants.Paul Sokolovsky
This test doesn't check the actual I/O behavior, just "static" invariants like behavior on duplicate calls or calls when I/O object is not registered with poller.
2018-10-05unix/moduselect: Raise OSError(ENOENT) if obj to modify is not in pollerPaul Sokolovsky
Previously, the function silently succeeded. The new behavior is consistent with both baremetal uselect implementation and CPython 3.
2018-10-05tests/unix/ffi_float: Skip if strtof() is not available.Paul Sokolovsky
As the case for e.g. Android's Bionic Libc.
2018-10-02py/emitnative: Clean up unused macro and forward function declarations.Damien George
2018-10-01py/obj.h: Use uint64_t instead of mp_int_t in repr-D MP_OBJ_IS_x macros.Damien George
This follows how it's already done in MP_OBJ_IS_OBJ: the objects are considered 64-bit unsigned ints for the purpose of bitwise manipulation.
2018-10-01py/runtime: Remove comment in mp_import_name about level being 0.Damien George
A non-zero level has been supported for some time now.
2018-10-01py/runtime: Use mp_import_name to implement tail of mp_import_from.Damien George
2018-10-01docs/wipy: Fix links to network.Server, and markup for boot.py.Damien George
2018-10-01docs: Remove sphinx_selective_exclude, it's no longer used.Damien George
2018-10-01docs: Unify all the ports into one set of documentation.Damien George
With this commit there is now only one entry point into the whole documentation, which describes the general MicroPython language, and then from there there are links to information about specific platforms/ports. This commit doesn't change content (almost, it does fix a few internal links), it just reorganises things.
2018-10-01tests/run-tests: Enabled native tests that pass now that yield works.Damien George
2018-10-01py/emitnative: Implement yield and yield-from in native emitter.Damien George
This commit adds first class support for yield and yield-from in the native emitter, including send and throw support, and yields enclosed in exception handlers (which requires pulling down the NLR stack before yielding, then rebuilding it when resuming). This has been fully tested and is working on unix x86 and x86-64, and stm32. Also basic tests have been done with the esp8266 port. Performance of existing native code is unchanged.
2018-10-01py/emitnative: Reorder native state on C stack so nlr_buf_t is first.Damien George
The nlr_buf_t doesn't need to be part of the Python value stack (as it was before this commit), it's simpler to have it separated as auxiliary state that lives on the C stack. This will help adding yield support because in that case the nlr_buf_t and Python value stack live in separate memory areas (C stack and heap respectively).
2018-10-01py/asmxtensa: Use proper calculation for const table offset.Damien George
Instead of hard-coding it to 4 bytes. This allows for there to be other data stored at the very start of the emitted native code.
2018-10-01py/asmx64: Extend asm_x64_mov_reg_pcrel to accept high registers.Damien George
2018-10-01py/asmx86: Comment out unused asm_x86_nop to prevent compiler warnings.Damien George
2018-09-30py/asmthumb: Extend asm entry/exit to handle stack larger than 508 bytesDamien George
2018-09-30py/asmthumb: Clean up asm_thumb_bl_ind to use new optimised ldr helper.Damien George
2018-09-30py/asmthumb: Add wide ldr to handle larger offsets.Damien George
In particular this allows native functions on Thumb2 to index more than 32 constants in the constant table.
2018-09-29py/vm: When VM raises exception put exc obj at beginning of func state.Damien George
Instead of at end of state, n_state - 1. It was originally (way back in v1.0) put at the end of the state because the VM didn't have a pointer to the start. But now that the VM takes a mp_code_state_t pointer it does have a pointer to the start of the state so can put the exception object there. This commit saves about 30 bytes of code on all architectures, and, more importantly, reduces C-stack usage by a couple of words (8 bytes on Thumb2 and 16 bytes on x86-64) for every (non-generator) call of a bytecode function because fun_bc_call no longer needs to remember the n_state variable.
2018-09-28py/objtype: Support full object model for get/set/delitem special meths.Damien George
This makes these special methods have the same calling behaviour as other methods in a class instance (mp_convert_member_lookup() is already called by mp_obj_class_lookup()).
2018-09-28py/objtype: Remove TODO about storing attributes to classes.Damien George
This behaviour is tested in basics/class_store.py and follows CPython.
2018-09-28py/runtime: Remove nlr protection when calling __next__ in mp_resume.Damien George
And remove related comment about needing such protection when calling send. Reasoning for removal is as follows: - mp_resume is only called by the VM in YIELD_FROM opcode - if send_value != MP_OBJ_NULL then throw_value == MP_OBJ_NULL - so if __next__ or send are called then throw_value == MP_OBJ_NULL - if __next__ or send raise an exception without nlr protection then the exception will be handled by the global exception handler of the VM - this handler already has code to handle exceptions raised in YIELD_FROM, including correct handling of StopIteration - this handler doesn't handle the case of injection of GeneratorExit, but this won't be needed because throw_value == MP_OBJ_NULL Note that it's already possible for mp_resume() to raise an exception (including StopIteration) from the unprotected call to type->iternext(), so that's why the VM already has code to handle the case of exceptions coming out of mp_resume(). This commit reduces code size by a bit, and significantly reduces C stack usage when using yield-from, from 88 bytes down to 40 for Thumb2, and 152 down to 72 bytes for x86-64 (better than half). (Note that gcc doesn't seem to tail-call optimise the call from mp_resume() to mp_obj_gen_resume() so this saving in C stack usage helps all uses of yield-from.)
2018-09-28py/vm: Fix case of throwing GeneratorExit type into yield-from.Damien George
mp_make_raise_obj must be used to convert a possible exception type to an instance object, otherwise the VM may raise a non-exception object. An existing test is adjusted to test this case, with the original test already moved to generator_throw.py.
2018-09-28tests/basics: Split out gen throw tests from yield-from-throw tests.Damien George
2018-09-28py/emitnative: Change type of const_table from uintptr_t to mp_uint_t.Damien George
This matches how bytecode does it, and matches the signature of mp_emit_glue_assign_native. Since the native emitter doesn't support nan-boxing uintptr_t and mp_uint_t are anyway the same bit-width.
2018-09-27esp8266: Remove scanning of GC pointers in native code block.Damien George
The native code no longer holds live GC pointers so doesn't need to be scanned.
2018-09-27tests/micropython: Test loading const objs in native and viper funcs.Damien George
2018-09-27py/asm*: Remove ASM_MOV_REG_ALIGNED_IMM emit macro, it's no longer used.Damien George
After the previous commit this macro is no longer needed by the native emitter because live heap pointers are no longer stored in generated native machine code.
2018-09-27py/emitnative: Place const objs for native code in separate const table.Damien George
This commit changes native code to handle constant objects like bytecode: instead of storing the pointers inside the native code they are now stored in a separate constant table (such pointers include objects like bignum, bytes, and raw code for nested functions). This removes the need for the GC to scan native code for root pointers, and takes a step towards making native code independent of the runtime (eg so it can be compiled offline by mpy-cross). Note that the changes to the struct scope_t did not increase its size: on a 32-bit architecture it is still 48 bytes, and on a 64-bit architecture it decreased from 80 to 72 bytes.
2018-09-27docs/library/network: Make AbstractNIC methods layout correctly.Damien George
2018-09-27docs/library/network: Move specific network classes to their own file.Damien George
All concrete network classes are now moved to their own file (eg network.WLAN.rst) and deconditionalised (remove ..only:: directives). This makes the network documentation the same for all ports. After this change there are no more "..only::" directives for different ports, and the only difference among ports is the very front page of the docs.