summaryrefslogtreecommitdiff
path: root/py/compile.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-12-09 21:23:17 +1100
committerDamien George <damien.p.george@gmail.com>2016-12-09 21:23:17 +1100
commite920bab9768f71c7e22fcfc5af3e1c40f2db8eeb (patch)
tree70fe0b48f904fed208fbf0726db09f0250101dba /py/compile.c
parentdd53b12193dca4800ab207170fcc883142dd0f22 (diff)
py/emitinline: Move common code for end of final pass to compiler.
This patch moves some common code from the individual inline assemblers to the compiler, the code that calls the emit-glue to assign the machine code to the functions scope.
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/py/compile.c b/py/compile.c
index f98b783b5..43a0bf454 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -3127,7 +3127,7 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
}
if (comp->pass > MP_PASS_SCOPE) {
- EMIT_INLINE_ASM_ARG(start_pass, comp->pass, comp->scope_cur, &comp->compile_error);
+ EMIT_INLINE_ASM_ARG(start_pass, comp->pass, &comp->compile_error);
}
// get the function definition parse node
@@ -3258,6 +3258,13 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
if (comp->pass > MP_PASS_SCOPE) {
EMIT_INLINE_ASM_ARG(end_pass, type_sig);
+
+ if (comp->pass == MP_PASS_EMIT) {
+ void *f = mp_asm_base_get_code((mp_asm_base_t*)comp->emit_inline_asm);
+ mp_emit_glue_assign_native(comp->scope_cur->raw_code, MP_CODE_NATIVE_ASM,
+ f, mp_asm_base_get_code_size((mp_asm_base_t*)comp->emit_inline_asm),
+ NULL, comp->scope_cur->num_pos_args, 0, type_sig);
+ }
}
if (comp->compile_error != MP_OBJ_NULL) {