summaryrefslogtreecommitdiffstatshomepage
path: root/py/emitnative.c
Commit message (Collapse)AuthorAge
* py/emitnative: Add check that RHS of viper store is of integral type.Damien George2016-02-15
|
* py/viper: Allow uint as index to load/store, and give better error msg.Damien George2016-02-09
|
* py: Extend native type-sig to use 4 bits, so uint is separate to ptr.Damien George2016-02-02
| | | | | | | Before this patch, the native types for uint and ptr/ptr8/ptr16/ptr32 all overlapped and it was possible to make a mistake in casting. Now, these types are all separate and any coding mistakes will be raised as runtime errors.
* py: Make UNARY_OP_NOT a first-class op, to agree with Py not semantics.Damien George2015-12-10
| | | | | | | | | | | | | | | Fixes #1684 and makes "not" match Python semantics. The code is also simplified (the separate MP_BC_NOT opcode is removed) and the patch saves 68 bytes for bare-arm/ and 52 bytes for minimal/. Previously "not x" was implemented as !mp_unary_op(x, MP_UNARY_OP_BOOL), so any given object only needs to implement MP_UNARY_OP_BOOL (and the VM had a special opcode to do the ! bit). With this patch "not x" is implemented as mp_unary_op(x, MP_UNARY_OP_NOT), but this operation is caught at the start of mp_unary_op and dispatched as !mp_obj_is_true(x). mp_obj_is_true has special logic to test for truthness, and is the correct way to handle the not operation.
* py/emit: Change type of arg of load_const_obj from void* to mp_obj_t.Damien George2015-11-29
|
* py: Add MICROPY_PERSISTENT_CODE so code can persist beyond the runtime.Damien George2015-11-13
| | | | | | | | | | | Main changes when MICROPY_PERSISTENT_CODE is enabled are: - qstrs are encoded as 2-byte fixed width in the bytecode - all pointers are removed from bytecode and put in const_table (this includes const objects and raw code pointers) Ultimately this option will enable persistence for not just bytecode but also native code.
* py: Add constant table to bytecode.Damien George2015-11-13
| | | | | Contains just argument names at the moment but makes it easy to add arbitrary constants.
* py: Put all bytecode state (arg count, etc) in bytecode.Damien George2015-11-13
|
* py: Reorganise bytecode layout so it's more structured, easier to edit.Damien George2015-11-13
|
* py: Fix build of ARM native emitter due to recent viper changes.Damien George2015-10-14
| | | | Addresses #1510.
* py: Implement ptr32 load and store in viper emitter.Damien George2015-10-13
|
* py/emitnative: Raise ViperTypeError for unsupported unary ops.Damien George2015-10-08
|
* py: Slightly simplify compile and emit of star/double-star arguments.Damien George2015-09-23
| | | | | Saves a few bytes of code space and eliminates need for rot_two bytecode (hence saving RAM and execution time, by a tiny bit).
* py: In native ARM emitter, load r7 with table earlier in func prelude.Damien George2015-08-12
| | | | | r7 may be needed to set up code state, so it must be loaded before the set-up function is called.
* py: For viper compile errors, add traceback with function and filename.Damien George2015-07-27
| | | | | | | | | ViperTypeError now includes filename and function name where the error occurred. The line number is the line number of the start of the function definition, which is the best that can be done without a lot more work. Partially addresses issue #1381.
* py: Issue an error when compiling Viper functions with more than 4 args.Damien George2015-07-23
| | | | Otherwise it can be very hard to track down bugs.
* py: Remove mp_load_const_bytes and instead load precreated bytes object.Damien George2015-06-25
| | | | | | | | | | | | | | | | Previous to this patch each time a bytes object was referenced a new instance (with the same data) was created. With this patch a single bytes object is created in the compiler and is loaded directly at execute time as a true constant (similar to loading bignum and float objects). This saves on allocating RAM and means that bytes objects can now be used when the memory manager is locked (eg in interrupts). The MP_BC_LOAD_CONST_BYTES bytecode was removed as part of this. Generated bytecode is slightly larger due to storing a pointer to the bytes object instead of the qstr identifier. Code size is reduced by about 60 bytes on Thumb2 architectures.
* py: Remove mp_load_const_str and replace uses with inlined version.Damien George2015-06-25
|
* py: Implement native multiply operation in viper emitter.Damien George2015-06-04
|
* py: Implement implicit cast to obj for viper load/store index/value.Damien George2015-06-04
| | | | | | | This allows to do "ar[i]" and "ar[i] = val" in viper when ar is a Python object and i and/or val are native viper types (eg ints). Patch also includes tests for this feature.
* emitnative: Revamp ARM codegen compile after full-arg support refactors.Paul Sokolovsky2015-05-08
| | | | | | The code was apparently broken after 9988618e0e0f5c319e31b135d993e22efb593093 "py: Implement full func arg passing for native emitter.". This attempts to propagate those changes to ARM emitter.
* py: Fix naming of function arguments when function is a closure.Damien George2015-05-06
| | | | Addresses issue #1226.
* py/emitnative.c: Fix stack adjustment when erroring on binary op.Damien George2015-04-22
|
* py: Make viper codegen raise proper exception (ViperTypeError) on error.Damien George2015-04-20
| | | | | | | | | | | This fixes a long standing problem that viper code generation gave terrible error messages, and actually no errors on pyboard where assertions are disabled. Now all compile-time errors are raised as proper Python exceptions, and are of type ViperTypeError. Addresses issue #940.
* py: Add %q format support to mp_[v]printf, and use it.Damien George2015-04-16
|
* py: Convert occurrences of non-debug printf to mp_printf.Damien George2015-04-16
|
* py: Implement full func arg passing for native emitter.Damien George2015-04-07
| | | | | | | | | | | This patch gets full function argument passing working with native emitter. Includes named args, keyword args, default args, var args and var keyword args. Fully Python compliant. It reuses the bytecode mp_setup_code_state function to do all the hard work. This function is slightly adjusted to accommodate native calls, and the native emitter is forced a bit to emit similar prelude and code-info as bytecode.
* py: Implement calling functions with *args in native emitter.Damien George2015-04-06
|
* py: Fix bug in native emitter when closing over an argument.Damien George2015-04-03
|
* py: Get native emitter working again with x86 (now supports closures).Damien George2015-04-03
|
* py: Implement closures in native code generator.Damien George2015-04-03
| | | | Currently supports only x64 and Thumb2 archs.
* py: Implement (non-compliant) support for delete_fast in native emitter.Damien George2015-04-03
| | | | This implementation is smaller (in code size) than #1024.
* py: Fix emitnative's creation of small ints so it uses the macro.Damien George2015-04-01
|
* py: Increase fixed size of stack-info in native emitter.Damien George2015-03-26
| | | | This is a temporary fix.
* py, compiler: Refactor load/store/delete_id logic to reduce code size.Damien George2015-03-26
| | | | Saves around 230 bytes on Thumb2 and 750 bytes on x86.
* py: Combine emit functions for jump true/false to reduce code size.Damien George2015-02-28
| | | | Saves 116 bytes for stmhal and 56 bytes for cc3200 port.
* py: Remove obsolete MP_F_LOAD_CONST_{INT,DEC} from emitnative.c.Damien George2015-02-09
|
* py: Parse big-int/float/imag constants directly in parser.Damien George2015-02-08
| | | | | | | | | Previous to this patch, a big-int, float or imag constant was interned (made into a qstr) and then parsed at runtime to create an object each time it was needed. This is wasteful in RAM and not efficient. Now, these constants are parsed straight away in the parser and turned into objects. This allows constants with large numbers of digits (so addresses issue #1103) and takes us a step closer to #722.
* py: Implement Ellipsis object in native emitter.Damien George2015-01-29
|
* py: Don't use anonymous unions, name them instead.Damien George2015-01-24
| | | | This makes the code (more) compatible with the C99 standard.
* py: Implement proper re-raising in native codegen's finally handler.Damien George2015-01-21
| | | | | This allows an exception to propagate correctly through a finally handler.
* py, unix: Allow to compile with -Wunused-parameter.Damien George2015-01-20
| | | | See issue #699.
* py: Remove unnecessary id_flags argument from emitter's load_fast.Damien George2015-01-16
| | | | Saves 24 bytes in bare-arm.
* py, unix: Trace root pointers with native emitter under unix port.Damien George2015-01-14
| | | | | | Native code has GC-heap pointers in it so it must be scanned. But on unix port memory for native functions is mmap'd, and so it must have explicit code to scan it for root pointers.
* py: Add load_const_obj to emitter, add LOAD_CONST_OBJ to bytecode.Damien George2015-01-13
| | | | | This allows to directly load a Python object to the Python stack. See issue #722 for background.
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* emitnative: Disable warning in delete_fast for now (breaks test).Paul Sokolovsky2015-01-01
|
* py: Add basic framework for issuing compile/runtime warnings.Paul Sokolovsky2015-01-01
|
* py: Allow to properly disable builtin slice operation.Damien George2014-12-27
| | | | | | | This patch makes the MICROPY_PY_BUILTINS_SLICE compile-time option fully disable the builtin slice operation (when set to 0). This includes removing the slice sytanx from the grammar. Now, enabling slice costs 4228 bytes on unix x64, and 1816 bytes on stmhal.
* py: Allow to properly disable builtin "set" object.Damien George2014-12-27
| | | | | | | | This patch makes MICROPY_PY_BUILTINS_SET compile-time option fully disable the builtin set object (when set to 0). This includes removing set constructor/comprehension from the grammar, the compiler and the emitters. Now, enabling set costs 8168 bytes on unix x64, and 3576 bytes on stmhal.