diff options
| author | Andrea Corallo | 2019-06-22 17:13:31 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-01-01 11:33:43 +0100 |
| commit | b661d47434e54926f9612e9637d1feb763f653ef (patch) | |
| tree | 633cb6c046dbc69cd0a46bf61614de566456122d /src/comp.c | |
| parent | 7cbfd437a9bb2bcb5f4d776bb09572bb50965102 (diff) | |
| download | emacs-b661d47434e54926f9612e9637d1feb763f653ef.tar.gz emacs-b661d47434e54926f9612e9637d1feb763f653ef.zip | |
better emit_lisp_obj_from_ptr
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 19 |
1 files changed, 15 insertions, 4 deletions
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 * | |||
| 671 | emit_lisp_obj_from_ptr (basic_block_t *bblock, void *p) | 671 | emit_lisp_obj_from_ptr (basic_block_t *bblock, void *p) |
| 672 | { | 672 | { |
| 673 | static unsigned i; | 673 | static unsigned i; |
| 674 | char ptr_var_name[40]; | 674 | char scratch[256]; |
| 675 | 675 | ||
| 676 | int res = snprintf (ptr_var_name, sizeof (ptr_var_name), | 676 | int res = snprintf (scratch, sizeof (scratch), |
| 677 | "lisp_obj_from_ptr_%u", i++); | 677 | "lisp_obj_from_ptr_%u", i++); |
| 678 | if (res >= sizeof (ptr_var_name)) | 678 | if (res >= sizeof (scratch)) |
| 679 | error ("Internal error, truncating temporary variable"); | 679 | error ("Internal error, truncating temporary variable"); |
| 680 | 680 | ||
| 681 | gcc_jit_lvalue *lisp_obj = gcc_jit_function_new_local (comp.func, | 681 | gcc_jit_lvalue *lisp_obj = gcc_jit_function_new_local (comp.func, |
| 682 | NULL, | 682 | NULL, |
| 683 | comp.lisp_obj_type, | 683 | comp.lisp_obj_type, |
| 684 | ptr_var_name); | 684 | scratch); |
| 685 | gcc_jit_rvalue *void_ptr = | 685 | gcc_jit_rvalue *void_ptr = |
| 686 | gcc_jit_context_new_rvalue_from_ptr(comp.ctxt, | 686 | gcc_jit_context_new_rvalue_from_ptr(comp.ctxt, |
| 687 | comp.void_ptr_type, | 687 | comp.void_ptr_type, |
| 688 | p); | 688 | p); |
| 689 | 689 | ||
| 690 | if (SYMBOLP (p)) | ||
| 691 | { | ||
| 692 | snprintf (scratch, sizeof (scratch), | ||
| 693 | "Symbol %s", (char *) SDATA (SYMBOL_NAME (p))); | ||
| 694 | gcc_jit_block_add_comment (bblock->gcc_bb, | ||
| 695 | NULL, | ||
| 696 | scratch); | ||
| 697 | } | ||
| 698 | |||
| 690 | gcc_jit_block_add_assignment (bblock->gcc_bb, | 699 | gcc_jit_block_add_assignment (bblock->gcc_bb, |
| 691 | NULL, | 700 | NULL, |
| 692 | emit_lval_XLP (lisp_obj), | 701 | emit_lval_XLP (lisp_obj), |
| @@ -697,6 +706,8 @@ emit_lisp_obj_from_ptr (basic_block_t *bblock, void *p) | |||
| 697 | static gcc_jit_rvalue * | 706 | static gcc_jit_rvalue * |
| 698 | emit_scratch_callN (const char *f_name, unsigned nargs, gcc_jit_rvalue **args) | 707 | emit_scratch_callN (const char *f_name, unsigned nargs, gcc_jit_rvalue **args) |
| 699 | { | 708 | { |
| 709 | char tmp_str[256]; | ||
| 710 | |||
| 700 | /* Here we set all the pointers into the scratch call area. */ | 711 | /* Here we set all the pointers into the scratch call area. */ |
| 701 | /* TODO: distinguish primitives for faster calling convention. */ | 712 | /* TODO: distinguish primitives for faster calling convention. */ |
| 702 | 713 | ||