aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-07-15 12:15:22 +0200
committerAndrea Corallo2020-07-15 22:40:30 +0200
commit82169a3d97014c3eae5e7bad4aabb9220dd26b3b (patch)
tree3931482d0887bde48ac78f885df628c928deec65 /src
parent4c46f8bac0ad3ee89ada767a6dd651411c1319a5 (diff)
downloademacs-82169a3d97014c3eae5e7bad4aabb9220dd26b3b.tar.gz
emacs-82169a3d97014c3eae5e7bad4aabb9220dd26b3b.zip
* Fix bug#42360
* src/comp.c (compile_function): Allocate function frame as array if non local exits are present to retain correct Elisp semantic. (emit_limple_call_ref): Directly use the frame array for ref calls to have GCC spills into it before calling.
Diffstat (limited to 'src')
-rw-r--r--src/comp.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/src/comp.c b/src/comp.c
index 8f7a48443cf..704bd4b6b35 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -1839,6 +1839,17 @@ emit_limple_call_ref (Lisp_Object insn, bool direct)
1839 Lisp_Object callee = FIRST (insn); 1839 Lisp_Object callee = FIRST (insn);
1840 EMACS_INT nargs = XFIXNUM (Flength (CDR (insn))); 1840 EMACS_INT nargs = XFIXNUM (Flength (CDR (insn)));
1841 1841
1842 if (!nargs)
1843 return emit_call_ref (callee, 0, comp.frame[0], direct);
1844
1845 if (comp.func_has_non_local || !comp.func_speed)
1846 {
1847 /* FIXME: See bug#42360. */
1848 Lisp_Object first_arg = SECOND (insn);
1849 EMACS_INT first_slot = XFIXNUM (CALL1I (comp-mvar-slot, first_arg));
1850 return emit_call_ref (callee, nargs, comp.frame[first_slot], direct);
1851 }
1852
1842 gcc_jit_lvalue *tmp_arr = 1853 gcc_jit_lvalue *tmp_arr =
1843 gcc_jit_function_new_local ( 1854 gcc_jit_function_new_local (
1844 comp.func, 1855 comp.func,
@@ -3757,12 +3768,36 @@ compile_function (Lisp_Object func)
3757 comp.func_speed = XFIXNUM (CALL1I (comp-func-speed, func)); 3768 comp.func_speed = XFIXNUM (CALL1I (comp-func-speed, func));
3758 3769
3759 comp.frame = SAFE_ALLOCA (frame_size * sizeof (*comp.frame)); 3770 comp.frame = SAFE_ALLOCA (frame_size * sizeof (*comp.frame));
3760 for (ptrdiff_t i = 0; i < frame_size; ++i) 3771 if (comp.func_has_non_local || !comp.func_speed)
3761 comp.frame[i] = 3772 {
3762 gcc_jit_function_new_local (comp.func, 3773 /* FIXME: See bug#42360. */
3763 NULL, 3774 gcc_jit_lvalue *arr =
3764 comp.lisp_obj_type, 3775 gcc_jit_function_new_local (
3765 format_string ("slot_%td", i)); 3776 comp.func,
3777 NULL,
3778 gcc_jit_context_new_array_type (comp.ctxt,
3779 NULL,
3780 comp.lisp_obj_type,
3781 frame_size),
3782 "frame");
3783
3784 for (ptrdiff_t i = 0; i < frame_size; ++i)
3785 comp.frame[i] =
3786 gcc_jit_context_new_array_access (
3787 comp.ctxt,
3788 NULL,
3789 gcc_jit_lvalue_as_rvalue (arr),
3790 gcc_jit_context_new_rvalue_from_int (comp.ctxt,
3791 comp.int_type,
3792 i));
3793 }
3794 else
3795 for (ptrdiff_t i = 0; i < frame_size; ++i)
3796 comp.frame[i] =
3797 gcc_jit_function_new_local (comp.func,
3798 NULL,
3799 comp.lisp_obj_type,
3800 format_string ("slot_%td", i));
3766 3801
3767 comp.scratch = NULL; 3802 comp.scratch = NULL;
3768 3803