aboutsummaryrefslogtreecommitdiffstats
path: root/src/comp.c
diff options
context:
space:
mode:
authorAndrea Corallo2019-07-09 14:46:52 +0200
committerAndrea Corallo2020-01-01 11:33:51 +0100
commite46c54e7387523e22f2ce371fd991d1edb4b09cb (patch)
treeb1708914675e0f69a033de02f027c5ed55588396 /src/comp.c
parentcd55772c8c4fea27b344633dec7ad893cf799036 (diff)
downloademacs-e46c54e7387523e22f2ce371fd991d1edb4b09cb.tar.gz
emacs-e46c54e7387523e22f2ce371fd991d1edb4b09cb.zip
introduce FUNCALL1 macro
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/comp.c b/src/comp.c
index e524e28b143..7c97560d2e6 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -37,6 +37,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
37 37
38#define STR(s) #s 38#define STR(s) #s
39 39
40#define FUNCALL1(fun, arg) \
41 CALLN (Ffuncall, intern (STR(fun)), arg)
42
40#define DECL_BLOCK(name, func) \ 43#define DECL_BLOCK(name, func) \
41 gcc_jit_block *(name) = \ 44 gcc_jit_block *(name) = \
42 gcc_jit_function_new_block ((func), STR(name)) 45 gcc_jit_function_new_block ((func), STR(name))
@@ -981,7 +984,7 @@ emit_limple_inst (Lisp_Object inst)
981 { 984 {
982 gcc_jit_rvalue *ret_val = 985 gcc_jit_rvalue *ret_val =
983 emit_lisp_obj_from_ptr ( 986 emit_lisp_obj_from_ptr (
984 CALLN (Ffuncall, intern ("comp-mvar-constant"), arg0)); 987 FUNCALL1 (comp-mvar-constant, arg0));
985 gcc_jit_block_end_with_return (comp.block, 988 gcc_jit_block_end_with_return (comp.block,
986 NULL, 989 NULL,
987 ret_val); 990 ret_val);
@@ -1845,17 +1848,12 @@ DEFUN ("comp-add-func-to-ctxt", Fcomp_add_func_to_ctxt, Scomp_add_func_to_ctxt,
1845 doc: /* Add limple FUNC to the current compilation context. */) 1848 doc: /* Add limple FUNC to the current compilation context. */)
1846 (Lisp_Object func) 1849 (Lisp_Object func)
1847{ 1850{
1848 char *c_name = 1851 char *c_name = (char *) SDATA (FUNCALL1 (comp-func-c-func-name, func));
1849 (char *) SDATA (CALLN (Ffuncall, intern ("comp-func-c-func-name"), func)); 1852 Lisp_Object args = FUNCALL1 (comp-func-args, func);
1850 Lisp_Object args = (CALLN (Ffuncall, intern ("comp-func-args"), func)); 1853 EMACS_INT frame_size = XFIXNUM (FUNCALL1 (comp-func-frame-size, func));
1851 EMACS_INT frame_size = 1854 EMACS_INT min_args = XFIXNUM (FUNCALL1 (comp-args-min, args));
1852 XFIXNUM (CALLN (Ffuncall, intern ("comp-func-frame-size"), func)); 1855 EMACS_INT max_args = XFIXNUM (FUNCALL1 (comp-args-max, args));
1853 EMACS_INT min_args = 1856 bool ncall = !NILP (FUNCALL1 (comp-args-ncall-conv, args));
1854 XFIXNUM (CALLN (Ffuncall, intern ("comp-args-min"), args));
1855 EMACS_INT max_args =
1856 XFIXNUM (CALLN (Ffuncall, intern ("comp-args-max"), args));
1857 bool ncall =
1858 !NILP (CALLN (Ffuncall, intern ("comp-args-ncall-conv"), args));
1859 1857
1860 if (!ncall) 1858 if (!ncall)
1861 { 1859 {
@@ -1892,7 +1890,7 @@ DEFUN ("comp-add-func-to-ctxt", Fcomp_add_func_to_ctxt, Scomp_add_func_to_ctxt,
1892 comp.func_blocks = CALLN (Fmake_hash_table, QCtest, Qequal, QCweakness, Qt); 1890 comp.func_blocks = CALLN (Fmake_hash_table, QCtest, Qequal, QCweakness, Qt);
1893 1891
1894 /* Pre declare all basic blocks. */ 1892 /* Pre declare all basic blocks. */
1895 Lisp_Object blocks = (CALLN (Ffuncall, intern ("comp-func-blocks"), func)); 1893 Lisp_Object blocks = FUNCALL1 (comp-func-blocks, func);
1896 while (CONSP (blocks)) 1894 while (CONSP (blocks))
1897 { 1895 {
1898 char *block_name = (char *) SDATA (SYMBOL_NAME (XCAR (blocks))); 1896 char *block_name = (char *) SDATA (SYMBOL_NAME (XCAR (blocks)));
@@ -1900,7 +1898,7 @@ DEFUN ("comp-add-func-to-ctxt", Fcomp_add_func_to_ctxt, Scomp_add_func_to_ctxt,
1900 blocks = XCDR (blocks); 1898 blocks = XCDR (blocks);
1901 } 1899 }
1902 1900
1903 Lisp_Object limple = (CALLN (Ffuncall, intern ("comp-func-ir"), func)); 1901 Lisp_Object limple = FUNCALL1 (comp-func-ir, func);
1904 1902
1905 while (CONSP (limple)) 1903 while (CONSP (limple))
1906 { 1904 {
@@ -1941,17 +1939,14 @@ DEFUN ("comp-compile-and-load-ctxt", Fcomp_compile_and_load_ctxt,
1941 { 1939 {
1942 union Aligned_Lisp_Subr *x = xmalloc (sizeof (union Aligned_Lisp_Subr)); 1940 union Aligned_Lisp_Subr *x = xmalloc (sizeof (union Aligned_Lisp_Subr));
1943 Lisp_Object func = XCAR (comp.funcs); 1941 Lisp_Object func = XCAR (comp.funcs);
1944 Lisp_Object args = (CALLN (Ffuncall, intern ("comp-func-args"), func)); 1942 Lisp_Object args = FUNCALL1 (comp-func-args, func);
1945 char *c_name = 1943 char *c_name = (char *) SDATA (FUNCALL1 (comp-func-c-func-name, func));
1946 (char *) SDATA (CALLN (Ffuncall,
1947 intern ("comp-func-c-func-name"),
1948 func));
1949 1944
1950 x->s.header.size = PVEC_SUBR << PSEUDOVECTOR_AREA_BITS; 1945 x->s.header.size = PVEC_SUBR << PSEUDOVECTOR_AREA_BITS;
1951 x->s.function.a0 = gcc_jit_result_get_code(gcc_res, c_name); 1946 x->s.function.a0 = gcc_jit_result_get_code(gcc_res, c_name);
1952 eassert (x->s.function.a0); 1947 eassert (x->s.function.a0);
1953 x->s.min_args = XFIXNUM (CALLN (Ffuncall, intern ("comp-args-min"), args)); 1948 x->s.min_args = XFIXNUM (FUNCALL1 (comp-args-min, args));
1954 x->s.max_args = XFIXNUM (CALLN (Ffuncall, intern ("comp-args-min"), args)); 1949 x->s.max_args = XFIXNUM (FUNCALL1 (comp-args-min, args));
1955 x->s.symbol_name = "foo"; 1950 x->s.symbol_name = "foo";
1956 defsubr(x); 1951 defsubr(x);
1957 1952