In gfunc_call, regisger will be saved before gcall_or_jmp. The register stored the function will be saved too, though in some generator the SValue of this function will be immediately poped after gcall_or_jmp, and no need to be saved. So I modify some generator to avoid save redundant SValue before gcall_or_jmp.
Unified · Split
| @@ -1187,7 +1187,7 @@ again: · 1186 unmodified lines | |||
| 1187 | 1187 | ||
| 1188 | /* Manually free remaining registers since next parameters are loaded | 1188 | /* Manually free remaining registers since next parameters are loaded |
| 1189 | * manually, without the help of gv(int). */ | 1189 | * manually, without the help of gv(int). */ |
| 1190 | save_regs(nb_args); | 1190 | save_regs(nb_args+1); |
| 1191 | 1191 | ||
| 1192 | if(todo) { | 1192 | if(todo) { |
| 1193 | o(0xE8BD0000|todo); /* pop {todo} */ | 1193 | o(0xE8BD0000|todo); /* pop {todo} */ |
| @@ -948,7 +948,7 @@ ST_FUNC void gfunc_call(int nb_args) · 947 unmodified lines | |||
| 948 | vswap(); | 948 | vswap(); |
| 949 | } | 949 | } |
| 950 | 950 | ||
| 951 | save_regs(0); | 951 | save_regs(1); |
| 952 | arm64_gen_bl_or_b(0); | 952 | arm64_gen_bl_or_b(0); |
| 953 | --vtop; | 953 | --vtop; |
| 954 | if (stack) | 954 | if (stack) |
| @@ -475,7 +475,7 @@ ST_FUNC void gfunc_call(int nb_args) · 474 unmodified lines | |||
| 475 | } | 475 | } |
| 476 | vtop--; | 476 | vtop--; |
| 477 | } | 477 | } |
| 478 | save_regs(0); /* save used temporary registers */ | 478 | save_regs(1); /* save used temporary registers */ |
| 479 | func_sym = vtop->type.ref; | 479 | func_sym = vtop->type.ref; |
| 480 | func_call = func_sym->f.func_call; | 480 | func_call = func_sym->f.func_call; |
| 481 | /* fast call case */ | 481 | /* fast call case */ |
| @@ -903,7 +903,6 @@ void gfunc_call(int nb_args) · 902 unmodified lines | |||
| 903 | vtop--; | 903 | vtop--; |
| 904 | } | 904 | } |
| 905 | save_regs(0); | 905 | save_regs(0); |
| 906 | |||
| 907 | /* Copy R10 and R11 into RCX and RDX, respectively */ | 906 | /* Copy R10 and R11 into RCX and RDX, respectively */ |
| 908 | if (nb_args > 0) { | 907 | if (nb_args > 0) { |
| 909 | o(0xd1894c); /* mov %r10, %rcx */ | 908 | o(0xd1894c); /* mov %r10, %rcx */ |