From: Andrea Corallo Date: Sat, 22 Jun 2019 15:13:31 +0000 (+0200) Subject: better emit_lisp_obj_from_ptr X-Git-Tag: emacs-28.0.90~2727^2~1459 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b661d47434e54926f9612e9637d1feb763f653ef;p=emacs.git better emit_lisp_obj_from_ptr --- diff --git a/src/comp.c b/src/comp.c index 2b439fd2a56..74102c5536d 100644 --- a/src/comp.c +++ b/src/comp.c @@ -671,22 +671,31 @@ static gcc_jit_rvalue * emit_lisp_obj_from_ptr (basic_block_t *bblock, void *p) { static unsigned i; - char ptr_var_name[40]; + char scratch[256]; - int res = snprintf (ptr_var_name, sizeof (ptr_var_name), + int res = snprintf (scratch, sizeof (scratch), "lisp_obj_from_ptr_%u", i++); - if (res >= sizeof (ptr_var_name)) + if (res >= sizeof (scratch)) error ("Internal error, truncating temporary variable"); gcc_jit_lvalue *lisp_obj = gcc_jit_function_new_local (comp.func, NULL, comp.lisp_obj_type, - ptr_var_name); + scratch); gcc_jit_rvalue *void_ptr = gcc_jit_context_new_rvalue_from_ptr(comp.ctxt, comp.void_ptr_type, p); + if (SYMBOLP (p)) + { + snprintf (scratch, sizeof (scratch), + "Symbol %s", (char *) SDATA (SYMBOL_NAME (p))); + gcc_jit_block_add_comment (bblock->gcc_bb, + NULL, + scratch); + } + gcc_jit_block_add_assignment (bblock->gcc_bb, NULL, emit_lval_XLP (lisp_obj), @@ -697,6 +706,8 @@ emit_lisp_obj_from_ptr (basic_block_t *bblock, void *p) static gcc_jit_rvalue * emit_scratch_callN (const char *f_name, unsigned nargs, gcc_jit_rvalue **args) { + char tmp_str[256]; + /* Here we set all the pointers into the scratch call area. */ /* TODO: distinguish primitives for faster calling convention. */