summaryrefslogtreecommitdiffstatshomepage
path: root/py
Commit message (Collapse)AuthorAge
* py/stream.h: Move mp_stream_write_adaptor() inside ifdef block.Paul Sokolovsky2016-07-25
|
* unix: Enable MICROPY_PY_STR_BYTES_CMP_WARN.Paul Sokolovsky2016-07-22
| | | | Also, fix a warning text (remove "duplicate" BytesWarning).
* py/mpconfig.h: Fix description for MICROPY_PY_STR_BYTES_CMP_WARN.Paul Sokolovsky2016-07-22
|
* py/obj: Issue a warning when str and bytes objects are compared.Paul Sokolovsky2016-07-22
| | | | | | | | | | Something like: if foo == "bar": will be always false if foo is b"bar". In CPython, warning is issued if interpreter is started as "python3 -b". In MicroPython, MICROPY_PY_STR_BYTES_CMP_WARN setting controls it.
* py: Fix nlrthumb.c when DEBUG=1 is definedDave Hylands2016-07-21
|
* py/gc: Implement GC running by allocation threshold.Paul Sokolovsky2016-07-21
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, MicroPython runs GC when it could not allocate a block of memory, which happens when heap is exhausted. However, that policy can't work well with "inifinity" heaps, e.g. backed by a virtual memory - there will be a lot of swap thrashing long before VM will be exhausted. Instead, in such cases "allocation threshold" policy is used: a GC is run after some number of allocations have been made. Details vary, for example, number or total amount of allocations can be used, threshold may be self-adjusting based on GC outcome, etc. This change implements a simple variant of such policy for MicroPython. Amount of allocated memory so far is used for threshold, to make it useful to typical finite-size, and small, heaps as used with MicroPython ports. And such GC policy is indeed useful for such types of heaps too, as it allows to better control fragmentation. For example, if a threshold is set to half size of heap, then for an application which usually makes big number of small allocations, that will (try to) keep half of heap memory in a nice defragmented state for an occasional large allocation. For an application which doesn't exhibit such behavior, there won't be any visible effects, except for GC running more frequently, which however may affect performance. To address this, the GC threshold is configurable, and by default is off so far. It's configured with gc.threshold(amount_in_bytes) call (can be queries without an argument).
* esp8266: Cache Xtensa-built libaxtls.a in local build dir.Paul Sokolovsky2016-07-16
| | | | Allows to build the library variant for other archs in parallel.
* py/stream: Implement 2- and 3-arg write() method as an extension to CPython.Paul Sokolovsky2016-07-14
| | | | | | | | | | | | | | | | | | 3-arg form: stream.write(data, offset, length) 2-arg form: stream.write(data, length) These allow efficient buffer writing without incurring extra memory allocation for slicing or creating memoryview() object, what is important for low-memory ports. All arguments must be positional. It might be not so bad idea to standardize on 3-arg form, but 2-arg case would need check and raising an exception anyway then, so instead it was just made to work.
* extmod/modussl_axtls: Further changes to allow alternative SSL modules.Paul Sokolovsky2016-07-13
| | | | | Make variable MICROPY_SSL_AXTLS=1 should be defined to activate modussl_axtls and link with -laxtls.
* extmod/modussl: Rename to modussl_axtls.c, to allow impl using other SSL libs.Paul Sokolovsky2016-07-13
|
* py/nlrx64.S: Prefix mp_thread_get_state with an underscore on Mac.Damien George2016-07-11
|
* qemu-arm: Enable gcc LTO option for nlrthumb.cDaniel Tralamazza2016-07-11
| | | | LTO can't "see" inside naked functions, but we can mark `nlr_push_tail` as used.
* py/objarray: Split out header to allow direct access to object.Paul Sokolovsky2016-07-06
| | | | | | This follows source code/header file organization similar to few other objects, and intended to be used only is special cases, where efficiency/ simplicity matters.
* extmod/moduos_dupterm: Reserve buffer bytearray object for dupterm.Paul Sokolovsky2016-07-04
| | | | | Allocating it for each read/write operation is a memory fragmentation hazard.
* py/mpconfig.h: Mention MICROPY_PY_BTREE config option.Paul Sokolovsky2016-07-02
| | | | | However, as it requires linking with external libraries, it actually should be ste on Makefile level.
* py/builtinimport: Disable "imported as namespace package" warning.Paul Sokolovsky2016-07-02
| | | | | Namespace packages are natural part of Python3, CPython3 doesn't have such warning, it made sense only from point of view of Python2 legacy.
* py/gc: Calculate (and report) maximum contiguous free block size.Paul Sokolovsky2016-07-01
| | | | | Just as maximum allocated block size, it's reported in allocation units (not bytes).
* py/gc: Be sure to count last allocated block at heap end in stats.Paul Sokolovsky2016-06-30
| | | | | | Previously, if there was chain of allocated blocks ending with the last block of heap, it wasn't included in number of 1/2-block or max block size stats.
* py/mpthread: Include mpstate.h when defining GIL macros.Damien George2016-06-28
|
* py/nlrsetjmp: Update to take into account new location of nlr_top.Damien George2016-06-28
| | | | It's now accessed via the MP_STATE_THREAD macro.
* py/nlrthumb: Convert NLR thumb funcs from asm to C with inline-asm.Damien George2016-06-28
| | | | | | | Now only the bits that really need to be written in assembler are written in it, otherwise C is used. This means that the assembler code no longer needs to know about the global state structure which makes it much easier to maintain.
* py/modthread: Allow to properly set the stack limit of a thread.Damien George2016-06-28
| | | | | We rely on the port setting and adjusting the stack size so there is enough room to recover from hitting the stack limit.
* py/mpthread.h: Move GIL macros outside MICROPY_PY_THREAD block.Damien George2016-06-28
| | | | The GIL macros are needed even if threading is not enabled.
* py/modthread: Make Lock objects work when GIL is enabled.Damien George2016-06-28
|
* py: Don't use gc or qstr mutex when the GIL is enabled.Damien George2016-06-28
| | | | | There is no need since the GIL already makes gc and qstr operations atomic.
* py: Implement a simple global interpreter lock.Damien George2016-06-28
| | | | | This makes the VM/runtime thread safe, at the cost of not being able to run code in parallel.
* py: Make interning of qstrs thread safe.Damien George2016-06-28
|
* py/gc: Fix GC+thread bug where ptr gets lost because it's not computed.Damien George2016-06-28
| | | | | | | | | | | GC_EXIT() can cause a pending thread (waiting on the mutex) to be scheduled right away. This other thread may trigger a garbage collection. If the pointer to the newly-allocated block (allocated by the original thread) is not computed before the switch (so it's just left as a block number) then the block will be wrongly reclaimed. This patch makes sure the pointer is computed before allowing any thread switch to occur.
* py/modthread: Call mp_thread_start/mp_thread_finish around threads.Damien George2016-06-28
| | | | So the underlying thread implementation can do any necessary bookkeeping.
* py/modthread: Be more careful with root pointers when creating a thread.Damien George2016-06-28
|
* py/gc: Fix 2 cases of concurrent access to ATB and FTB.Damien George2016-06-28
|
* py/modthread: Satisfy unused-args warning.Damien George2016-06-28
|
* py/gc: Make memory manager and garbage collector thread safe.Damien George2016-06-28
| | | | | | By using a single, global mutex, all memory-related functions (alloc, free, realloc, collect, etc) are made thread safe. This means that only one thread can be in such a function at any one time.
* py/modthread: Add with-context capabilities to lock object.Damien George2016-06-28
|
* py/modthread: Implement lock object, for creating a mutex.Damien George2016-06-28
|
* py/modthread: Add exit() function.Damien George2016-06-28
| | | | Simply raises the SystemExit exception.
* py/modthread: Add stack_size() function.Damien George2016-06-28
|
* py/modthread: Properly cast concrete exception pointer to an object.Damien George2016-06-28
|
* py: Add basic _thread module, with ability to start a new thread.Damien George2016-06-28
|
* py: Add MP_STATE_THREAD to hold state specific to a given thread.Damien George2016-06-28
|
* py/objtype: Inherit protocol vtable from base class only if it exists.Paul Sokolovsky2016-06-19
|
* py/mphal.h: If virtpin API is used, automagically include its header.Paul Sokolovsky2016-06-19
|
* py/objtype: instance: Inherit protocol vtable from a base class.Paul Sokolovsky2016-06-19
| | | | | | | This allows to define an abstract base class which would translate C-level protocol to Python method calls, and any subclass inheriting from it will support this feature. This in particular actually enables recently introduced machine.PinBase class.
* extmod/machine_pinbase: Implementation of PinBase class.Paul Sokolovsky2016-06-18
| | | | | | | Allows to translate C-level pin API to Python-level pin API. In other words, allows to implement a pin class and Python which will be usable for efficient C-coded algorithms, like bitbanging SPI/I2C, time_pulse, etc.
* all: Rename mp_obj_type_t::stream_p to protocol.Paul Sokolovsky2016-06-18
| | | | | It's now used for more than just stream protocol (e.g. pin protocol), so don't use false names.
* py: Rename __QSTR_EXTRACT flag to NO_QSTR.Paul Sokolovsky2016-06-16
| | | | | It has more usages than just qstr extraction, for example, embedding (where people don't care about efficient predefined qstrs).
* py/mkrules.mk: Define "lib" outside conditional block.Paul Sokolovsky2016-06-16
| | | | "lib" happened to be defined inside block conditional on $(PROG).
* py/makeqstrdefs.py: Remove restriction that source path can't be absolute.Paul Sokolovsky2016-06-16
| | | | | | That's arbitrary restriction, in case of embedding, a source file path may be absolute. For the purpose of filtering out system includes, checking for ".c" suffix is enough.
* py/mpconfig.h: MP_NOINLINE is universally useful, move from unix port.Paul Sokolovsky2016-06-15
|
* py: Support to build berkeley db 1.85 and "btree" module.Paul Sokolovsky2016-06-15
|