summaryrefslogtreecommitdiff
path: root/py/emitnative.c
AgeCommit message (Collapse)Author
2016-12-09py: Integrate Xtensa assembler into native emitter.Damien George
The config option MICROPY_EMIT_XTENSA can now be enabled to target the Xtensa architecture with @micropython.native and @micropython.viper decorators.
2016-12-09py: Move arch-specific assembler macros from emitnative to asmXXX.h.Damien George
2016-11-28py: Factor out common code from assemblers into asmbase.[ch].Damien George
All assemblers should "derive" from mp_asm_base_t.
2016-11-10py/emitnative: Fix native import emitter when in viper mode.Damien George
2016-09-19py: Combine 3 comprehension emit functions (list/dict/set) into 1.Damien George
The 3 kinds of comprehensions are similar enough that merging their emit functions reduces code size. Decreases in code size in bytes are: bare-arm:24, minimal:96, unix(NDEBUG,x86-64):328, stmhal:80, esp8266:76.
2016-08-27py: Rename struct mp_code_state to mp_code_state_t.Damien George
Also at _t to mp_exc_stack pre-declaration in struct typedef.
2016-04-26py/emitnative: Use MP_OBJ_NEW_SMALL_INT instead of manual bit shifting.Damien George
2016-04-07py: Implement basic with support in native emitter.Damien George
2016-04-07py: Combine continuous block of emit steps into with_cleanup emit call.Damien George
Because different emitters need to handle with-cleanup in different ways.
2016-02-15py/emitnative: Add check that RHS of viper store is of integral type.Damien George
2016-02-09py/viper: Allow uint as index to load/store, and give better error msg.Damien George
2016-02-02py: Extend native type-sig to use 4 bits, so uint is separate to ptr.Damien George
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.
2015-12-10py: Make UNARY_OP_NOT a first-class op, to agree with Py not semantics.Damien George
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.
2015-11-29py/emit: Change type of arg of load_const_obj from void* to mp_obj_t.Damien George
2015-11-13py: Add MICROPY_PERSISTENT_CODE so code can persist beyond the runtime.Damien George
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.
2015-11-13py: Add constant table to bytecode.Damien George
Contains just argument names at the moment but makes it easy to add arbitrary constants.
2015-11-13py: Put all bytecode state (arg count, etc) in bytecode.Damien George
2015-11-13py: Reorganise bytecode layout so it's more structured, easier to edit.Damien George
2015-10-14py: Fix build of ARM native emitter due to recent viper changes.Damien George
Addresses #1510.
2015-10-13py: Implement ptr32 load and store in viper emitter.Damien George
2015-10-08py/emitnative: Raise ViperTypeError for unsupported unary ops.Damien George
2015-09-23py: Slightly simplify compile and emit of star/double-star arguments.Damien George
Saves a few bytes of code space and eliminates need for rot_two bytecode (hence saving RAM and execution time, by a tiny bit).
2015-08-12py: In native ARM emitter, load r7 with table earlier in func prelude.Damien George
r7 may be needed to set up code state, so it must be loaded before the set-up function is called.
2015-07-27py: For viper compile errors, add traceback with function and filename.Damien George
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.
2015-07-23py: Issue an error when compiling Viper functions with more than 4 args.Damien George
Otherwise it can be very hard to track down bugs.
2015-06-25py: Remove mp_load_const_bytes and instead load precreated bytes object.Damien George
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.
2015-06-25py: Remove mp_load_const_str and replace uses with inlined version.Damien George
2015-06-04py: Implement native multiply operation in viper emitter.Damien George
2015-06-04py: Implement implicit cast to obj for viper load/store index/value.Damien George
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.
2015-05-08emitnative: Revamp ARM codegen compile after full-arg support refactors.Paul Sokolovsky
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.
2015-05-06py: Fix naming of function arguments when function is a closure.Damien George
Addresses issue #1226.
2015-04-22py/emitnative.c: Fix stack adjustment when erroring on binary op.Damien George
2015-04-20py: Make viper codegen raise proper exception (ViperTypeError) on error.Damien George
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.
2015-04-16py: Add %q format support to mp_[v]printf, and use it.Damien George
2015-04-16py: Convert occurrences of non-debug printf to mp_printf.Damien George
2015-04-07py: Implement full func arg passing for native emitter.Damien George
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.
2015-04-06py: Implement calling functions with *args in native emitter.Damien George
2015-04-03py: Fix bug in native emitter when closing over an argument.Damien George
2015-04-03py: Get native emitter working again with x86 (now supports closures).Damien George
2015-04-03py: Implement closures in native code generator.Damien George
Currently supports only x64 and Thumb2 archs.
2015-04-03py: Implement (non-compliant) support for delete_fast in native emitter.Damien George
This implementation is smaller (in code size) than #1024.
2015-04-01py: Fix emitnative's creation of small ints so it uses the macro.Damien George
2015-03-26py: Increase fixed size of stack-info in native emitter.Damien George
This is a temporary fix.
2015-03-26py, compiler: Refactor load/store/delete_id logic to reduce code size.Damien George
Saves around 230 bytes on Thumb2 and 750 bytes on x86.
2015-02-28py: Combine emit functions for jump true/false to reduce code size.Damien George
Saves 116 bytes for stmhal and 56 bytes for cc3200 port.
2015-02-09py: Remove obsolete MP_F_LOAD_CONST_{INT,DEC} from emitnative.c.Damien George
2015-02-08py: Parse big-int/float/imag constants directly in parser.Damien George
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.
2015-01-29py: Implement Ellipsis object in native emitter.Damien George
2015-01-24py: Don't use anonymous unions, name them instead.Damien George
This makes the code (more) compatible with the C99 standard.
2015-01-21py: Implement proper re-raising in native codegen's finally handler.Damien George
This allows an exception to propagate correctly through a finally handler.