Commit Graph

8712 Commits

Author SHA1 Message Date
stijn 8d865fa701 msvc: Do not define DEBUG for debug builds
It is not used anywhere and causes a warning about redefinition because
it is used in modutimeq.c
2017-04-30 14:28:37 +03:00
stijn 2f0ce2a6f5 py: Cleanup use of global DEBUG preprocessor definition
The standard preprocessor definition to differentiate debug and non-debug
builds is NDEBUG, not DEBUG, so don't rely on the latter:
- just delete the use of it in objint_longlong.c as it has been stale code
  for years anyway (since commit [c4029e5]): SUFFIX isn't used anywhere.
- replace DEBUG with MICROPY_DEBUG_NLR in nlr.h: it is rarely used anymore
  so can be off by default
2017-04-30 14:28:37 +03:00
Paul Sokolovsky a7f5022591 windows/README: Convert to Markdown. 2017-04-30 00:41:24 +03:00
Paul Sokolovsky 4c2402e41e extmod/modlwip: getaddrinfo: Allow to accept all 6 standard params.
But warn if anything else but host/port is passed.
2017-04-29 18:56:39 +03:00
Paul Sokolovsky de3a96ba17 extmod/moduselect: Implement ipoll() method for alloc-free polling.
Similar to the implementation added to unix port module previously.
2017-04-29 13:05:44 +03:00
Paul Sokolovsky edc0dcb55c extmod/moduselect: Refactor towards introduction of poll.ipoll().
This follows previous refactor made to unix/moduselect.
2017-04-29 13:05:20 +03:00
Paul Sokolovsky b08286948a extmod/moduselect: Convert to MP_ROM_QSTR and friends. 2017-04-29 11:06:05 +03:00
Damien George 49de9b68d2 qemu-arm, stmhal: Remove dummy memory.h since it's no longer needed.
extmod/crypto-algorithms/sha256.c was recently fixed so that it didn't
include this header.
2017-04-28 22:07:14 +10:00
Paul Sokolovsky 11a962099e examples/hwapi: Add config for Zephyr port of 96Boards Carbon. 2017-04-27 18:08:05 +03:00
Paul Sokolovsky 8109cd5f23 extmod/crypto-algorithms/sha256: Remove non-standard memory.h header. 2017-04-27 15:01:01 +03:00
Paul Sokolovsky 31bbcd448c zephyr/modusocket: Add dummy makefile() implementation. 2017-04-27 14:57:49 +03:00
Paul Sokolovsky 868453d3d8 zephyr/modusocket: sock_read: Check socket status only at the start of packet.
Otherwise, if we already have a packet in progress, finish it first, before
check "peer closed" status.
2017-04-26 09:14:41 +03:00
Paul Sokolovsky 1fe0f678f8 zephyr/modusocket: Add read/readline/readinto stream methods. 2017-04-26 08:43:07 +03:00
Paul Sokolovsky ef55be159c zephyr/modusocket: Refactor recv() into stream read() method. 2017-04-26 08:43:07 +03:00
Damien George 7743b1523e unix: Remove obsolete MICROPY_FATFS macro.
It doesn't do anything.  The VFS feature is controlled by MICROPY_VFS and
the FatFS driver, by MICROPY_VFS_FAT (which are set in mpconfigport.h).
2017-04-26 11:16:52 +10:00
Paul Sokolovsky 63068875c5 zephyr/modusocket: Enable stream write() method. 2017-04-26 01:06:42 +03:00
Paul Sokolovsky 0e177e0649 zephyr/modusocket: Refactor send() into stream write() method. 2017-04-26 01:05:54 +03:00
Kushal Das 083cd21a74 zephyr: Add 96b_carbon configuration.
As there's no networking support in mainline yet, networking is disabled,
because otherwise the board hangs on startup.
2017-04-26 00:22:48 +03:00
Scott Shawcroft 541d22e8d0 Update the README with new links. 2017-04-25 11:28:47 -07:00
Damien George f85fd79c6c py/mpz: In mpn_sub, use existing function to remove trailing zeros. 2017-04-25 12:22:04 +10:00
Damien George 810133d97d tests/basics: Add tests for int.from_bytes when src has trailing zeros.
The trailing zeros should be truncated from the converted value.
2017-04-25 12:07:02 +10:00
Damien George c7aa86ce6f py/mpz: Strip trailing zeros from mpz value when set from bytes. 2017-04-25 12:06:10 +10:00
Paul Sokolovsky 5e66f2b751 zephyr/main: Configure IPv4 netmask and gateway to allow Internet access. 2017-04-22 19:29:47 +03:00
Damien George 30badd1ce1 tests: Add tests for calling super and loading a method directly. 2017-04-22 23:39:38 +10:00
Damien George dd11af209d py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls.
This patch allows the following code to run without allocating on the heap:

    super().foo(...)

Before this patch such a call would allocate a super object on the heap and
then load the foo method and call it right away.  The super object is only
needed to perform the lookup of the method and not needed after that.  This
patch makes an optimisation to allocate the super object on the C stack and
discard it right after use.

Changes in code size due to this patch are:

   bare-arm: +128
    minimal: +232
   unix x64: +416
unix nanbox: +364
     stmhal: +184
    esp8266: +340
     cc3200: +128
2017-04-22 23:39:20 +10:00
Damien George 5335942b59 py/compile: Refactor handling of special super() call.
This patch refactors the handling of the special super() call within the
compiler.  It removes the need for a global (to the compiler) state variable
which keeps track of whether the subject of an expression is super.  The
handling of super() is now done entirely within one function, which makes
the compiler a bit cleaner and allows to easily add more optimisations to
super calls.

Changes to the code size are:

   bare-arm: +12
    minimal:  +0
   unix x64: +48
