Damien George
22521ea9e2
py/nlrthumb: Make compatible with Cortex-M0 (ARMv6M instr set).
9 years ago
Damien George
04353cc85e
py: With obj repr "C", change raw str accessor from macro to function.
This saves around 1000 bytes (Thumb2 arch) because in repr "C" it is
costly to check and extract a qstr. So making such check/extract a
function instead of a macro saves lots of code space.
9 years ago
Damien George
183edefddd
py: Add object repr "C", where 30-bit floats are stuffed in obj word.
This new object representation puts floats into the object word instead
of on the heap, at the expense of reducing their precision to 30 bits.
It only makes sense when the word size is 32-bits.
9 years ago
Damien George
aedb859177
py: Make float representation configurable with object representation.
9 years ago
Damien George
7e359c648b
py: Move float e/pi consts to objfloat and make mp_obj_float_t private.
9 years ago
Damien George
aaef1851a7
py: Add mp_obj_is_float function (macro) and use it where appropriate.
9 years ago
Paul Sokolovsky
e0f5df579b
all: Make netutils.h available to all ports by default.
Generally, ports should inherit INC from py.mk, append to it, not
overwrite it. TODO: Likely should do the same for other vars too.
9 years ago
Paul Sokolovsky
8ee153f234
unix/modtime: Implement ticks_ms(), ticks_us() and ticks_diff().
All of these functions return positive small int, thus range is 2 bits less
than word size (30 bit on 32-bit systems, 62 bit on 64-bit systems).
9 years ago
Damien George
096d1e4512
py: Add lsl/lsr/asr opcode support to inline Thumb2 assembler.
9 years ago
Paul Sokolovsky
7799410950
py/stream: Allow to reuse is_nonblocking_error().
9 years ago
Damien George
035a0a2b6e
py: Add support for _ in REPL to hold last computed value.
Only available when MICROPY_CAN_OVERRIDE_BUILTINS is enabled.
9 years ago
Damien George
e813541e3f
py: Add option for inline assembler to support ARMv7-M instructions.
Cortex-M0, M0+ and M1 only have ARMv6-M Thumb/Thumb2 instructions. M3,
M4 and M7 have a superset of these, named ARMv7-M. This patch adds a
config option to enable support of the superset of instructions.
9 years ago
Damien George
4bf3f2d3c0
py: Fix with+for+return bug by popping for-iter when unwinding exc stack.
Addresses issue #1182 .
9 years ago
Damien George
4300c7dba2
py: Remove dependency on printf/fwrite in mp_plat_print.
See issue #1500 .
9 years ago
Damien George
d7e3b36a09
py/compile: Remove unnecessary label in compilation of for statement.
9 years ago
Damien George
fcce1483fa
py: Fix build of ARM native emitter due to recent viper changes.
Addresses #1510 .
9 years ago
Damien George
59a41e8fcd
py/qstr: Fix calc of qstr memory usage, due to new qstr chunk allocation.
9 years ago
Damien George
b8f9ac5411
py: Implement ptr32 load and store in viper emitter.
9 years ago
Damien George
3c9c3687d6
py: Add support to call __init__ from a builtin module on first import.
9 years ago
Paul Sokolovsky
408b74d74c
py: Allow to to build MicroPython as a static library.
The whole current port gets slurped into a static lib named
"libmicropython.a". Maybe that's not ideal, but at least something
to start with.
9 years ago
Damien George
fdfcee7b1e
py/parse: Make parser error handling cleaner, less spaghetti-like.
9 years ago
Damien George
64f2b213bb
py: Move constant folding from compiler to parser.
It makes much more sense to do constant folding in the parser while the
parse tree is being built. This eliminates the need to create parse
nodes that will just be folded away. The code is slightly simpler and a
bit smaller as well.
Constant folding now has a configuration option,
MICROPY_COMP_CONST_FOLDING, which is enabled by default.
9 years ago
Paul Sokolovsky
91fc075a33
py/objarray: Allow to create array of void pointers, as extension to CPython.
Using 'P' format specifier (matches struct module). This is another shortcut
for FFI, just as previously introduced "array of objects" ('O').
9 years ago
Paul Sokolovsky
1b586f3a73
py: Rename MP_BOOL() to mp_obj_new_bool() for consistency in naming.
9 years ago
Paul Sokolovsky
53ca6ae1f3
py/makeqstrdata.py: Catch and report case of empty input file.
The usual cause would be that a cross-compiler for a port is not in PATH.
9 years ago
Damien George
366239b8b9
py/parse: Factor logic when creating parse node from and-rule.
9 years ago
Damien George
b948de36fb
py: Don't generate unnecessary parse nodes for assignment or kwargs.
This patch eliminates the need for a nested parse node for assignments
and keyword arguments. It saves a little bit of RAM when parsing.
9 years ago
Damien George
9f5f156b9d
py/emitnative: Raise ViperTypeError for unsupported unary ops.
9 years ago
Damien George
7e12a601b8
py/compile: Fix edge case when constant-folding negation of integer.
Also adds tests specifically for testing constant folding.
9 years ago
Paul Sokolovsky
aaa8867d4a
modussl: SSL socket wrapper module based on axTLS.
9 years ago
Damien George
0496de26d3
py: Allow to enable inline assembler without native emitter.
9 years ago
Damien George
58e0f4ac50
py: Allocate parse nodes in chunks to reduce fragmentation and RAM use.
With this patch parse nodes are allocated sequentially in chunks. This
reduces fragmentation of the heap and prevents waste at the end of
individually allocated parse nodes.
Saves roughly 20% of RAM during parse stage.
9 years ago
Damien George
e5635f4ab3
py: Catch all cases of integer (big and small) division by zero.
9 years ago
Damien George
2065373f67
py/mpz: Fix bignum anding of large negative with smaller positive int.
9 years ago
Damien George
2f4e8511cd
py/mpz: Force rhs of mpz_shl_inpl/mpz_shr_inpl to be unsigned.
Python semantics are that rhs of shift must be non-negative, so there's
no need to handle negative values in the underlying mpz implementation.
9 years ago
Damien George
4c02e54298
py/mpz: Raise NotImplError instead of failing assertion.
9 years ago
Damien George
5f3c3ec5e6
py/parsenum: Provide detailed error for int parsing with escaped bytes.
This patch adds more fine grained error message control for errors when
parsing integers (now has terse, normal and detailed). When detailed is
enabled, the error now escapes bytes when printing them so they can be
more easily seen.
9 years ago
Tom Soulanille
f1a9923308
py/objrange: Bugfix for range_subscr() when index is a slice object.
9 years ago
Damien George
9d5e5c08ab
py/compile: Put compiler state on the C stack.
It's relatively small (between 44 and 56 bytes) and helps to reduce heap
pressure and fragmentation during compilation.
9 years ago
Damien George
fbcaf0ea18
py: Slightly simplify compile and emit of star/double-star arguments.
Saves a few bytes of code space and eliminates need for rot_two
bytecode (hence saving RAM and execution time, by a tiny bit).
9 years ago
Delio Brignoli
e6978a4e26
py: Fix call args when a stararg is followed by keyword args.
9 years ago
Alex March
bfb272b9e0
py/repl: Treat escaped quotes correctly in REPL continuation.
Escaped quotes are now recognised correctly in REPL when used
inside normal quotes.
Fixes : #1419
9 years ago
Tom Soulanille
661d9d1901
py/objslice: Fix indent.
9 years ago
Tom Soulanille
aeb62f9ae3
py/objslice: Make slice attributes (start/stop/step) readable.
Configurable with MICROPY_PY_BUILTINS_SLICE_ATTRS. Disabled by default.
9 years ago
Damien George
8b4fb4fe14
py/mpz: Fix calculation of max digit storage for mpz; fix sys.maxsize.
When creating constant mpz's, the length of the mpz must be exactly how
many digits are used (not allocated) otherwise these numbers are not
compatible with dynamically allocated numbers.
Addresses issue #1448 .
9 years ago
Damien George
0af73014cc
lib/mp-readline: Add auto-indent support.
4 spaces are added at start of line to match previous indent, and if
previous line ended in colon.
Backspace deletes 4 space if only spaces begin a line.
Configurable via MICROPY_REPL_AUTO_INDENT. Disabled by default.
9 years ago
Dave Hylands
9d6128acdc
stmhal: fix single precision float printing error
Fixes #1435 .
9 years ago
Damien George
2b000474d9
py/lexer: Properly classify floats that look like hex numbers.
Eg 0e0 almost looks like a hex number but in fact is a float.
9 years ago
Damien George
0be3c70cd8
py/lexer: Raise SyntaxError when unicode char point out of range.
9 years ago
Damien George
081f9325f5
py/lexer: Raise NotImplError for unicode name escape, instead of assert.
9 years ago