Commit Graph

3400 Commits

Author SHA1 Message Date
Paul Sokolovsky 708574b082 teensy: Update for readline module moved to lib/. 2015-01-12 04:27:36 +02:00
Paul Sokolovsky 06e9cb688b esp8266: Update for readline module moved to lib/. 2015-01-12 04:27:36 +02:00
Paul Sokolovsky a7bcb218fe stmhal: Move readline code to lib/mp-readline/. 2015-01-12 04:15:35 +02:00
Damien George 99ab64ffd4 py/makeqstrdata.py: Make it work again with both Python2 and Python3. 2015-01-11 22:40:38 +00:00
Damien George 95836f8439 py: Add MICROPY_QSTR_BYTES_IN_LEN config option, defaulting to 1.
This new config option sets how many fixed-number-of-bytes to use to
store the length of each qstr.  Previously this was hard coded to 2,
but, as per issue #1056, this is considered overkill since no-one
needs identifiers longer than 255 bytes.

With this patch the number of bytes for the length is configurable, and
defaults to 1 byte.  The configuration option filters through to the
makeqstrdata.py script.

Code size savings going from 2 to 1 byte:
- unix x64 down by 592 bytes
- stmhal down by 1148 bytes
- bare-arm down by 284 bytes

Also has RAM savings, and will be slightly more efficient in execution.
2015-01-11 22:27:30 +00:00
Damien George 6942f80a8f py: Add qstr cfg capability; generate QSTR_NULL and QSTR_ from script. 2015-01-11 22:06:53 +00:00
Damien George e233a55a29 py: Remove unnecessary BINARY_OP_EQUAL code that just checks pointers.
Previous patch c38dc3ccc7 allowed any
object to be compared with any other, using pointer comparison for a
fallback.  As such, existing code which checked for this case is no
longer needed.
2015-01-11 21:07:15 +00:00
Damien George c38dc3ccc7 py: Implement fallback for equality check for all types.
Return "not equal" for objects that don't implement equality check.
This is as per Python specs.
2015-01-11 15:13:18 +00:00
Damien George ec21405821 py: Add (commented out) code to gc_dump_alloc_table for qstr info. 2015-01-11 14:37:06 +00:00
Damien George 56e1f99ca1 py/makeqstrdata.py: Add more allowed qstr characters; escape quot. 2015-01-11 14:16:24 +00:00
Damien George 01418e9690 py: Fix hard-coded hash for empty qstr (was 0x0000 now 0x1505). 2015-01-11 14:15:45 +00:00
Damien George ddd1e18801 py: Add config option MICROPY_COMP_MODULE_CONST for module consts.
Compiler optimises lookup of module.CONST when enabled (an existing
feature).  Disabled by default; enabled for unix, windows, stmhal.
Costs about 100 bytes ROM on stmhal.
2015-01-10 14:07:24 +00:00
Paul Sokolovsky 7bfe4b21b9 tests: Make ffi_callback.py be able to run on uclibc and macosx.
Similar to ffi_float.py.
2015-01-10 00:35:48 +02:00
Damien George 58056b0f43 py: Fix handling of "0" mpz in some functions. 2015-01-09 20:58:58 +00:00
Damien George f5465b9eb0 stmhal: Reclaim 72 bytes of stack by factoring out flash init code. 2015-01-09 20:38:23 +00:00
Damien George 5d48f234d2 py: Make mem_info print correct remaining stack bytes. 2015-01-09 20:37:49 +00:00
Damien George a9a0862078 windows: Enable MICROPY_PY_MICROPYTHON_MEM_INFO. 2015-01-09 20:30:26 +00:00
Damien George 89deec0bab py: Add MICROPY_PY_MICROPYTHON_MEM_INFO to enable mem-info funcs.
This allows to enable mem-info functions in micropython module, even if
MICROPY_MEM_STATS is not enabled.  In this case, you get mem_info and
qstr_info but not mem_{total,current,peak}.
2015-01-09 20:12:54 +00:00
Damien George 4a5895c4eb py: Disable stack checking by default; enable on most ports. 2015-01-09 00:10:55 +00:00
Damien George 85e8e2ed5b qemu-arm: Add 'test' target to Makefile to run and verify test suite.
Replaces RUN_TEST=1 definition; now "make test" in qemu-arm directory
will run tests/basics/ and check that they all succeed.

This patch also enables the test on Travis CI.
2015-01-09 00:03:21 +00:00
Damien George 3990dcfcd7 docs: Add note about maximum frequency of busses. 2015-01-08 22:54:26 +00:00
Damien George 14fab60baf qemu-arm: Get "make RUN_TESTS=1" compiling after changes to core. 2015-01-08 22:12:44 +00:00
Damien George d2d0648ad0 qemu-arm: Set stack limit in main. 2015-01-08 21:40:35 +00:00
Damien George 7a53ac8ec2 stmhal: Allow to build without float support if wanted. 2015-01-08 17:55:55 +00:00
Damien George c33ecb83ba tests: Add test for when instance member overrides class member. 2015-01-08 17:48:44 +00:00
Damien George 5b7aa294e0 py: Fix nlr mp_state_ctx symbol error for Mac. 2015-01-08 16:24:44 +00:00
Damien George 19b3fea6a8 tests: Separate out test cases that rely on float support to float/ dir. 2015-01-08 15:41:37 +00:00
Damien George 115187f7ce unix: Allow to compile with float support disabled. 2015-01-08 15:41:11 +00:00
stijn afd6c8e1d2 Remove obsolete bss-related code/build features
GC for unix/windows builds doesn't make use of the bss section anymore,
so we do not need the (sometimes complicated) build features and code related to it
2015-01-08 15:29:44 +01:00
Damien George 181bfb6db2 stmhal: Add MICROPY_HW_USB_VBUS_DETECT_PIN option, for boards without it
Since all currently supported boards use pin A9 for this function, the
value of the macro MICROPY_HW_USB_VBUS_DETECT_PIN is not actually used,
just the fact that it is defined.

