diff options
| author | Andrea Corallo | 2019-06-08 16:00:24 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-01-01 11:33:40 +0100 |
| commit | e642113184136a66fee782c3cdec832ec2ba4c0b (patch) | |
| tree | cf6f07375b8a510459024c01fda2ad43278ad41f /src/comp.c | |
| parent | b8aeb2e35d99e14970d15561fcf161ce78fd2426 (diff) | |
| download | emacs-e642113184136a66fee782c3cdec832ec2ba4c0b.tar.gz emacs-e642113184136a66fee782c3cdec832ec2ba4c0b.zip | |
remame compiler functions
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 198 |
1 files changed, 99 insertions, 99 deletions
diff --git a/src/comp.c b/src/comp.c index ddc0bd067f3..c675095cece 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -40,7 +40,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 40 | 40 | ||
| 41 | #define DISASS_FILE_NAME "emacs-asm.s" | 41 | #define DISASS_FILE_NAME "emacs-asm.s" |
| 42 | 42 | ||
| 43 | #define CHECK_STACK \ | 43 | #define CHECK_STACK \ |
| 44 | eassert (stack >= stack_base && stack < stack_over) | 44 | eassert (stack >= stack_base && stack < stack_over) |
| 45 | 45 | ||
| 46 | #define PUSH_LVAL(obj) \ | 46 | #define PUSH_LVAL(obj) \ |
| @@ -125,7 +125,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 125 | #define CASE_CALL_NARGS(name, nargs) \ | 125 | #define CASE_CALL_NARGS(name, nargs) \ |
| 126 | case B##name: \ | 126 | case B##name: \ |
| 127 | POP##nargs; \ | 127 | POP##nargs; \ |
| 128 | res = gcc_emit_call (STR(F##name), comp.lisp_obj_type, nargs, args); \ | 128 | res = comp_emit_call (STR(F##name), comp.lisp_obj_type, nargs, args); \ |
| 129 | PUSH_LVAL (res); \ | 129 | PUSH_LVAL (res); \ |
| 130 | break | 130 | break |
| 131 | 131 | ||
| @@ -135,7 +135,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 135 | #define EMIT_SCRATCH_CALL_N(name, nargs) \ | 135 | #define EMIT_SCRATCH_CALL_N(name, nargs) \ |
| 136 | do { \ | 136 | do { \ |
| 137 | pop (nargs, &stack, args); \ | 137 | pop (nargs, &stack, args); \ |
| 138 | res = gcc_emit_callN (name, nargs, args); \ | 138 | res = comp_emit_callN (name, nargs, args); \ |
| 139 | PUSH_LVAL (res); \ | 139 | PUSH_LVAL (res); \ |
| 140 | } while (0) | 140 | } while (0) |
| 141 | 141 | ||
| @@ -193,7 +193,7 @@ bcall0 (Lisp_Object f) | |||
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | /* Pop form the main evaluation stack and place the elements in args in reversed | 195 | /* Pop form the main evaluation stack and place the elements in args in reversed |
| 196 | order. */ | 196 | order. */ |
| 197 | 197 | ||
| 198 | INLINE static void | 198 | INLINE static void |
| 199 | pop (unsigned n, gcc_jit_lvalue ***stack_ref, gcc_jit_rvalue *args[]) | 199 | pop (unsigned n, gcc_jit_lvalue ***stack_ref, gcc_jit_rvalue *args[]) |
| @@ -212,11 +212,11 @@ pop (unsigned n, gcc_jit_lvalue ***stack_ref, gcc_jit_rvalue *args[]) | |||
| 212 | /* Construct fill and return a lisp object form a raw pointer. */ | 212 | /* Construct fill and return a lisp object form a raw pointer. */ |
| 213 | 213 | ||
| 214 | INLINE static gcc_jit_rvalue * | 214 | INLINE static gcc_jit_rvalue * |
| 215 | gcc_lisp_obj_as_ptr_from_ptr (basic_block_t *bblock, void *p) | 215 | comp_lisp_obj_as_ptr_from_ptr (basic_block_t *bblock, void *p) |
| 216 | { | 216 | { |
| 217 | gcc_jit_lvalue *lisp_obj = gcc_jit_function_new_local (comp.func, | 217 | gcc_jit_lvalue *lisp_obj = gcc_jit_function_new_local (comp.func, |
| 218 | NULL, | 218 | NULL, |
| 219 | comp.lisp_obj_type, | 219 | comp.lisp_obj_type, |
| 220 | "lisp_obj"); | 220 | "lisp_obj"); |
| 221 | gcc_jit_lvalue *lisp_obj_as_ptr = | 221 | gcc_jit_lvalue *lisp_obj_as_ptr = |
| 222 | gcc_jit_lvalue_access_field (lisp_obj, | 222 | gcc_jit_lvalue_access_field (lisp_obj, |
| @@ -236,9 +236,9 @@ gcc_lisp_obj_as_ptr_from_ptr (basic_block_t *bblock, void *p) | |||
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | static gcc_jit_function * | 238 | static gcc_jit_function * |
| 239 | gcc_func_declare (const char *f_name, gcc_jit_type *ret_type, | 239 | comp_func_declare (const char *f_name, gcc_jit_type *ret_type, |
| 240 | unsigned nargs, gcc_jit_rvalue **args, | 240 | unsigned nargs, gcc_jit_rvalue **args, |
| 241 | enum gcc_jit_function_kind kind, bool reusable) | 241 | enum gcc_jit_function_kind kind, bool reusable) |
| 242 | { | 242 | { |
| 243 | gcc_jit_param *param[4]; | 243 | gcc_jit_param *param[4]; |
| 244 | gcc_jit_type *type[4]; | 244 | gcc_jit_type *type[4]; |
| @@ -315,8 +315,8 @@ gcc_func_declare (const char *f_name, gcc_jit_type *ret_type, | |||
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | static gcc_jit_lvalue * | 317 | static gcc_jit_lvalue * |
| 318 | gcc_emit_call (const char *f_name, gcc_jit_type *ret_type, unsigned nargs, | 318 | comp_emit_call (const char *f_name, gcc_jit_type *ret_type, unsigned nargs, |
| 319 | gcc_jit_rvalue **args) | 319 | gcc_jit_rvalue **args) |
| 320 | { | 320 | { |
| 321 | Lisp_Object key = make_string (f_name, strlen (f_name)); | 321 | Lisp_Object key = make_string (f_name, strlen (f_name)); |
| 322 | EMACS_UINT hash = 0; | 322 | EMACS_UINT hash = 0; |
| @@ -325,8 +325,8 @@ gcc_emit_call (const char *f_name, gcc_jit_type *ret_type, unsigned nargs, | |||
| 325 | 325 | ||
| 326 | if (i == -1) | 326 | if (i == -1) |
| 327 | { | 327 | { |
| 328 | gcc_func_declare(f_name, ret_type, nargs, args, GCC_JIT_FUNCTION_IMPORTED, | 328 | comp_func_declare(f_name, ret_type, nargs, args, GCC_JIT_FUNCTION_IMPORTED, |
| 329 | true); | 329 | true); |
| 330 | i = hash_lookup (ht, key, &hash); | 330 | i = hash_lookup (ht, key, &hash); |
| 331 | eassert (i != -1); | 331 | eassert (i != -1); |
| 332 | } | 332 | } |
| @@ -349,21 +349,21 @@ gcc_emit_call (const char *f_name, gcc_jit_type *ret_type, unsigned nargs, | |||
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | static gcc_jit_lvalue * | 351 | static gcc_jit_lvalue * |
| 352 | gcc_emit_callN (const char *f_name, unsigned nargs, gcc_jit_rvalue **args) | 352 | comp_emit_callN (const char *f_name, unsigned nargs, gcc_jit_rvalue **args) |
| 353 | { | 353 | { |
| 354 | /* Here we set all the pointers into the scratch call area. */ | 354 | /* Here we set all the pointers into the scratch call area. */ |
| 355 | /* TODO: distinguish primitives for faster calling convention. */ | 355 | /* TODO: distinguish primitives for faster calling convention. */ |
| 356 | 356 | ||
| 357 | /* | 357 | /* |
| 358 | Lisp_Object *p; | 358 | Lisp_Object *p; |
| 359 | p = scratch_call_area; | 359 | p = scratch_call_area; |
| 360 | 360 | ||
| 361 | p[0] = nargs; | 361 | p[0] = nargs; |
| 362 | p[1] = 0x...; | 362 | p[1] = 0x...; |
| 363 | . | 363 | . |
| 364 | . | 364 | . |
| 365 | . | 365 | . |
| 366 | p[n] = 0x...; | 366 | p[n] = 0x...; |
| 367 | */ | 367 | */ |
| 368 | 368 | ||
| 369 | gcc_jit_lvalue *p = | 369 | gcc_jit_lvalue *p = |
| @@ -395,7 +395,7 @@ gcc_emit_callN (const char *f_name, unsigned nargs, gcc_jit_rvalue **args) | |||
| 395 | nargs); | 395 | nargs); |
| 396 | args[1] = comp.scratch; | 396 | args[1] = comp.scratch; |
| 397 | 397 | ||
| 398 | return gcc_emit_call (f_name, comp.lisp_obj_type, 2, args); | 398 | return comp_emit_call (f_name, comp.lisp_obj_type, 2, args); |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | static int | 401 | static int |
| @@ -518,9 +518,9 @@ compute_bblocks (ptrdiff_t bytestr_length, unsigned char *bytestr_data) | |||
| 518 | /* Close current basic block emitting a conditional. */ | 518 | /* Close current basic block emitting a conditional. */ |
| 519 | 519 | ||
| 520 | static gcc_jit_rvalue * | 520 | static gcc_jit_rvalue * |
| 521 | gcc_emit_conditional (enum gcc_jit_comparison op, | 521 | comp_emit_conditional (enum gcc_jit_comparison op, |
| 522 | gcc_jit_rvalue *a, gcc_jit_rvalue *b, | 522 | gcc_jit_rvalue *a, gcc_jit_rvalue *b, |
| 523 | gcc_jit_block *then_target, gcc_jit_block *else_target) | 523 | gcc_jit_block *then_target, gcc_jit_block *else_target) |
| 524 | { | 524 | { |
| 525 | gcc_jit_rvalue *test = gcc_jit_context_new_comparison (comp.ctxt, | 525 | gcc_jit_rvalue *test = gcc_jit_context_new_comparison (comp.ctxt, |
| 526 | NULL, | 526 | NULL, |
| @@ -578,8 +578,8 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 578 | 578 | ||
| 579 | 579 | ||
| 580 | /* Current function being compiled. */ | 580 | /* Current function being compiled. */ |
| 581 | comp.func = gcc_func_declare (f_name, comp.lisp_obj_type, comp_res.max_args, | 581 | comp.func = comp_func_declare (f_name, comp.lisp_obj_type, comp_res.max_args, |
| 582 | NULL, GCC_JIT_FUNCTION_EXPORTED, false); | 582 | NULL, GCC_JIT_FUNCTION_EXPORTED, false); |
| 583 | 583 | ||
| 584 | char local_name[256]; | 584 | char local_name[256]; |
| 585 | for (int i = 0; i < stack_depth; ++i) | 585 | for (int i = 0; i < stack_depth; ++i) |
| @@ -596,7 +596,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 596 | for (ptrdiff_t i = 0; i < comp_res.max_args; ++i) | 596 | for (ptrdiff_t i = 0; i < comp_res.max_args; ++i) |
| 597 | PUSH_PARAM (gcc_jit_function_get_param (comp.func, i)); | 597 | PUSH_PARAM (gcc_jit_function_get_param (comp.func, i)); |
| 598 | 598 | ||
| 599 | gcc_jit_rvalue *nil = gcc_lisp_obj_as_ptr_from_ptr (&bb_map[0], Qnil); | 599 | gcc_jit_rvalue *nil = comp_lisp_obj_as_ptr_from_ptr (&bb_map[0], Qnil); |
| 600 | 600 | ||
| 601 | comp.bblock = NULL; | 601 | comp.bblock = NULL; |
| 602 | 602 | ||
| @@ -652,8 +652,8 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 652 | op = FETCH; | 652 | op = FETCH; |
| 653 | varref: | 653 | varref: |
| 654 | { | 654 | { |
| 655 | args[0] = gcc_lisp_obj_as_ptr_from_ptr (comp.bblock, vectorp[op]); | 655 | args[0] = comp_lisp_obj_as_ptr_from_ptr (comp.bblock, vectorp[op]); |
| 656 | res = gcc_emit_call ("Fsymbol_value", comp.lisp_obj_type, 1, args); | 656 | res = comp_emit_call ("Fsymbol_value", comp.lisp_obj_type, 1, args); |
| 657 | PUSH_LVAL (res); | 657 | PUSH_LVAL (res); |
| 658 | break; | 658 | break; |
| 659 | } | 659 | } |
| @@ -677,12 +677,12 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 677 | { | 677 | { |
| 678 | POP1; | 678 | POP1; |
| 679 | args[1] = args[0]; | 679 | args[1] = args[0]; |
| 680 | args[0] = gcc_lisp_obj_as_ptr_from_ptr (comp.bblock, vectorp[op]); | 680 | args[0] = comp_lisp_obj_as_ptr_from_ptr (comp.bblock, vectorp[op]); |
| 681 | args[2] = nil; | 681 | args[2] = nil; |
| 682 | args[3] = gcc_jit_context_new_rvalue_from_int (comp.ctxt, | 682 | args[3] = gcc_jit_context_new_rvalue_from_int (comp.ctxt, |
| 683 | comp.int_type, | 683 | comp.int_type, |
| 684 | SET_INTERNAL_SET); | 684 | SET_INTERNAL_SET); |
| 685 | res = gcc_emit_call ("set_internal", comp.lisp_obj_type, 4, args); | 685 | res = comp_emit_call ("set_internal", comp.lisp_obj_type, 4, args); |
| 686 | PUSH_LVAL (res); | 686 | PUSH_LVAL (res); |
| 687 | } | 687 | } |
| 688 | break; | 688 | break; |
| @@ -704,9 +704,9 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 704 | op -= Bvarbind; | 704 | op -= Bvarbind; |
| 705 | varbind: | 705 | varbind: |
| 706 | { | 706 | { |
| 707 | args[0] = gcc_lisp_obj_as_ptr_from_ptr (comp.bblock, vectorp[op]); | 707 | args[0] = comp_lisp_obj_as_ptr_from_ptr (comp.bblock, vectorp[op]); |
| 708 | pop (1, &stack, &args[1]); | 708 | pop (1, &stack, &args[1]); |
| 709 | res = gcc_emit_call ("specbind", comp.lisp_obj_type, 2, args); | 709 | res = comp_emit_call ("specbind", comp.lisp_obj_type, 2, args); |
| 710 | PUSH_LVAL (res); | 710 | PUSH_LVAL (res); |
| 711 | break; | 711 | break; |
| 712 | } | 712 | } |
| @@ -730,7 +730,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 730 | { | 730 | { |
| 731 | ptrdiff_t nargs = op + 1; | 731 | ptrdiff_t nargs = op + 1; |
| 732 | pop (nargs, &stack, args); | 732 | pop (nargs, &stack, args); |
| 733 | res = gcc_emit_callN ("Ffuncall", nargs, args); | 733 | res = comp_emit_callN ("Ffuncall", nargs, args); |
| 734 | PUSH_LVAL (res); | 734 | PUSH_LVAL (res); |
| 735 | break; | 735 | break; |
| 736 | } | 736 | } |
| @@ -756,7 +756,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 756 | comp.ptrdiff_type, | 756 | comp.ptrdiff_type, |
| 757 | op); | 757 | op); |
| 758 | 758 | ||
| 759 | gcc_emit_call ("helper_unbind_n", comp.lisp_obj_type, 1, args); | 759 | comp_emit_call ("helper_unbind_n", comp.lisp_obj_type, 1, args); |
| 760 | } | 760 | } |
| 761 | break; | 761 | break; |
| 762 | case Bpophandler: | 762 | case Bpophandler: |
| @@ -794,12 +794,12 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 794 | { | 794 | { |
| 795 | POP1; | 795 | POP1; |
| 796 | args[1] = nil; | 796 | args[1] = nil; |
| 797 | res = gcc_emit_call ("Fcons", comp.lisp_obj_type, 2, args); | 797 | res = comp_emit_call ("Fcons", comp.lisp_obj_type, 2, args); |
| 798 | PUSH_LVAL (res); | 798 | PUSH_LVAL (res); |
| 799 | for (int i = 0; i < op; ++i) | 799 | for (int i = 0; i < op; ++i) |
| 800 | { | 800 | { |
| 801 | POP2; | 801 | POP2; |
| 802 | res = gcc_emit_call ("Fcons", comp.lisp_obj_type, 2, args); | 802 | res = comp_emit_call ("Fcons", comp.lisp_obj_type, 2, args); |
| 803 | PUSH_LVAL (res); | 803 | PUSH_LVAL (res); |
| 804 | } | 804 | } |
| 805 | break; | 805 | break; |
| @@ -889,7 +889,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 889 | CASE_CALL_NARGS (following_char, 0); | 889 | CASE_CALL_NARGS (following_char, 0); |
| 890 | 890 | ||
| 891 | case Bpreceding_char: | 891 | case Bpreceding_char: |
| 892 | res = gcc_emit_call ("Fprevious_char", comp.lisp_obj_type, 0, args); | 892 | res = comp_emit_call ("Fprevious_char", comp.lisp_obj_type, 0, args); |
| 893 | PUSH_LVAL (res); | 893 | PUSH_LVAL (res); |
| 894 | break; | 894 | break; |
| 895 | 895 | ||
| @@ -898,7 +898,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 898 | case Bindent_to: | 898 | case Bindent_to: |
| 899 | POP1; | 899 | POP1; |
| 900 | args[1] = nil; | 900 | args[1] = nil; |
| 901 | res = gcc_emit_call ("Findent_to", comp.lisp_obj_type, 2, args); | 901 | res = comp_emit_call ("Findent_to", comp.lisp_obj_type, 2, args); |
| 902 | PUSH_LVAL (res); | 902 | PUSH_LVAL (res); |
| 903 | break; | 903 | break; |
| 904 | 904 | ||
| @@ -919,14 +919,14 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 919 | 919 | ||
| 920 | case Bsave_current_buffer: /* Obsolete since ??. */ | 920 | case Bsave_current_buffer: /* Obsolete since ??. */ |
| 921 | case Bsave_current_buffer_1: | 921 | case Bsave_current_buffer_1: |
| 922 | gcc_emit_call ("record_unwind_current_buffer", | 922 | comp_emit_call ("record_unwind_current_buffer", |
| 923 | comp.void_type, 0, NULL); | 923 | comp.void_type, 0, NULL); |
| 924 | break; | 924 | break; |
| 925 | 925 | ||
| 926 | case Binteractive_p: /* Obsolete since 24.1. */ | 926 | case Binteractive_p: /* Obsolete since 24.1. */ |
| 927 | PUSH_RVAL (gcc_lisp_obj_as_ptr_from_ptr (comp.bblock, | 927 | PUSH_RVAL (comp_lisp_obj_as_ptr_from_ptr (comp.bblock, |
| 928 | intern ("interactive-p"))); | 928 | intern ("interactive-p"))); |
| 929 | res = gcc_emit_call ("call0", comp.lisp_obj_type, 1, args); | 929 | res = comp_emit_call ("call0", comp.lisp_obj_type, 1, args); |
| 930 | PUSH_LVAL (res); | 930 | PUSH_LVAL (res); |
| 931 | break; | 931 | break; |
| 932 | 932 | ||
| @@ -957,32 +957,32 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 957 | case Bgotoifnil: | 957 | case Bgotoifnil: |
| 958 | op = FETCH2; | 958 | op = FETCH2; |
| 959 | POP1; | 959 | POP1; |
| 960 | gcc_emit_conditional (GCC_JIT_COMPARISON_EQ, args[0], nil, | 960 | comp_emit_conditional (GCC_JIT_COMPARISON_EQ, args[0], nil, |
| 961 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 961 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 962 | break; | 962 | break; |
| 963 | 963 | ||
| 964 | case Bgotoifnonnil: | 964 | case Bgotoifnonnil: |
| 965 | op = FETCH2; | 965 | op = FETCH2; |
| 966 | POP1; | 966 | POP1; |
| 967 | gcc_emit_conditional (GCC_JIT_COMPARISON_NE, args[0], nil, | 967 | comp_emit_conditional (GCC_JIT_COMPARISON_NE, args[0], nil, |
| 968 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 968 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 969 | break; | 969 | break; |
| 970 | 970 | ||
| 971 | case Bgotoifnilelsepop: | 971 | case Bgotoifnilelsepop: |
| 972 | op = FETCH2; | 972 | op = FETCH2; |
| 973 | gcc_emit_conditional (GCC_JIT_COMPARISON_EQ, | 973 | comp_emit_conditional (GCC_JIT_COMPARISON_EQ, |
| 974 | gcc_jit_lvalue_as_rvalue (TOS), | 974 | gcc_jit_lvalue_as_rvalue (TOS), |
| 975 | nil, | 975 | nil, |
| 976 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 976 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 977 | POP1; | 977 | POP1; |
| 978 | break; | 978 | break; |
| 979 | 979 | ||
| 980 | case Bgotoifnonnilelsepop: | 980 | case Bgotoifnonnilelsepop: |
| 981 | op = FETCH2; | 981 | op = FETCH2; |
| 982 | gcc_emit_conditional (GCC_JIT_COMPARISON_NE, | 982 | comp_emit_conditional (GCC_JIT_COMPARISON_NE, |
| 983 | gcc_jit_lvalue_as_rvalue (TOS), | 983 | gcc_jit_lvalue_as_rvalue (TOS), |
| 984 | nil, | 984 | nil, |
| 985 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 985 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 986 | POP1; | 986 | POP1; |
| 987 | break; | 987 | break; |
| 988 | 988 | ||
| @@ -1003,59 +1003,59 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1003 | break; | 1003 | break; |
| 1004 | 1004 | ||
| 1005 | case Bsave_excursion: | 1005 | case Bsave_excursion: |
| 1006 | res = gcc_emit_call ("record_unwind_protect_excursion", | 1006 | res = comp_emit_call ("record_unwind_protect_excursion", |
| 1007 | comp.void_type, 0, args); | 1007 | comp.void_type, 0, args); |
| 1008 | break; | 1008 | break; |
| 1009 | 1009 | ||
| 1010 | case Bsave_window_excursion: /* Obsolete since 24.1. */ | 1010 | case Bsave_window_excursion: /* Obsolete since 24.1. */ |
| 1011 | POP1; | 1011 | POP1; |
| 1012 | res = gcc_emit_call ("helper_save_window_excursion", | 1012 | res = comp_emit_call ("helper_save_window_excursion", |
| 1013 | comp.lisp_obj_type, 1, args); | 1013 | comp.lisp_obj_type, 1, args); |
| 1014 | PUSH_LVAL (res); | 1014 | PUSH_LVAL (res); |
| 1015 | break; | 1015 | break; |
| 1016 | 1016 | ||
| 1017 | case Bsave_restriction: | 1017 | case Bsave_restriction: |
| 1018 | args[0] = gcc_lisp_obj_as_ptr_from_ptr (comp.bblock, | 1018 | args[0] = comp_lisp_obj_as_ptr_from_ptr (comp.bblock, |
| 1019 | save_restriction_restore); | 1019 | save_restriction_restore); |
| 1020 | args[1] = | 1020 | args[1] = |
| 1021 | gcc_jit_lvalue_as_rvalue (gcc_emit_call ("save_restriction_save", | 1021 | gcc_jit_lvalue_as_rvalue (comp_emit_call ("save_restriction_save", |
| 1022 | comp.lisp_obj_type, | 1022 | comp.lisp_obj_type, |
| 1023 | 0, | 1023 | 0, |
| 1024 | NULL)); | 1024 | NULL)); |
| 1025 | gcc_emit_call ("record_unwind_protect", comp.void_ptr_type, 2, args); | 1025 | comp_emit_call ("record_unwind_protect", comp.void_ptr_type, 2, args); |
| 1026 | break; | 1026 | break; |
| 1027 | 1027 | ||
| 1028 | case Bcatch: /* Obsolete since 24.4. */ | 1028 | case Bcatch: /* Obsolete since 24.4. */ |
| 1029 | POP2; | 1029 | POP2; |
| 1030 | args[2] = args[1]; | 1030 | args[2] = args[1]; |
| 1031 | args[1] = gcc_lisp_obj_as_ptr_from_ptr (comp.bblock, eval_sub); | 1031 | args[1] = comp_lisp_obj_as_ptr_from_ptr (comp.bblock, eval_sub); |
| 1032 | gcc_emit_call ("internal_catch", comp.void_ptr_type, 3, args); | 1032 | comp_emit_call ("internal_catch", comp.void_ptr_type, 3, args); |
| 1033 | break; | 1033 | break; |
| 1034 | 1034 | ||
| 1035 | case Bunwind_protect: /* FIXME: avoid closure for lexbind. */ | 1035 | case Bunwind_protect: /* FIXME: avoid closure for lexbind. */ |
| 1036 | POP1; | 1036 | POP1; |
| 1037 | gcc_emit_call ("helper_unwind_protect", comp.void_type, 1, args); | 1037 | comp_emit_call ("helper_unwind_protect", comp.void_type, 1, args); |
| 1038 | break; | 1038 | break; |
| 1039 | 1039 | ||
| 1040 | case Bcondition_case: /* Obsolete since 24.4. */ | 1040 | case Bcondition_case: /* Obsolete since 24.4. */ |
| 1041 | POP3; | 1041 | POP3; |
| 1042 | gcc_emit_call ("internal_lisp_condition_case", | 1042 | comp_emit_call ("internal_lisp_condition_case", |
| 1043 | comp.lisp_obj_type, 3, args); | 1043 | comp.lisp_obj_type, 3, args); |
| 1044 | break; | 1044 | break; |
| 1045 | 1045 | ||
| 1046 | case Btemp_output_buffer_setup: /* Obsolete since 24.1. */ | 1046 | case Btemp_output_buffer_setup: /* Obsolete since 24.1. */ |
| 1047 | POP1; | 1047 | POP1; |
| 1048 | res = gcc_emit_call ("helper_temp_output_buffer_setup", comp.lisp_obj_type, | 1048 | res = comp_emit_call ("helper_temp_output_buffer_setup", comp.lisp_obj_type, |
| 1049 | 1, args); | 1049 | 1, args); |
| 1050 | PUSH_LVAL (res); | 1050 | PUSH_LVAL (res); |
| 1051 | break; | 1051 | break; |
| 1052 | 1052 | ||
| 1053 | case Btemp_output_buffer_show: /* Obsolete since 24.1. */ | 1053 | case Btemp_output_buffer_show: /* Obsolete since 24.1. */ |
| 1054 | POP2; | 1054 | POP2; |
| 1055 | gcc_emit_call ("temp_output_buffer_show", comp.void_type, 1, | 1055 | comp_emit_call ("temp_output_buffer_show", comp.void_type, 1, |
| 1056 | &args[1]); | 1056 | &args[1]); |
| 1057 | PUSH_RVAL (args[0]); | 1057 | PUSH_RVAL (args[0]); |
| 1058 | gcc_emit_call ("helper_unbind_n", comp.lisp_obj_type, 1, args); | 1058 | comp_emit_call ("helper_unbind_n", comp.lisp_obj_type, 1, args); |
| 1059 | 1059 | ||
| 1060 | break; | 1060 | break; |
| 1061 | case Bunbind_all: /* Obsolete. Never used. */ | 1061 | case Bunbind_all: /* Obsolete. Never used. */ |
| @@ -1143,35 +1143,35 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1143 | op = FETCH - 128; | 1143 | op = FETCH - 128; |
| 1144 | op += pc; | 1144 | op += pc; |
| 1145 | POP1; | 1145 | POP1; |
| 1146 | gcc_emit_conditional (GCC_JIT_COMPARISON_EQ, args[0], nil, | 1146 | comp_emit_conditional (GCC_JIT_COMPARISON_EQ, args[0], nil, |
| 1147 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 1147 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 1148 | break; | 1148 | break; |
| 1149 | 1149 | ||
| 1150 | case BRgotoifnonnil: | 1150 | case BRgotoifnonnil: |
| 1151 | op = FETCH - 128; | 1151 | op = FETCH - 128; |
| 1152 | op += pc; | 1152 | op += pc; |
| 1153 | POP1; | 1153 | POP1; |
| 1154 | gcc_emit_conditional (GCC_JIT_COMPARISON_NE, args[0], nil, | 1154 | comp_emit_conditional (GCC_JIT_COMPARISON_NE, args[0], nil, |
| 1155 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 1155 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 1156 | break; | 1156 | break; |
| 1157 | 1157 | ||
| 1158 | case BRgotoifnilelsepop: | 1158 | case BRgotoifnilelsepop: |
| 1159 | op = FETCH - 128; | 1159 | op = FETCH - 128; |
| 1160 | op += pc; | 1160 | op += pc; |
| 1161 | gcc_emit_conditional (GCC_JIT_COMPARISON_EQ, | 1161 | comp_emit_conditional (GCC_JIT_COMPARISON_EQ, |
| 1162 | gcc_jit_lvalue_as_rvalue (TOS), | 1162 | gcc_jit_lvalue_as_rvalue (TOS), |
| 1163 | nil, | 1163 | nil, |
| 1164 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 1164 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 1165 | POP1; | 1165 | POP1; |
| 1166 | break; | 1166 | break; |
| 1167 | 1167 | ||
| 1168 | case BRgotoifnonnilelsepop: | 1168 | case BRgotoifnonnilelsepop: |
| 1169 | op = FETCH - 128; | 1169 | op = FETCH - 128; |
| 1170 | op += pc; | 1170 | op += pc; |
| 1171 | gcc_emit_conditional (GCC_JIT_COMPARISON_NE, | 1171 | comp_emit_conditional (GCC_JIT_COMPARISON_NE, |
| 1172 | gcc_jit_lvalue_as_rvalue (TOS), | 1172 | gcc_jit_lvalue_as_rvalue (TOS), |
| 1173 | nil, | 1173 | nil, |
| 1174 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 1174 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 1175 | POP1; | 1175 | POP1; |
| 1176 | break; | 1176 | break; |
| 1177 | 1177 | ||
| @@ -1209,7 +1209,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1209 | if (pc >= bytestr_length || bytestr_data[pc] != Bswitch) | 1209 | if (pc >= bytestr_length || bytestr_data[pc] != Bswitch) |
| 1210 | { | 1210 | { |
| 1211 | gcc_jit_rvalue *c = | 1211 | gcc_jit_rvalue *c = |
| 1212 | gcc_lisp_obj_as_ptr_from_ptr (comp.bblock, vectorp[op]); | 1212 | comp_lisp_obj_as_ptr_from_ptr (comp.bblock, vectorp[op]); |
| 1213 | PUSH_RVAL (c); | 1213 | PUSH_RVAL (c); |
| 1214 | /* Fprint(vectorp[op], Qnil); */ | 1214 | /* Fprint(vectorp[op], Qnil); */ |
| 1215 | break; | 1215 | break; |
| @@ -1422,11 +1422,11 @@ init_comp (void) | |||
| 1422 | 1422 | ||
| 1423 | comp.scratch = | 1423 | comp.scratch = |
| 1424 | gcc_jit_lvalue_get_address( | 1424 | gcc_jit_lvalue_get_address( |
| 1425 | gcc_jit_context_new_global (comp.ctxt, NULL, | 1425 | gcc_jit_context_new_global (comp.ctxt, NULL, |
| 1426 | GCC_JIT_GLOBAL_IMPORTED, | 1426 | GCC_JIT_GLOBAL_IMPORTED, |
| 1427 | comp.lisp_obj_type, | 1427 | comp.lisp_obj_type, |
| 1428 | "scratch_call_area"), | 1428 | "scratch_call_area"), |
| 1429 | NULL); | 1429 | NULL); |
| 1430 | 1430 | ||
| 1431 | comp.func_hash = CALLN (Fmake_hash_table, QCtest, Qequal, QCweakness, Qt); | 1431 | comp.func_hash = CALLN (Fmake_hash_table, QCtest, Qequal, QCweakness, Qt); |
| 1432 | 1432 | ||