unix nanbox: -16
     stmhal:  +4
     cc3200:  +0
    esp8266: -56
2017-04-22 21:46:32 +10:00
Damien George 0dd6a59c89 py/compile: Don't do unnecessary check if iter parse node is a struct.
If we get to this point in the code then pn_iter is guaranteed to be a
struct.
2017-04-22 21:43:42 +10:00
Damien George 03053f82db mpy-cross, unix, windows, stmhal: Enable return-if-else optimisation.
Prior to making this a config option it was previously available on these
(and all other) ports, and it makes sense to keep it enabled for mpy-cross
as well as ports that have a decent amount of space for the code.
2017-04-22 15:12:48 +10:00
Damien George ae54fbf166 py/compile: Add COMP_RETURN_IF_EXPR option to enable return-if-else opt.
With this optimisation enabled the compiler optimises the if-else
expression within a return statement.  The optimisation reduces bytecode
size by 2 bytes for each use of such a return-if-else statement.  Since
such a statement is not often used, and costs bytes for the code, the
feature is disabled by default.

For example the following code:

    def f(x):
        return 1 if x else 2

compiles to this bytecode with the optimisation disabled (left column is
bytecode offset in bytes):

    00 LOAD_FAST 0
    01 POP_JUMP_IF_FALSE 8
    04 LOAD_CONST_SMALL_INT 1
    05 JUMP 9
    08 LOAD_CONST_SMALL_INT 2
    09 RETURN_VALUE

and to this bytecode with the optimisation enabled:

    00 LOAD_FAST 0
    01 POP_JUMP_IF_FALSE 6
    04 LOAD_CONST_SMALL_INT 1
    05 RETURN_VALUE
    06 LOAD_CONST_SMALL_INT 2
    07 RETURN_VALUE

So the JUMP to RETURN_VALUE is optimised and replaced by RETURN_VALUE,
saving 2 bytes and making the code a bit faster.
2017-04-22 14:58:01 +10:00
Damien George 40b40ffc98 py/compile: Extract parse-node kind at start of func for efficiency.
Otherwise the type of parse-node and its kind has to be re-extracted
multiple times.  This optimisation reduces code size by a bit (16 bytes on
bare-arm).
2017-04-22 14:23:47 +10:00
Damien George fa03bbf0fd py/compile: Don't do unnecessary check if parse node is a struct.
PN_atom_expr_normal parse nodes always have structs for their second
sub-node, so simplify the check for the sub-node kind to save code size.
2017-04-22 14:13:37 +10:00
Damien George 4df013c8cc py/objtype: mp_obj_new_super doesn't need to be public, so inline it.
Saves code size (20 bytes on bare-arm) and makes it a tiny bit more
efficient.
2017-04-22 12:14:04 +10:00
Paul Sokolovsky 9e8f316392 extmod/moductypes: Fix bigint handling for 32-bit ports. 2017-04-21 16:43:21 +03:00
stijn 3e5cd35a9f windows: Bring mpconfigport.h up-to-date with unix port
Add definitions/source files for features which work on the windows
ports but weren't yet enabled.
UTIME related lines are moved a couple of lines up to make comparision
with unix/mpconfigport.h easier in the future.
2017-04-21 13:20:14 +02:00
Damien George 7a72c0db5a py: Reduce str/repr precision of float numbers when floats are 30-bit.
With 30-bit floats there aren't enough bits to faithfully print 7 decimal
digits, so reduce the precision to 6 digits.
2017-04-21 16:21:56 +10:00
Scott Shawcroft ef44cec1f1 travis: turn off artifact debug. 2017-04-20 17:02:59 -07:00
Scott Shawcroft 9a5ff7766e travis: working_dir doesn't work as expected. Try and fix it. 2017-04-20 16:48:29 -07:00
Scott Shawcroft bc152da3a6 atmel-samd: Remove debug prints from TouchIn 2017-04-20 16:48:04 -07:00
Scott Shawcroft 4c77f84034 travis: artifact upload tweaks. 2017-04-20 16:18:30 -07:00
Scott Shawcroft f66fcbfa4f travis: Don't try and build ESP8266 2017-04-20 15:14:37 -07:00
Scott Shawcroft bac3a7dcc1 travis: Fix typo 2017-04-20 14:12:14 -07:00
Scott Shawcroft 98667b1af8 Turn on build saving and uf2 creation. 2017-04-20 14:04:06 -07:00
Scott Shawcroft a9d25bfae4 atmel-samd: Update CircuitPlayground Express pins for Rev G. 2017-04-20 11:25:57 -07:00
Scott Shawcroft 939c0045db Switch to a shared piece of code to compute start and length of a
buffer from start, end and length. The old code miscomputed length
leading to writing and reading from memory past the end of the buffer.
Consolidating the code should make it easier to get right everywhere.
2017-04-20 11:24:05 -07:00
Paul Sokolovsky 5846770997 zephyr/modmachine: Implement machine.reset(). 2017-04-19 13:28:36 +03:00
Scott Shawcroft 076ff82c46 atmel-samd: Switch to https for freetouch submodule. 2017-04-18 12:34:03 -07:00
Scott Shawcroft b97edd4465 atmel-samd: Turn on framebuf for Express boards because they have space. 2017-04-18 09:44:04 -07:00
Scott Shawcroft 8d0d5defc7 atmel-samd: Use LTO for all builds to get 5000 bytes back on express boards. 2017-04-18 09:44:04 -07:00
Scott Shawcroft ca176535a9 esp8266: Fix busio.SPI to take both MOSI and MISO. 2017-04-18 09:44:04 -07:00
Scott Shawcroft 67ec52d7a9 atmel-samd: Swap out pulseio for touchio based on FreeTouch. 2017-04-18 09:44:04 -07:00