Addresses issue #1048.
2015-01-07 23:54:57 +00:00
Damien George c223df5113 drivers/cc3000: Fix call to extint_register. 2015-01-07 23:54:19 +00:00
Damien George 3b51b3e90f stmhal: Collect all root pointers together in 1 place.
A GC in stmhal port now only scans true root pointers, not entire BSS.
This reduces base GC time from 1700ms to 900ms.
2015-01-07 23:38:50 +00:00
Paul Sokolovsky 7a0636e80a docs: Add initial "uctypes" modules docs. WIP. 2015-01-08 00:17:10 +02:00
Damien George 7ee91cf861 py: Add option to cache map lookup results in bytecode.
This is a simple optimisation inspired by JITing technology: we cache in
the bytecode (using 1 byte) the offset of the last successful lookup in
a map. This allows us next time round to check in that location in the
hash table (mp_map_t) for the desired entry, and if it's there use that
entry straight away.  Otherwise fallback to a normal map lookup.

Works for LOAD_NAME, LOAD_GLOBAL, LOAD_ATTR and STORE_ATTR opcodes.

On a few tests it gives >90% cache hit and greatly improves speed of
code.

Disabled by default.  Enabled for unix and stmhal ports.
2015-01-07 21:07:23 +00:00
Damien George b4b10fd350 py: Put all global state together in state structures.
This patch consolidates all global variables in py/ core into one place,
in a global structure.  Root pointers are all located together to make
GC tracing easier and more efficient.
2015-01-07 20:33:00 +00:00
Damien George ad2307c92c py: Temporary fix for conversion of float to int when fits in small int.
Addresses issue #1044 (see also #1040).  Could do with a better fix.
2015-01-07 12:10:47 +00:00
Paul Sokolovsky d8bfd77ad5 showbc: Show conditional jump destination as unsigned value.
This is consistent with how BC_JUMP was handled before. We never show jumps
destinations relative to jump instrucion itself, only relative to beginning
of function. Another useful way to show them as absolute (real memory
address), and this change makes result expected and consistent with how
BC_JUMP is shown.
2015-01-07 00:29:15 +02:00
Damien George b27c9876ea docs: For Windows USB CDC driver setup, add link to existing PDF guide. 2015-01-06 16:09:49 +00:00
Paul Sokolovsky 343ca1e63a objarray: Make sure that longint works as bytearray size. 2015-01-04 17:19:16 +02:00
stijn 51af362e31 msvc: Define no-op MP_LIKELY/UNLIKELY since there's no __builtin_expect 2015-01-04 13:29:02 +02:00
Paul Sokolovsky ed3b20aae8 modbuiltins.c: Fix NULL vs MP_OBJ_NULL usage. 2015-01-04 13:26:43 +02:00
Paul Sokolovsky ff8e35b42e objstr: Common subexpression elimination for vstr_str(field_name). 2015-01-04 13:23:44 +02:00
Paul Sokolovsky c114496641 objstr: Implement kwargs support for str.format(). 2015-01-04 00:26:31 +02:00
Paul Sokolovsky ae58795c44 unix: Enable -fno-crossjumping for fast build.
Confirmed that it improves perfomance of simple "for i in range(N): pass"
loop by 15% on Core2.
2015-01-03 21:15:02 +02:00
Damien George 6fd4b36bc5 py: Raise exception if trying to convert inf/nan to int. 2015-01-02 23:04:09 +00:00
David Steinberg 6e0b6d02db py: Fix float to int conversion for large exponents. 2015-01-02 22:31:41 +00:00
stijn ffc96a901a msvc: Use single build target for dealing with generated files
Remove some duplication in the code for generating
qstrdefs.generated.h and py-version.h
2015-01-02 16:55:02 +01:00
stijn fbfd3554fa msvc: Fix unresolved mp_arg_error_terse_mismatch since 7f23384
The compiler treats `if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE)` as
a normal statement and generates assembly for it in degug mode as if MICROPY_ERROR_REPORTING
is an actual symbol instead of a preprocessor definition.
As such linking fails because mp_arg_error_terse_mismatch is not defined when
MICROPY_ERROR_REPORTING_TERSE is detailed or normal.
2015-01-02 16:53:54 +01:00
stijn 8dec62a1a4 msvc: Define main build/include directories in a single location
- Use a single file env.props for defining the main directories used when building.
  env.props resolves the base directory and defines overridable output directories,
  and is used by all other build files.
- Fix the build currently failing, basically because the preprocessing command for generating
  qstrdefs uses different include directories than the build itself does.
  (specifically, qstrdefs.h uses #include "py/mpconfig.h" since the fixes for #1022
  in 51dfcb4, so we need to use the base directory as include directory, not the py dir itself).
  So define a single variable containing the include directories instead and use it where needed.
2015-01-02 16:52:07 +01:00
Damien George fd40a9c38e py: Make GC's STACK_SIZE definition a proper MICROPY_ config variable. 2015-01-01 22:04:46 +00:00