diff options
| author | Damien George <damien.p.george@gmail.com> | 2018-10-13 13:59:19 +1100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2018-10-13 15:16:33 +1100 |
| commit | 355eb8eafb1a0b0e096cd452d1107ab45bbf72c4 (patch) | |
| tree | b79f788c6347514d43c78f91e21ebdd7e31365f4 /py/emitnative.c | |
| parent | b7c6f859d06a3a4270f98561827ba5ae360fee74 (diff) | |
py/asmx86: Change indirect calls to load fun ptr from the native table.
Instead of storing the function pointer directly in the assembly code.
This makes the generated code more independent of the runtime (so easier to
relocate the code), and reduces the generated code size.
Diffstat (limited to 'py/emitnative.c')
| -rw-r--r-- | py/emitnative.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/py/emitnative.c b/py/emitnative.c index 81669af7c..4d6c3445f 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -379,6 +379,8 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop asm_arm_mov_reg_i32(emit->as, ASM_ARM_REG_R7, (mp_uint_t)mp_fun_table); #elif N_XTENSA ASM_MOV_REG_IMM(emit->as, ASM_XTENSA_REG_A15, (uint32_t)mp_fun_table); + #elif N_X86 + asm_x86_mov_i32_to_r32(emit->as, (intptr_t)mp_fun_table, ASM_X86_REG_EBP); #elif N_X64 asm_x64_mov_i64_to_r64_optimised(emit->as, (intptr_t)mp_fun_table, ASM_X64_REG_RBP); #endif @@ -471,6 +473,8 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop asm_arm_mov_reg_i32(emit->as, ASM_ARM_REG_R7, (mp_uint_t)mp_fun_table); #elif N_XTENSA ASM_MOV_REG_IMM(emit->as, ASM_XTENSA_REG_A15, (uint32_t)mp_fun_table); + #elif N_X86 + asm_x86_mov_i32_to_r32(emit->as, (intptr_t)mp_fun_table, ASM_X86_REG_EBP); #elif N_X64 asm_x64_mov_i64_to_r64_optimised(emit->as, (intptr_t)mp_fun_table, ASM_X64_REG_RBP); #endif |
