Paul Sokolovsky
737bd9c314
py/mpconfig.h: Mention MICROPY_PY_BTREE config option.
...
However, as it requires linking with external libraries, it actually
should be ste on Makefile level.
2016-07-02 14:57:42 +03:00
Paul Sokolovsky
ae184cb9de
py/builtinimport: Disable "imported as namespace package" warning.
...
Namespace packages are natural part of Python3, CPython3 doesn't have such
warning, it made sense only from point of view of Python2 legacy.
2016-07-02 14:45:49 +03:00
Paul Sokolovsky
749cbaca7f
py/gc: Calculate (and report) maximum contiguous free block size.
...
Just as maximum allocated block size, it's reported in allocation units
(not bytes).
2016-07-01 00:09:55 +03:00
Paul Sokolovsky
6a6e0b7e05
py/gc: Be sure to count last allocated block at heap end in stats.
...
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.
2016-06-30 12:56:21 +03:00
Damien George
77e37ff98b
py/mpthread: Include mpstate.h when defining GIL macros.
2016-06-28 11:28:52 +01:00
Damien George
94238d4ae5
py/nlrsetjmp: Update to take into account new location of nlr_top.
...
It's now accessed via the MP_STATE_THREAD macro.
2016-06-28 11:28:52 +01:00
Damien George
1df4168c33
py/nlrthumb: Convert NLR thumb funcs from asm to C with inline-asm.
...
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.
2016-06-28 11:28:52 +01:00
Damien George
df95f52583
py/modthread: Allow to properly set the stack limit of a thread.
...
We rely on the port setting and adjusting the stack size so there is
enough room to recover from hitting the stack limit.
2016-06-28 11:28:51 +01:00
Damien George
e90b6ce0b5
py/mpthread.h: Move GIL macros outside MICROPY_PY_THREAD block.
...
The GIL macros are needed even if threading is not enabled.
2016-06-28 11:28:50 +01:00
Damien George
c567afc5fa
py/modthread: Make Lock objects work when GIL is enabled.
2016-06-28 11:28:50 +01:00
Damien George
a1c93a62b1
py: Don't use gc or qstr mutex when the GIL is enabled.
...
There is no need since the GIL already makes gc and qstr operations
atomic.
2016-06-28 11:28:50 +01:00
Damien George
4cec63a9db
py: Implement a simple global interpreter lock.
...
This makes the VM/runtime thread safe, at the cost of not being able to
run code in parallel.
2016-06-28 11:28:50 +01:00
Damien George
1f54ad2aed
py: Make interning of qstrs thread safe.
2016-06-28 11:28:50 +01:00
Damien George
3653f5144a
py/gc: Fix GC+thread bug where ptr gets lost because it's not computed.
...
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.
2016-06-28 11:28:49 +01:00
Damien George
9172c0cb25
py/modthread: Call mp_thread_start/mp_thread_finish around threads.
...
So the underlying thread implementation can do any necessary bookkeeping.
2016-06-28 11:28:49 +01:00
Damien George
722cff5fd0
py/modthread: Be more careful with root pointers when creating a thread.
2016-06-28 11:28:49 +01:00
Damien George
e33806aaff
py/gc: Fix 2 cases of concurrent access to ATB and FTB.
2016-06-28 11:28:49 +01:00
Damien George
7f4658a7ee
py/modthread: Satisfy unused-args warning.
2016-06-28 11:28:49 +01:00
Damien George
c93d9caa8b
py/gc: Make memory manager and garbage collector thread safe.
...
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.
2016-06-28 11:28:49 +01:00
Damien George
34fc006f5e
py/modthread: Add with-context capabilities to lock object.
2016-06-28 11:28:49 +01:00
Damien George
801d1b3803
py/modthread: Implement lock object, for creating a mutex.
2016-06-28 11:28:49 +01:00
Damien George
2dacd604c5
py/modthread: Add exit() function.
...
Simply raises the SystemExit exception.
2016-06-28 11:28:48 +01:00
Damien George
707f98f207
py/modthread: Add stack_size() function.
2016-06-28 11:28:48 +01:00
Damien George
3eb7a26809
py/modthread: Properly cast concrete exception pointer to an object.
2016-06-28 11:28:48 +01:00
Damien George
27cc07721b
py: Add basic _thread module, with ability to start a new thread.
2016-06-28 11:28:48 +01:00