mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-27 02:10:52 -08:00
better emit_lisp_obj_from_ptr
This commit is contained in:
parent
7cbfd437a9
commit
b661d47434
1 changed files with 15 additions and 4 deletions
19
src/comp.c
19
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. */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue