summaryrefslogtreecommitdiff
path: root/unix-cpy
AgeCommit message (Collapse)Author
2015-08-17unix-cpy: Remove unix-cpy. It's no longer needed.Damien George
unix-cpy was originally written to get semantic equivalent with CPython without writing functional tests. When writing the initial implementation of uPy it was a long way between lexer and functional tests, so the half-way test was to make sure that the bytecode was correct. The idea was that if the uPy bytecode matched CPython 1-1 then uPy would be proper Python if the bytecodes acted correctly. And having matching bytecode meant that it was less likely to miss some deep subtlety in the Python semantics that would require an architectural change later on. But that is all history and it no longer makes sense to retain the ability to output CPython bytecode, because: 1. It outputs CPython 3.3 compatible bytecode. CPython's bytecode changes from version to version, and seems to have changed quite a bit in 3.5. There's no point in changing the bytecode output to match CPython anymore. 2. uPy and CPy do different optimisations to the bytecode which makes it harder to match. 3. The bytecode tests are not run. They were never part of Travis and are not run locally anymore. 4. The EMIT_CPYTHON option needs a lot of extra source code which adds heaps of noise, especially in compile.c. 5. Now that there is an extensive test suite (which tests functionality) there is no need to match the bytecode. Some very subtle behaviour is tested with the test suite and passing these tests is a much better way to stay Python-language compliant, rather than trying to match CPy bytecode.
2015-04-16py: Overhaul and simplify printf/pfenv mechanism.Damien George
Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
2015-03-14py: Add MICROPY_COMP_{DOUBLE,TRIPLE}_TUPLE_ASSIGN config options.Damien George
These allow to fine-tune the compiler to select whether it optimises tuple assignments of the form a, b = c, d and a, b, c = d, e, f. Sensible defaults are provided.
2015-02-07unix-cpy: Fix compiler warning about unused variable.Damien George
2015-02-07py: Protect mp_parse and mp_compile with nlr push/pop block.Damien George
To enable parsing constants more efficiently, mp_parse should be allowed to raise an exception, and mp_compile can already raise a MemoryError. So these functions need to be protected by an nlr push/pop block. This patch adds that feature in all places. This allows to simplify how mp_parse and mp_compile are called: they now raise an exception if they have an error and so explicit checking is not needed anymore.
2015-01-01unix-cpy: Prefix includes with py/; remove need for -I../py.Damien George
2015-01-01py: Move to guarded includes, everywhere in py/ core.Damien George
Addresses issue #1022.
2014-12-27Makefiles: Support py/*.h includes per #1022.Paul Sokolovsky
2014-12-08modsys: Add sys.print_exception(exc, file=sys.stdout) function.Paul Sokolovsky
The function is modeled after traceback.print_exception(), but unbloated, and put into existing module to save overhead on adding another module. Compliant traceback.print_exception() is intended to be implemented in micropython-lib in terms of sys.print_exception(). This change required refactoring mp_obj_print_exception() to take pfenv_t interface arguments. Addresses #751.
2014-12-05unix-cpy: Fix build due to change in lexer API.Damien George
2014-11-17ports: Define mp_off_t.Paul Sokolovsky
2014-10-29Add -Wpointer-arith flag to prevent problems with pointer arithmetic on void*stijn
2014-10-05py: Make compiler return a proper exception on SyntaxError.Damien George
2014-08-04Put call to qstr_init and mp_init_emergency_exc_buf in mp_init.Damien George
qstr_init is always called exactly before mp_init, so makes sense to just have mp_init call it. Similarly with mp_init_emergency_exception_buf. Doing this makes the ports simpler and less error prone (ie they can no longer forget to call these).
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.
2014-06-08Provide definition of alloca() in mpconfigport.h.Damien George
2014-05-24Rename configuration variables controling Python features.Damien George
Now of the form MICROPY_PY_*. See issue #35.
2014-05-21Tidy up some configuration options.Damien George
MP_ALLOC_* -> MICROPY_ALLOC_* MICROPY_PATH_MAX -> MICROPY_ALLOC_PATH_MAX MICROPY_ENABLE_REPL_HELPERS -> MICROPY_HELPER_REPL MICROPY_ENABLE_LEXER_UNIX -> MICROPY_HELPER_LEXER_UNIX MICROPY_EXTRA_* -> MICROPY_PORT_* See issue #35.
2014-05-03Add license header to (almost) all files.Damien George
Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-05-02unix-cpy: Put mpconfig.h before all other headers.Damien George
2014-04-17build: Simplify build directory layout by putting all headers in genhdr.Damien George
Any generated headers go in $(BUILD)/genhdr/, and are #included as 'genhdr/xxx.h'.
2014-04-16build directory can now be renamedAndrew Scheller
The autogenerated header files have been moved about, and an extra include dir has been added, which means you can give a custom BUILD=newbuilddir option to make, and everything "just works" Also tidied up the way the different Makefiles build their include- directory flags
2014-04-13bare-arm/unix-cpy: Minor changes.Damien George
2014-04-08Add a check for NULL nlr_top in nlr_jump.Damien George
If no nlr_buf has been pushed, and an nlr_jump is called, then control is transferred to nlr_jump_fail (which should bail out with a fatal error).
2014-04-06unix-cpy: Pass emit opt to mp_compile.Damien George
2014-04-03py: Add "io" module.Paul Sokolovsky
So far just includes "open" function, which should be supplied by a port. TODO: Make the module #ifdef'ed.
2014-03-30Rename rt_* to mp_*.Damien George
Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
2014-03-27py: Factor out code from runtime.c to emitglue.c.Damien George
2014-03-16unix-cpy: Switch to use MICROPY_FLOAT_IMPL config define.Paul Sokolovsky
2014-02-15Implement proper exception type hierarchy.Damien George
Each built-in exception is now a type, with base type BaseException. C exceptions are created by passing a pointer to the exception type to make an instance of. When raising an exception from the VM, an instance is created automatically if an exception type is raised (as opposed to an exception instance). Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper. Handling of parse error changed to match new exceptions. mp_const_type renamed to mp_type_type for consistency.
2014-02-06Add mp_import_stat to unix-cpy port.Damien George
2014-01-26Change -Og to -O0 in unix-cpy/Makefile; cast to small int in socket.c.Damien George
2014-01-24Rework makefiles. Add proper dependency checking.Dave Hylands
2014-01-22Second stage of qstr revamp: uPy str object can be qstr or not.Damien George
2014-01-21Revamp qstrs: they now include length and hash.Damien George
Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
2014-01-19py: Add module/function/class name to exceptions.Damien George
Exceptions know source file, line and block name. Also tidy up some debug printing functions and provide a global flag to enable/disable them.
2014-01-18Add source file name and line number to error messages.Damien George
Byte code has a map from byte-code offset to source-code line number, used to give better error messages.
2014-01-15Merge branch 'str2int' of github.com:xyb/micropython into xyb-str2intDamien George
Conflicts: py/objint.c unix-cpy/Makefile unix/Makefile
2014-01-15Convert parse errors to exceptions.Damien George
Parser no longer prints an error, but instead returns an exception ID and message.
2014-01-14Implemented int(str) in UNIXxyb
2014-01-13made DEBUG control CFLAGS in Makefiles oter than stm as well.John R. Lenton
2014-01-08Make build output quieter.Dave Hylands
Use make V=1e make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity. This should fix issue #117
2014-01-07Factor and simplify Makefile's and mpconfig, part 2.Damien George
2014-01-07Factor and simplify Makefile's and mpconfig.Damien George
2014-01-04Convert Python types to proper Python type hierarchy.Damien George
Now much more inline with how CPython does types.
2014-01-04Add basic implementation of slice object.Paul Sokolovsky
So far, only start and stop integer indexes are supported. Step is not supported, as well as objects of arbitrary types.
2014-01-04Move INT_FMT, etc. declaration into global mpconfig.h .Paul Sokolovsky
This in particular makes it available for stm port.
2014-01-03unix-cpy: Fix mpconfig to work with new scheme.Damien George
2014-01-03Change mp_compile so that it returns a function object for the module.Damien George
2014-01-03Basic implementation of import.Damien George
import works for simple cases. Still work to do on finding the right script, and setting globals/locals correctly when running an imported function.