aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2019-06-29 16:44:06 +0200
committerAndrea Corallo2020-01-01 11:33:47 +0100
commit58dfd08fed075df5b0e8b059716b3e3638eafce9 (patch)
tree7c2e264f5e3a009d6754b84ae2b6692a90c88d38
parentecf40f95a65d3232a1295be2361f07abede48b23 (diff)
downloademacs-58dfd08fed075df5b0e8b059716b3e3638eafce9.tar.gz
emacs-58dfd08fed075df5b0e8b059716b3e3638eafce9.zip
reworking blocks
-rw-r--r--src/comp.c373
1 files changed, 182 insertions, 191 deletions
diff --git a/src/comp.c b/src/comp.c
index 5be5fa51d36..4973a517d6f 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -130,7 +130,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
130#define EMIT_CALL_N(name, nargs) \ 130#define EMIT_CALL_N(name, nargs) \
131 do { \ 131 do { \
132 POP##nargs; \ 132 POP##nargs; \
133 res = emit_call (name, comp.lisp_obj_type, nargs, args); \ 133 res = emit_call ((name), comp.lisp_obj_type, (nargs), args); \
134 PUSH_RVAL (res); \ 134 PUSH_RVAL (res); \
135 } while (0) 135 } while (0)
136 136
@@ -149,7 +149,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
149#define EMIT_CALL_N_REF(name, nargs) \ 149#define EMIT_CALL_N_REF(name, nargs) \
150 do { \ 150 do { \
151 DISCARD (nargs); \ 151 DISCARD (nargs); \
152 res = emit_call_n_ref (name, nargs, *stack); \ 152 res = emit_call_n_ref ((name), (nargs), *stack); \
153 PUSH_RVAL (res); \ 153 PUSH_RVAL (res); \
154 } while (0) 154 } while (0)
155 155
@@ -158,11 +158,24 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
158 POP2; \ 158 POP2; \
159 args[2] = gcc_jit_context_new_rvalue_from_int (comp.ctxt, \ 159 args[2] = gcc_jit_context_new_rvalue_from_int (comp.ctxt, \
160 comp.int_type, \ 160 comp.int_type, \
161 comparison); \ 161 (comparison)); \
162 res = emit_call ("arithcompare", comp.lisp_obj_type, 3, args); \ 162 res = emit_call ("arithcompare", comp.lisp_obj_type, 3, args); \
163 PUSH_RVAL (res); \ 163 PUSH_RVAL (res); \
164 } while (0) 164 } while (0)
165 165
166
167#define SAFE_ALLOCA_BLOCK(ptr, func, name) \
168do { \
169 (ptr) = SAFE_ALLOCA (sizeof (basic_block_t)); \
170 (ptr)->gcc_bb = gcc_jit_function_new_block ((func), (name)); \
171 (ptr)->terminated = false; \
172 (ptr)->top = NULL; \
173 } while (0)
174
175#define DECL_AND_SAFE_ALLOCA_BLOCK(name, func) \
176 basic_block_t *(name); \
177 SAFE_ALLOCA_BLOCK ((name), (func), STR(name))
178
166typedef struct { 179typedef struct {
167 gcc_jit_block *gcc_bb; 180 gcc_jit_block *gcc_bb;
168 /* When non zero indicates a stack pointer restart. */ 181 /* When non zero indicates a stack pointer restart. */
@@ -261,7 +274,6 @@ typedef struct {
261void emacs_native_compile (const char *lisp_f_name, const char *c_f_name, 274void emacs_native_compile (const char *lisp_f_name, const char *c_f_name,
262 Lisp_Object func, int opt_level, bool dump_asm); 275 Lisp_Object func, int opt_level, bool dump_asm);
263 276
264
265static char * ATTRIBUTE_FORMAT_PRINTF (1, 2) 277static char * ATTRIBUTE_FORMAT_PRINTF (1, 2)
266format_string (const char *format, ...) 278format_string (const char *format, ...)
267{ 279{
@@ -450,22 +462,22 @@ emit_call (const char *f_name, gcc_jit_type *ret_type, unsigned nargs,
450 462
451INLINE static void 463INLINE static void
452emit_cond_jump (gcc_jit_rvalue *test, 464emit_cond_jump (gcc_jit_rvalue *test,
453 gcc_jit_block *then_target, gcc_jit_block *else_target) 465 basic_block_t *then_target, basic_block_t *else_target)
454{ 466{
455 gcc_jit_block_end_with_conditional (comp.block->gcc_bb, 467 gcc_jit_block_end_with_conditional (comp.block->gcc_bb,
456 NULL, 468 NULL,
457 test, 469 test,
458 then_target, 470 then_target->gcc_bb,
459 else_target); 471 else_target->gcc_bb);
460 comp.block->terminated = true; 472 comp.block->terminated = true;
461} 473}
462 474
463/* Close current basic block emitting a comparison between two rval. */ 475/* Close current basic block emitting a comparison between two rval. */
464 476
465static gcc_jit_rvalue * 477static gcc_jit_rvalue *
466emit_comparison_jump (enum gcc_jit_comparison op, /* TODO add basick block as param */ 478emit_comparison_jump (enum gcc_jit_comparison op,
467 gcc_jit_rvalue *a, gcc_jit_rvalue *b, 479 gcc_jit_rvalue *a, gcc_jit_rvalue *b,
468 gcc_jit_block *then_target, gcc_jit_block *else_target) 480 basic_block_t *then_target, basic_block_t *else_target)
469{ 481{
470 gcc_jit_rvalue *test = gcc_jit_context_new_comparison (comp.ctxt, 482 gcc_jit_rvalue *test = gcc_jit_context_new_comparison (comp.ctxt,
471 NULL, 483 NULL,
@@ -768,7 +780,7 @@ emit_NUMBERP (gcc_jit_rvalue *obj)
768} 780}
769 781
770static gcc_jit_rvalue * 782static gcc_jit_rvalue *
771emit_make_fixnum (gcc_jit_block *block, gcc_jit_rvalue *obj) 783emit_make_fixnum (gcc_jit_rvalue *obj)
772{ 784{
773 emit_comment ("make_fixnum"); 785 emit_comment ("make_fixnum");
774 786
@@ -792,7 +804,7 @@ emit_make_fixnum (gcc_jit_block *block, gcc_jit_rvalue *obj)
792 comp.lisp_obj_type, 804 comp.lisp_obj_type,
793 "lisp_obj_fixnum"); 805 "lisp_obj_fixnum");
794 806
795 gcc_jit_block_add_assignment (block, 807 gcc_jit_block_add_assignment (comp.block->gcc_bb,
796 NULL, 808 NULL,
797 emit_lval_XLI (res), 809 emit_lval_XLI (res),
798 tmp); 810 tmp);
@@ -801,13 +813,10 @@ emit_make_fixnum (gcc_jit_block *block, gcc_jit_rvalue *obj)
801} 813}
802 814
803/* Construct fill and return a lisp object form a raw pointer. */ 815/* Construct fill and return a lisp object form a raw pointer. */
804/* FIXME do not pass bb */
805static gcc_jit_rvalue * 816static gcc_jit_rvalue *
806emit_lisp_obj_from_ptr (basic_block_t *block, void *p) 817emit_lisp_obj_from_ptr (void *p)
807{ 818{
808 static unsigned i; 819 static unsigned i;
809
810 comp.block = block;
811 emit_comment ("lisp_obj_from_ptr"); 820 emit_comment ("lisp_obj_from_ptr");
812 821
813 gcc_jit_lvalue *lisp_obj = 822 gcc_jit_lvalue *lisp_obj =
@@ -825,10 +834,11 @@ emit_lisp_obj_from_ptr (basic_block_t *block, void *p)
825 format_string ("Symbol %s", 834 format_string ("Symbol %s",
826 (char *) SDATA (SYMBOL_NAME (p)))); 835 (char *) SDATA (SYMBOL_NAME (p))));
827 836
828 gcc_jit_block_add_assignment (block->gcc_bb, 837 gcc_jit_block_add_assignment (comp.block->gcc_bb,
829 NULL, 838 NULL,
830 emit_lval_XLP (lisp_obj), 839 emit_lval_XLP (lisp_obj),
831 void_ptr); 840 void_ptr);
841
832 return gcc_jit_lvalue_as_rvalue (lisp_obj); 842 return gcc_jit_lvalue_as_rvalue (lisp_obj);
833} 843}
834 844
@@ -837,7 +847,7 @@ emit_NILP (gcc_jit_rvalue *x)
837{ 847{
838 emit_comment ("NILP"); 848 emit_comment ("NILP");
839 849
840 return emit_EQ (x, emit_lisp_obj_from_ptr (comp.block, Qnil)); 850 return emit_EQ (x, emit_lisp_obj_from_ptr (Qnil));
841} 851}
842 852
843static gcc_jit_rvalue * 853static gcc_jit_rvalue *
@@ -915,10 +925,9 @@ emit_CHECK_CONS (gcc_jit_rvalue *x)
915 925
916 gcc_jit_rvalue *args[] = 926 gcc_jit_rvalue *args[] =
917 { emit_CONSP (x), 927 { emit_CONSP (x),
918 emit_lisp_obj_from_ptr (comp.block, Qconsp), 928 emit_lisp_obj_from_ptr (Qconsp),
919 x }; 929 x };
920 930
921
922 gcc_jit_context_new_call (comp.ctxt, 931 gcc_jit_context_new_call (comp.ctxt,
923 NULL, 932 NULL,
924 comp.check_type, 933 comp.check_type,
@@ -1309,6 +1318,7 @@ define_cast_union (void)
1309static void 1318static void
1310define_CHECK_TYPE (void) 1319define_CHECK_TYPE (void)
1311{ 1320{
1321 USE_SAFE_ALLOCA;
1312 gcc_jit_param *param[] = 1322 gcc_jit_param *param[] =
1313 { gcc_jit_context_new_param (comp.ctxt, 1323 { gcc_jit_context_new_param (comp.ctxt,
1314 NULL, 1324 NULL,
@@ -1334,26 +1344,20 @@ define_CHECK_TYPE (void)
1334 gcc_jit_rvalue *predicate = gcc_jit_param_as_rvalue (param[1]); 1344 gcc_jit_rvalue *predicate = gcc_jit_param_as_rvalue (param[1]);
1335 gcc_jit_rvalue *x = gcc_jit_param_as_rvalue (param[2]); 1345 gcc_jit_rvalue *x = gcc_jit_param_as_rvalue (param[2]);
1336 1346
1337 gcc_jit_block *initial_block = 1347 DECL_AND_SAFE_ALLOCA_BLOCK (init_block, comp.check_type);
1338 gcc_jit_function_new_block (comp.check_type, "initial_block"); 1348 DECL_AND_SAFE_ALLOCA_BLOCK (ok_block, comp.check_type);
1339 gcc_jit_block *ok_block = 1349 DECL_AND_SAFE_ALLOCA_BLOCK (not_ok_block, comp.check_type);
1340 gcc_jit_function_new_block (comp.check_type, "ok_block"); 1350
1341 gcc_jit_block *not_ok_block = 1351 comp.block = init_block;
1342 gcc_jit_function_new_block (comp.check_type, "not_ok_block");
1343
1344 /* Set current context as needed */
1345 basic_block_t block = { .gcc_bb = initial_block,
1346 .terminated = false };
1347 comp.block = &block;
1348 comp.func = comp.check_type; 1352 comp.func = comp.check_type;
1349 1353
1350 emit_cond_jump (emit_cast (comp.bool_type, ok), 1354 emit_cond_jump (emit_cast (comp.bool_type, ok),
1351 ok_block, 1355 ok_block,
1352 not_ok_block); 1356 not_ok_block);
1353 1357
1354 gcc_jit_block_end_with_void_return (ok_block, NULL); 1358 gcc_jit_block_end_with_void_return (ok_block->gcc_bb, NULL);
1355 1359
1356 comp.block->gcc_bb = not_ok_block; 1360 comp.block = not_ok_block;
1357 1361
1358 gcc_jit_rvalue *wrong_type_args[] = { predicate, x }; 1362 gcc_jit_rvalue *wrong_type_args[] = { predicate, x };
1359 1363
@@ -1362,7 +1366,9 @@ define_CHECK_TYPE (void)
1362 emit_call ("wrong_type_argument", 1366 emit_call ("wrong_type_argument",
1363 comp.lisp_obj_type, 2, wrong_type_args)); 1367 comp.lisp_obj_type, 2, wrong_type_args));
1364 1368
1365 gcc_jit_block_end_with_void_return (not_ok_block, NULL); 1369 gcc_jit_block_end_with_void_return (not_ok_block->gcc_bb, NULL);
1370
1371 SAFE_FREE ();
1366} 1372}
1367 1373
1368 1374
@@ -1371,6 +1377,8 @@ define_CHECK_TYPE (void)
1371static void 1377static void
1372define_CAR_CDR (void) 1378define_CAR_CDR (void)
1373{ 1379{
1380 USE_SAFE_ALLOCA;
1381
1374 gcc_jit_param *car_param = 1382 gcc_jit_param *car_param =
1375 gcc_jit_context_new_param (comp.ctxt, 1383 gcc_jit_context_new_param (comp.ctxt,
1376 NULL, 1384 NULL,
@@ -1404,20 +1412,11 @@ define_CAR_CDR (void)
1404 for (int i = 0; i < 2; i++) 1412 for (int i = 0; i < 2; i++)
1405 { 1413 {
1406 gcc_jit_rvalue *c = gcc_jit_param_as_rvalue (param); 1414 gcc_jit_rvalue *c = gcc_jit_param_as_rvalue (param);
1407 gcc_jit_block *initial_block = 1415 DECL_AND_SAFE_ALLOCA_BLOCK (init_block, f);
1408 gcc_jit_function_new_block (f, "initial_block"); 1416 DECL_AND_SAFE_ALLOCA_BLOCK (is_cons_b, f);
1417 DECL_AND_SAFE_ALLOCA_BLOCK (not_a_cons_b, f);
1409 1418
1410 gcc_jit_block *is_cons_b = 1419 comp.block = init_block;
1411 gcc_jit_function_new_block (f, "is_cons");
1412
1413 gcc_jit_block *not_a_cons_b =
1414 gcc_jit_function_new_block (f, "not_a_cons");
1415
1416
1417 /* Set current context as needed */
1418 basic_block_t block = { .gcc_bb = initial_block,
1419 .terminated = false };
1420 comp.block = &block;
1421 comp.func = f; 1420 comp.func = f;
1422 1421
1423 emit_cond_jump (emit_cast (comp.bool_type, 1422 emit_cond_jump (emit_cast (comp.bool_type,
@@ -1425,7 +1424,7 @@ define_CAR_CDR (void)
1425 is_cons_b, 1424 is_cons_b,
1426 not_a_cons_b); 1425 not_a_cons_b);
1427 1426
1428 comp.block->gcc_bb = is_cons_b; 1427 comp.block = is_cons_b;
1429 1428
1430 if (f == comp.car) 1429 if (f == comp.car)
1431 gcc_jit_block_end_with_return (comp.block->gcc_bb, 1430 gcc_jit_block_end_with_return (comp.block->gcc_bb,
@@ -1436,25 +1435,23 @@ define_CAR_CDR (void)
1436 NULL, 1435 NULL,
1437 emit_XCDR (c)); 1436 emit_XCDR (c));
1438 1437
1439 comp.block->gcc_bb = not_a_cons_b; 1438 comp.block = not_a_cons_b;
1440 1439
1441 gcc_jit_block *is_nil_b = 1440 DECL_AND_SAFE_ALLOCA_BLOCK (is_nil_b, f);
1442 gcc_jit_function_new_block (f, "is_nil"); 1441 DECL_AND_SAFE_ALLOCA_BLOCK (not_nil_b, f);
1443 gcc_jit_block *not_nil_b =
1444 gcc_jit_function_new_block (f, "not_nil");
1445 1442
1446 emit_cond_jump (emit_NILP (c), 1443 emit_cond_jump (emit_NILP (c),
1447 is_nil_b, 1444 is_nil_b,
1448 not_nil_b); 1445 not_nil_b);
1449 1446
1450 comp.block->gcc_bb = is_nil_b; 1447 comp.block = is_nil_b;
1451 gcc_jit_block_end_with_return (comp.block->gcc_bb, 1448 gcc_jit_block_end_with_return (comp.block->gcc_bb,
1452 NULL, 1449 NULL,
1453 emit_lisp_obj_from_ptr (comp.block, Qnil)); 1450 emit_lisp_obj_from_ptr (Qnil));
1454 1451
1455 comp.block->gcc_bb = not_nil_b; 1452 comp.block = not_nil_b;
1456 gcc_jit_rvalue *wrong_type_args[] = 1453 gcc_jit_rvalue *wrong_type_args[] =
1457 { emit_lisp_obj_from_ptr (comp.block, Qlistp), c }; 1454 { emit_lisp_obj_from_ptr (Qlistp), c };
1458 1455
1459 gcc_jit_block_add_eval (comp.block->gcc_bb, 1456 gcc_jit_block_add_eval (comp.block->gcc_bb,
1460 NULL, 1457 NULL,
@@ -1462,15 +1459,18 @@ define_CAR_CDR (void)
1462 comp.lisp_obj_type, 2, wrong_type_args)); 1459 comp.lisp_obj_type, 2, wrong_type_args));
1463 gcc_jit_block_end_with_return (comp.block->gcc_bb, 1460 gcc_jit_block_end_with_return (comp.block->gcc_bb,
1464 NULL, 1461 NULL,
1465 emit_lisp_obj_from_ptr (comp.block, Qnil)); 1462 emit_lisp_obj_from_ptr (Qnil));
1466 f = comp.cdr; 1463 f = comp.cdr;
1467 param = cdr_param; 1464 param = cdr_param;
1468 } 1465 }
1466
1467 SAFE_FREE ();
1469} 1468}
1470 1469
1471static void 1470static void
1472define_setcar (void) 1471define_setcar (void)
1473{ 1472{
1473 USE_SAFE_ALLOCA;
1474 1474
1475 gcc_jit_param *cell = 1475 gcc_jit_param *cell =
1476 gcc_jit_context_new_param (comp.ctxt, 1476 gcc_jit_context_new_param (comp.ctxt,
@@ -1492,12 +1492,9 @@ define_setcar (void)
1492 2, 1492 2,
1493 param, 1493 param,
1494 0); 1494 0);
1495 gcc_jit_block *initial_block = 1495
1496 gcc_jit_function_new_block (comp.setcar, "initial_block"); 1496 DECL_AND_SAFE_ALLOCA_BLOCK (init_block, comp.setcar);
1497 /* Set current context as needed */ 1497 comp.block = init_block;
1498 basic_block_t block = { .gcc_bb = initial_block,
1499 .terminated = false };
1500 comp.block = &block;
1501 comp.func = comp.setcar; 1498 comp.func = comp.setcar;
1502 1499
1503 emit_CHECK_CONS (gcc_jit_param_as_rvalue (cell)); 1500 emit_CHECK_CONS (gcc_jit_param_as_rvalue (cell));
@@ -1505,16 +1502,18 @@ define_setcar (void)
1505 emit_XSETCAR (gcc_jit_param_as_rvalue (cell), 1502 emit_XSETCAR (gcc_jit_param_as_rvalue (cell),
1506 gcc_jit_param_as_rvalue (new_car)); 1503 gcc_jit_param_as_rvalue (new_car));
1507 1504
1508 gcc_jit_block_end_with_return (initial_block, 1505 gcc_jit_block_end_with_return (init_block->gcc_bb,
1509 NULL, 1506 NULL,
1510 gcc_jit_param_as_rvalue (new_car)); 1507 gcc_jit_param_as_rvalue (new_car));
1511 1508 SAFE_FREE ();
1512} 1509}
1513/* Declare a substitute for PSEUDOVECTORP as always inlined function. */ 1510/* Declare a substitute for PSEUDOVECTORP as always inlined function. */
1514 1511
1515static void 1512static void
1516define_PSEUDOVECTORP (void) 1513define_PSEUDOVECTORP (void)
1517{ 1514{
1515 USE_SAFE_ALLOCA;
1516
1518 gcc_jit_param *param[] = 1517 gcc_jit_param *param[] =
1519 { gcc_jit_context_new_param (comp.ctxt, 1518 { gcc_jit_context_new_param (comp.ctxt,
1520 NULL, 1519 NULL,
@@ -1534,19 +1533,11 @@ define_PSEUDOVECTORP (void)
1534 param, 1533 param,
1535 0); 1534 0);
1536 1535
1537 gcc_jit_block *initial_block = 1536 DECL_AND_SAFE_ALLOCA_BLOCK (init_block, comp.pseudovectorp);
1538 gcc_jit_function_new_block (comp.pseudovectorp, "initial_block"); 1537 DECL_AND_SAFE_ALLOCA_BLOCK (ret_false_b, comp.pseudovectorp);
1539 1538 DECL_AND_SAFE_ALLOCA_BLOCK (call_pseudovector_typep_b, comp.pseudovectorp);
1540 gcc_jit_block *ret_false_b =
1541 gcc_jit_function_new_block (comp.pseudovectorp, "ret_false");
1542
1543 gcc_jit_block *call_pseudovector_typep_b =
1544 gcc_jit_function_new_block (comp.pseudovectorp, "call_pseudovector");
1545 1539
1546 /* Set current context as needed */ 1540 comp.block = init_block;
1547 basic_block_t block = { .gcc_bb = initial_block,
1548 .terminated = false };
1549 comp.block = &block;
1550 comp.func = comp.pseudovectorp; 1541 comp.func = comp.pseudovectorp;
1551 1542
1552 emit_cond_jump ( 1543 emit_cond_jump (
@@ -1555,8 +1546,9 @@ define_PSEUDOVECTORP (void)
1555 call_pseudovector_typep_b, 1546 call_pseudovector_typep_b,
1556 ret_false_b); 1547 ret_false_b);
1557 1548
1558 comp.block->gcc_bb = ret_false_b; 1549 comp.block = ret_false_b;
1559 gcc_jit_block_end_with_return (ret_false_b, 1550 gcc_jit_block_end_with_return (ret_false_b->gcc_bb
1551 ,
1560 NULL, 1552 NULL,
1561 gcc_jit_context_new_rvalue_from_int( 1553 gcc_jit_context_new_rvalue_from_int(
1562 comp.ctxt, 1554 comp.ctxt,
@@ -1566,19 +1558,23 @@ define_PSEUDOVECTORP (void)
1566 gcc_jit_rvalue *args[2] = 1558 gcc_jit_rvalue *args[2] =
1567 { gcc_jit_param_as_rvalue (param[0]), 1559 { gcc_jit_param_as_rvalue (param[0]),
1568 gcc_jit_param_as_rvalue (param[1]) }; 1560 gcc_jit_param_as_rvalue (param[1]) };
1569 comp.block->gcc_bb = call_pseudovector_typep_b; 1561 comp.block = call_pseudovector_typep_b;
1570 /* FIXME use XUNTAG now that's available. */ 1562 /* FIXME use XUNTAG now that's available. */
1571 gcc_jit_block_end_with_return (call_pseudovector_typep_b, 1563 gcc_jit_block_end_with_return (call_pseudovector_typep_b->gcc_bb
1564 ,
1572 NULL, 1565 NULL,
1573 emit_call ("helper_PSEUDOVECTOR_TYPEP_XUNTAG", 1566 emit_call ("helper_PSEUDOVECTOR_TYPEP_XUNTAG",
1574 comp.bool_type, 1567 comp.bool_type,
1575 2, 1568 2,
1576 args)); 1569 args));
1570 SAFE_FREE ();
1577} 1571}
1578 1572
1579static void 1573static void
1580define_CHECK_IMPURE (void) 1574define_CHECK_IMPURE (void)
1581{ 1575{
1576 USE_SAFE_ALLOCA;
1577
1582 gcc_jit_param *param[] = 1578 gcc_jit_param *param[] =
1583 { gcc_jit_context_new_param (comp.ctxt, 1579 { gcc_jit_context_new_param (comp.ctxt,
1584 NULL, 1580 NULL,
@@ -1596,46 +1592,42 @@ define_CHECK_IMPURE (void)
1596 2, 1592 2,
1597 param, 1593 param,
1598 0); 1594 0);
1599 gcc_jit_block *initial_block = 1595
1600 gcc_jit_function_new_block (comp.check_impure, 1596 DECL_AND_SAFE_ALLOCA_BLOCK (init_block, comp.check_impure);
1601 "initial_block"); 1597 DECL_AND_SAFE_ALLOCA_BLOCK (err_block, comp.check_impure);
1602 gcc_jit_block *err_block = 1598 DECL_AND_SAFE_ALLOCA_BLOCK (ok_block, comp.check_impure);
1603 gcc_jit_function_new_block (comp.check_impure, 1599
1604 "err_block"); 1600 comp.block = init_block;
1605 gcc_jit_block *ok_block =
1606 gcc_jit_function_new_block (comp.check_impure,
1607 "ok_block");
1608
1609 /* Set current context as needed */
1610 basic_block_t block = { .gcc_bb = initial_block,
1611 .terminated = false };
1612 comp.block = &block;
1613 comp.func = comp.check_impure; 1601 comp.func = comp.check_impure;
1614 1602
1615 emit_cond_jump (emit_cast (comp.bool_type, 1603 emit_cond_jump (
1616 emit_PURE_P (gcc_jit_param_as_rvalue (param[0]))), /* FIXME */ 1604 emit_cast (comp.bool_type,
1617 err_block, 1605 emit_PURE_P (gcc_jit_param_as_rvalue (param[0]))), /* FIXME */
1618 ok_block); 1606 err_block,
1619 gcc_jit_block_end_with_void_return (ok_block, NULL); 1607 ok_block);
1608 gcc_jit_block_end_with_void_return (ok_block->gcc_bb, NULL);
1620 1609
1621 gcc_jit_rvalue *pure_write_error_arg = 1610 gcc_jit_rvalue *pure_write_error_arg =
1622 gcc_jit_param_as_rvalue (param[0]); 1611 gcc_jit_param_as_rvalue (param[0]);
1623 1612
1624 comp.block->gcc_bb = err_block; 1613 comp.block = err_block;
1625 gcc_jit_block_add_eval (comp.block->gcc_bb, 1614 gcc_jit_block_add_eval (comp.block->gcc_bb,
1626 NULL, 1615 NULL,
1627 emit_call ("pure_write_error", 1616 emit_call ("pure_write_error",
1628 comp.void_type, 1, 1617 comp.void_type, 1,
1629 &pure_write_error_arg)); 1618 &pure_write_error_arg));
1630 1619
1631 gcc_jit_block_end_with_void_return (err_block, NULL); 1620 gcc_jit_block_end_with_void_return (err_block->gcc_bb, NULL);
1632} 1621
1622 SAFE_FREE ();}
1633 1623
1634/* Declare a function to convert boolean into t or nil */ 1624/* Declare a function to convert boolean into t or nil */
1635 1625
1636static void 1626static void
1637define_bool_to_lisp_obj (void) 1627define_bool_to_lisp_obj (void)
1638{ 1628{
1629 USE_SAFE_ALLOCA;
1630
1639 /* x ? Qt : Qnil */ 1631 /* x ? Qt : Qnil */
1640 gcc_jit_param *param = gcc_jit_context_new_param (comp.ctxt, 1632 gcc_jit_param *param = gcc_jit_context_new_param (comp.ctxt,
1641 NULL, 1633 NULL,
@@ -1649,32 +1641,27 @@ define_bool_to_lisp_obj (void)
1649 1, 1641 1,
1650 &param, 1642 &param,
1651 0); 1643 0);
1652 gcc_jit_block *initial_block = 1644 DECL_AND_SAFE_ALLOCA_BLOCK (init_block, comp.bool_to_lisp_obj);
1653 gcc_jit_function_new_block (comp.bool_to_lisp_obj, 1645 DECL_AND_SAFE_ALLOCA_BLOCK (ret_t_block, comp.bool_to_lisp_obj);
1654 "bool_to_lisp_obj_initial_block"); 1646 DECL_AND_SAFE_ALLOCA_BLOCK (ret_nil_block, comp.bool_to_lisp_obj);
1655 gcc_jit_block *ret_t_block = 1647 comp.block = init_block;
1656 gcc_jit_function_new_block (comp.bool_to_lisp_obj,
1657 "ret_t");
1658 gcc_jit_block *ret_nil_block =
1659 gcc_jit_function_new_block (comp.bool_to_lisp_obj,
1660 "ret_nil");
1661 /* Set current context as needed */
1662 basic_block_t block = { .gcc_bb = initial_block,
1663 .terminated = false };
1664 comp.block = &block;
1665 comp.func = comp.bool_to_lisp_obj; 1648 comp.func = comp.bool_to_lisp_obj;
1666 1649
1667 emit_cond_jump (gcc_jit_param_as_rvalue (param), 1650 emit_cond_jump (gcc_jit_param_as_rvalue (param),
1668 ret_t_block, 1651 ret_t_block,
1669 ret_nil_block); 1652 ret_nil_block);
1670 block.gcc_bb = ret_t_block; 1653
1671 gcc_jit_block_end_with_return (ret_t_block, 1654 comp.block = ret_t_block;
1655 gcc_jit_block_end_with_return (ret_t_block->gcc_bb,
1672 NULL, 1656 NULL,
1673 emit_lisp_obj_from_ptr (&block, Qt)); 1657 emit_lisp_obj_from_ptr (Qt));
1674 block.gcc_bb = ret_nil_block; 1658
1675 gcc_jit_block_end_with_return (ret_nil_block, 1659 comp.block = ret_nil_block;
1660 gcc_jit_block_end_with_return (ret_nil_block->gcc_bb,
1676 NULL, 1661 NULL,
1677 emit_lisp_obj_from_ptr (&block, Qnil)); 1662 emit_lisp_obj_from_ptr (Qnil));
1663
1664 SAFE_FREE ();
1678} 1665}
1679 1666
1680static int 1667static int
@@ -1965,6 +1952,8 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
1965 unsigned op; 1952 unsigned op;
1966 unsigned pushhandler_n = 0; 1953 unsigned pushhandler_n = 0;
1967 1954
1955 USE_SAFE_ALLOCA;
1956
1968 /* Meta-stack we use to flat the bytecode written for push and pop 1957 /* Meta-stack we use to flat the bytecode written for push and pop
1969 Emacs VM.*/ 1958 Emacs VM.*/
1970 gcc_jit_lvalue **stack_base, **stack, **stack_over; 1959 gcc_jit_lvalue **stack_base, **stack, **stack_over;
@@ -2026,7 +2015,8 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2026 PUSH_PARAM (gcc_jit_function_get_param (comp.func, i)); 2015 PUSH_PARAM (gcc_jit_function_get_param (comp.func, i));
2027 gcc_jit_block_end_with_jump (prologue_bb, NULL, bb_map[0].gcc_bb); 2016 gcc_jit_block_end_with_jump (prologue_bb, NULL, bb_map[0].gcc_bb);
2028 2017
2029 gcc_jit_rvalue *nil = emit_lisp_obj_from_ptr (&bb_map[0], Qnil); 2018 comp.block = &bb_map[0];
2019 gcc_jit_rvalue *nil = emit_lisp_obj_from_ptr (Qnil);
2030 2020
2031 comp.block = NULL; 2021 comp.block = NULL;
2032 2022
@@ -2093,7 +2083,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2093 op = FETCH; 2083 op = FETCH;
2094 varref: 2084 varref:
2095 { 2085 {
2096 args[0] = emit_lisp_obj_from_ptr (comp.block, vectorp[op]); 2086 args[0] = emit_lisp_obj_from_ptr (vectorp[op]);
2097 res = emit_call ("Fsymbol_value", comp.lisp_obj_type, 1, args); 2087 res = emit_call ("Fsymbol_value", comp.lisp_obj_type, 1, args);
2098 PUSH_RVAL (res); 2088 PUSH_RVAL (res);
2099 break; 2089 break;
@@ -2124,7 +2114,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2124 { 2114 {
2125 POP1; 2115 POP1;
2126 args[1] = args[0]; 2116 args[1] = args[0];
2127 args[0] = emit_lisp_obj_from_ptr (comp.block, vectorp[op]); 2117 args[0] = emit_lisp_obj_from_ptr (vectorp[op]);
2128 args[2] = nil; 2118 args[2] = nil;
2129 args[3] = gcc_jit_context_new_rvalue_from_int (comp.ctxt, 2119 args[3] = gcc_jit_context_new_rvalue_from_int (comp.ctxt,
2130 comp.int_type, 2120 comp.int_type,
@@ -2157,7 +2147,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2157 op -= Bvarbind; 2147 op -= Bvarbind;
2158 varbind: 2148 varbind:
2159 { 2149 {
2160 args[0] = emit_lisp_obj_from_ptr (comp.block, vectorp[op]); 2150 args[0] = emit_lisp_obj_from_ptr (vectorp[op]);
2161 pop (1, &stack, &args[1]); 2151 pop (1, &stack, &args[1]);
2162 res = emit_call ("specbind", comp.lisp_obj_type, 2, args); 2152 res = emit_call ("specbind", comp.lisp_obj_type, 2, args);
2163 PUSH_RVAL (res); 2153 PUSH_RVAL (res);
@@ -2284,10 +2274,11 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2284#else 2274#else
2285 res = emit_call ("setjmp", comp.int_type, 1, args); 2275 res = emit_call ("setjmp", comp.int_type, 1, args);
2286#endif 2276#endif
2287 gcc_jit_block *push_h_val_block = 2277 basic_block_t *push_h_val_block;
2288 gcc_jit_function_new_block (comp.func, 2278 SAFE_ALLOCA_BLOCK (push_h_val_block,
2289 format_string ("push_h_val_%u", 2279 comp.func,
2290 pushhandler_n)); 2280 format_string ("push_h_val_%u",
2281 pushhandler_n));
2291 emit_cond_jump ( 2282 emit_cond_jump (
2292 /* This negation is just to have a bool. */ 2283 /* This negation is just to have a bool. */
2293 gcc_jit_context_new_unary_op (comp.ctxt, 2284 gcc_jit_context_new_unary_op (comp.ctxt,
@@ -2295,14 +2286,14 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2295 GCC_JIT_UNARY_OP_LOGICAL_NEGATE, 2286 GCC_JIT_UNARY_OP_LOGICAL_NEGATE,
2296 comp.bool_type, 2287 comp.bool_type,
2297 res), 2288 res),
2298 bb_map[pc].gcc_bb, 2289 &bb_map[pc],
2299 push_h_val_block); 2290 push_h_val_block);
2300 2291
2301 gcc_jit_lvalue **stack_to_restore = stack; 2292 gcc_jit_lvalue **stack_to_restore = stack;
2302 /* This emit the handler part. */ 2293 /* This emit the handler part. */
2303 2294
2304 basic_block_t bb_orig = *comp.block; 2295 basic_block_t *bb_orig = comp.block;
2305 comp.block->gcc_bb = push_h_val_block; 2296 comp.block = push_h_val_block;
2306 /* current_thread->m_handlerlist = c->next; */ 2297 /* current_thread->m_handlerlist = c->next; */
2307 gcc_jit_lvalue *m_handlerlist = 2298 gcc_jit_lvalue *m_handlerlist =
2308 gcc_jit_rvalue_dereference_field (comp.current_thread, 2299 gcc_jit_rvalue_dereference_field (comp.current_thread,
@@ -2322,9 +2313,9 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2322 NULL, 2313 NULL,
2323 comp.handler_val_field)); 2314 comp.handler_val_field));
2324 bb_map[handler_pc].top = stack; 2315 bb_map[handler_pc].top = stack;
2325 *comp.block = bb_orig; 2316 comp.block = bb_orig;
2326 2317
2327 gcc_jit_block_end_with_jump (push_h_val_block, NULL, 2318 gcc_jit_block_end_with_jump (push_h_val_block->gcc_bb, NULL,
2328 bb_map[handler_pc].gcc_bb); 2319 bb_map[handler_pc].gcc_bb);
2329 2320
2330 stack = stack_to_restore; 2321 stack = stack_to_restore;
@@ -2426,15 +2417,12 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2426 2417
2427 CASE (Bsub1); 2418 CASE (Bsub1);
2428 { 2419 {
2429
2430 /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM 2420 /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM
2431 ? make_fixnum (XFIXNUM (TOP) - 1) 2421 ? make_fixnum (XFIXNUM (TOP) - 1)
2432 : Fsub1 (TOP)) */ 2422 : Fsub1 (TOP)) */
2433 2423
2434 gcc_jit_block *sub1_inline_block = 2424 DECL_AND_SAFE_ALLOCA_BLOCK (sub1_inline_block, comp.func);
2435 gcc_jit_function_new_block (comp.func, "inline_sub1"); 2425 DECL_AND_SAFE_ALLOCA_BLOCK (sub1_fcall_block, comp.func);
2436 gcc_jit_block *sub1_fcall_block =
2437 gcc_jit_function_new_block (comp.func, "fcall_sub1");
2438 2426
2439 gcc_jit_rvalue *tos_as_num = 2427 gcc_jit_rvalue *tos_as_num =
2440 emit_XFIXNUM (gcc_jit_lvalue_as_rvalue (TOS)); 2428 emit_XFIXNUM (gcc_jit_lvalue_as_rvalue (TOS));
@@ -2463,38 +2451,38 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2463 tos_as_num, 2451 tos_as_num,
2464 comp.one); 2452 comp.one);
2465 2453
2466 gcc_jit_block_add_assignment (sub1_inline_block, 2454 basic_block_t *bb_orig = comp.block;
2455
2456 comp.block = sub1_inline_block;
2457 gcc_jit_block_add_assignment (sub1_inline_block->gcc_bb,
2467 NULL, 2458 NULL,
2468 TOS, 2459 TOS,
2469 emit_make_fixnum (sub1_inline_block, 2460 emit_make_fixnum (sub1_inline_res));
2470 sub1_inline_res));
2471 basic_block_t bb_orig = *comp.block;
2472 2461
2473 comp.block->gcc_bb = sub1_fcall_block; 2462 comp.block = sub1_fcall_block;
2474 POP1; 2463 POP1;
2475 res = emit_call ("Fsub1", comp.lisp_obj_type, 1, args); 2464 res = emit_call ("Fsub1", comp.lisp_obj_type, 1, args);
2476 PUSH_RVAL (res); 2465 PUSH_RVAL (res);
2477 2466
2478 *comp.block = bb_orig; 2467 gcc_jit_block_end_with_jump (sub1_inline_block->gcc_bb,
2479 2468 NULL,
2480 gcc_jit_block_end_with_jump (sub1_inline_block, NULL,
2481 bb_map[pc].gcc_bb); 2469 bb_map[pc].gcc_bb);
2482 gcc_jit_block_end_with_jump (sub1_fcall_block, NULL, 2470 gcc_jit_block_end_with_jump (sub1_fcall_block->gcc_bb,
2471 NULL,
2483 bb_map[pc].gcc_bb); 2472 bb_map[pc].gcc_bb);
2473 comp.block = bb_orig;
2474 SAFE_FREE ();
2484 } 2475 }
2485 2476
2486 break; 2477 break;
2487 CASE (Badd1); 2478 CASE (Badd1);
2488 { 2479 {
2489
2490 /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_POSITIVE_FIXNUM 2480 /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_POSITIVE_FIXNUM
2491 ? make_fixnum (XFIXNUM (TOP) + 1) 2481 ? make_fixnum (XFIXNUM (TOP) + 1)
2492 : Fadd (TOP)) */ 2482 : Fadd (TOP)) */
2493 2483
2494 gcc_jit_block *add1_inline_block = 2484 DECL_AND_SAFE_ALLOCA_BLOCK (add1_inline_block, comp.func);
2495 gcc_jit_function_new_block (comp.func, "inline_add1"); 2485 DECL_AND_SAFE_ALLOCA_BLOCK (add1_fcall_block, comp.func);
2496 gcc_jit_block *add1_fcall_block =
2497 gcc_jit_function_new_block (comp.func, "fcall_add1");
2498 2486
2499 gcc_jit_rvalue *tos_as_num = 2487 gcc_jit_rvalue *tos_as_num =
2500 emit_XFIXNUM (gcc_jit_lvalue_as_rvalue (TOS)); 2488 emit_XFIXNUM (gcc_jit_lvalue_as_rvalue (TOS));
@@ -2523,24 +2511,27 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2523 tos_as_num, 2511 tos_as_num,
2524 comp.one); 2512 comp.one);
2525 2513
2526 gcc_jit_block_add_assignment (add1_inline_block, 2514 basic_block_t *bb_orig = comp.block;
2515 comp.block = add1_inline_block;
2516
2517 gcc_jit_block_add_assignment (add1_inline_block->gcc_bb
2518 ,
2527 NULL, 2519 NULL,
2528 TOS, 2520 TOS,
2529 emit_make_fixnum (add1_inline_block, 2521 emit_make_fixnum (add1_inline_res));
2530 add1_inline_res)); 2522 comp.block = add1_fcall_block;
2531 basic_block_t bb_orig = *comp.block;
2532
2533 comp.block->gcc_bb = add1_fcall_block;
2534 POP1; 2523 POP1;
2535 res = emit_call ("Fadd1", comp.lisp_obj_type, 1, args); 2524 res = emit_call ("Fadd1", comp.lisp_obj_type, 1, args);
2536 PUSH_RVAL (res); 2525 PUSH_RVAL (res);
2537 2526
2538 *comp.block = bb_orig; 2527 gcc_jit_block_end_with_jump (add1_inline_block->gcc_bb,
2539 2528 NULL,
2540 gcc_jit_block_end_with_jump (add1_inline_block, NULL,
2541 bb_map[pc].gcc_bb); 2529 bb_map[pc].gcc_bb);
2542 gcc_jit_block_end_with_jump (add1_fcall_block, NULL, 2530 gcc_jit_block_end_with_jump (add1_fcall_block->gcc_bb,
2531 NULL,
2543 bb_map[pc].gcc_bb); 2532 bb_map[pc].gcc_bb);
2533 comp.block = bb_orig;
2534 SAFE_FREE ();
2544 } 2535 }
2545 break; 2536 break;
2546 2537
@@ -2570,15 +2561,12 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2570 2561
2571 CASE (Bnegate); 2562 CASE (Bnegate);
2572 { 2563 {
2573
2574 /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM 2564 /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM
2575 ? make_fixnum (- XFIXNUM (TOP)) 2565 ? make_fixnum (- XFIXNUM (TOP))
2576 : Fminus (1, &TOP)) */ 2566 : Fminus (1, &TOP)) */
2577 2567
2578 gcc_jit_block *negate_inline_block = 2568 DECL_AND_SAFE_ALLOCA_BLOCK (negate_inline_block, comp.func);
2579 gcc_jit_function_new_block (comp.func, "inline_negate"); 2569 DECL_AND_SAFE_ALLOCA_BLOCK (negate_fcall_block, comp.func);
2580 gcc_jit_block *negate_fcall_block =
2581 gcc_jit_function_new_block (comp.func, "fcall_negate");
2582 2570
2583 gcc_jit_rvalue *tos_as_num = 2571 gcc_jit_rvalue *tos_as_num =
2584 emit_XFIXNUM (gcc_jit_lvalue_as_rvalue (TOS)); 2572 emit_XFIXNUM (gcc_jit_lvalue_as_rvalue (TOS));
@@ -2606,21 +2594,25 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2606 comp.emacs_int_type, 2594 comp.emacs_int_type,
2607 tos_as_num); 2595 tos_as_num);
2608 2596
2609 gcc_jit_block_add_assignment (negate_inline_block, 2597 basic_block_t *bb_orig = comp.block;
2598
2599 comp.block = negate_inline_block;
2600 gcc_jit_block_add_assignment (negate_inline_block->gcc_bb,
2610 NULL, 2601 NULL,
2611 TOS, 2602 TOS,
2612 emit_make_fixnum (negate_inline_block, 2603 emit_make_fixnum (negate_inline_res));
2613 negate_inline_res));
2614 basic_block_t bb_orig = *comp.block;
2615 2604
2616 comp.block->gcc_bb = negate_fcall_block; 2605 comp.block = negate_fcall_block;
2617 EMIT_CALL_N_REF ("Fminus", 1); 2606 EMIT_CALL_N_REF ("Fminus", 1);
2618 *comp.block = bb_orig;
2619 2607
2620 gcc_jit_block_end_with_jump (negate_inline_block, NULL, 2608 gcc_jit_block_end_with_jump (negate_inline_block->gcc_bb,
2609 NULL,
2621 bb_map[pc].gcc_bb); 2610 bb_map[pc].gcc_bb);
2622 gcc_jit_block_end_with_jump (negate_fcall_block, NULL, 2611 gcc_jit_block_end_with_jump (negate_fcall_block->gcc_bb,
2612 NULL,
2623 bb_map[pc].gcc_bb); 2613 bb_map[pc].gcc_bb);
2614 comp.block = bb_orig;
2615 SAFE_FREE ();
2624 } 2616 }
2625 break; 2617 break;
2626 CASE (Bplus); 2618 CASE (Bplus);
@@ -2710,8 +2702,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2710 break; 2702 break;
2711 2703
2712 CASE (Binteractive_p); /* Obsolete since 24.1. */ 2704 CASE (Binteractive_p); /* Obsolete since 24.1. */
2713 PUSH_RVAL (emit_lisp_obj_from_ptr (comp.block, 2705 PUSH_RVAL (emit_lisp_obj_from_ptr (intern ("interactive-p")));
2714 intern ("interactive-p")));
2715 res = emit_call ("call0", comp.lisp_obj_type, 1, args); 2706 res = emit_call ("call0", comp.lisp_obj_type, 1, args);
2716 PUSH_RVAL (res); 2707 PUSH_RVAL (res);
2717 break; 2708 break;
@@ -2745,7 +2736,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2745 op = FETCH2; 2736 op = FETCH2;
2746 POP1; 2737 POP1;
2747 emit_comparison_jump (GCC_JIT_COMPARISON_EQ, args[0], nil, 2738 emit_comparison_jump (GCC_JIT_COMPARISON_EQ, args[0], nil,
2748 bb_map[op].gcc_bb, bb_map[pc].gcc_bb); 2739 &bb_map[op], &bb_map[pc]);
2749 bb_map[op].top = stack; 2740 bb_map[op].top = stack;
2750 break; 2741 break;
2751 2742
@@ -2753,7 +2744,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2753 op = FETCH2; 2744 op = FETCH2;
2754 POP1; 2745 POP1;
2755 emit_comparison_jump (GCC_JIT_COMPARISON_NE, args[0], nil, 2746 emit_comparison_jump (GCC_JIT_COMPARISON_NE, args[0], nil,
2756 bb_map[op].gcc_bb, bb_map[pc].gcc_bb); 2747 &bb_map[op], &bb_map[pc]);
2757 bb_map[op].top = stack; 2748 bb_map[op].top = stack;
2758 break; 2749 break;
2759 2750
@@ -2762,7 +2753,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2762 emit_comparison_jump (GCC_JIT_COMPARISON_EQ, 2753 emit_comparison_jump (GCC_JIT_COMPARISON_EQ,
2763 gcc_jit_lvalue_as_rvalue (TOS), 2754 gcc_jit_lvalue_as_rvalue (TOS),
2764 nil, 2755 nil,
2765 bb_map[op].gcc_bb, bb_map[pc].gcc_bb); 2756 &bb_map[op], &bb_map[pc]);
2766 bb_map[op].top = stack; 2757 bb_map[op].top = stack;
2767 DISCARD (1); 2758 DISCARD (1);
2768 break; 2759 break;
@@ -2772,7 +2763,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2772 emit_comparison_jump (GCC_JIT_COMPARISON_NE, 2763 emit_comparison_jump (GCC_JIT_COMPARISON_NE,
2773 gcc_jit_lvalue_as_rvalue (TOS), 2764 gcc_jit_lvalue_as_rvalue (TOS),
2774 nil, 2765 nil,
2775 bb_map[op].gcc_bb, bb_map[pc].gcc_bb); 2766 &bb_map[op], &bb_map[pc]);
2776 bb_map[op].top = stack; 2767 bb_map[op].top = stack;
2777 DISCARD (1); 2768 DISCARD (1);
2778 break; 2769 break;
@@ -2803,8 +2794,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2803 break; 2794 break;
2804 2795
2805 CASE (Bsave_restriction); 2796 CASE (Bsave_restriction);
2806 args[0] = emit_lisp_obj_from_ptr (comp.block, 2797 args[0] = emit_lisp_obj_from_ptr (save_restriction_restore);
2807 save_restriction_restore);
2808 args[1] = emit_call ("save_restriction_save", 2798 args[1] = emit_call ("save_restriction_save",
2809 comp.lisp_obj_type, 2799 comp.lisp_obj_type,
2810 0, 2800 0,
@@ -2815,7 +2805,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2815 CASE (Bcatch); /* Obsolete since 24.4. */ 2805 CASE (Bcatch); /* Obsolete since 24.4. */
2816 POP2; 2806 POP2;
2817 args[2] = args[1]; 2807 args[2] = args[1];
2818 args[1] = emit_lisp_obj_from_ptr (comp.block, eval_sub); 2808 args[1] = emit_lisp_obj_from_ptr (eval_sub);
2819 emit_call ("internal_catch", comp.void_ptr_type, 3, args); 2809 emit_call ("internal_catch", comp.void_ptr_type, 3, args);
2820 break; 2810 break;
2821 2811
@@ -2932,7 +2922,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2932 op += pc; 2922 op += pc;
2933 POP1; 2923 POP1;
2934 emit_comparison_jump (GCC_JIT_COMPARISON_EQ, args[0], nil, 2924 emit_comparison_jump (GCC_JIT_COMPARISON_EQ, args[0], nil,
2935 bb_map[op].gcc_bb, bb_map[pc].gcc_bb); 2925 &bb_map[op], &bb_map[pc]);
2936 bb_map[op].top = stack; 2926 bb_map[op].top = stack;
2937 break; 2927 break;
2938 2928
@@ -2941,7 +2931,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2941 op += pc; 2931 op += pc;
2942 POP1; 2932 POP1;
2943 emit_comparison_jump (GCC_JIT_COMPARISON_NE, args[0], nil, 2933 emit_comparison_jump (GCC_JIT_COMPARISON_NE, args[0], nil,
2944 bb_map[op].gcc_bb, bb_map[pc].gcc_bb); 2934 &bb_map[op], &bb_map[pc]);
2945 bb_map[op].top = stack; 2935 bb_map[op].top = stack;
2946 break; 2936 break;
2947 2937
@@ -2951,7 +2941,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2951 emit_comparison_jump (GCC_JIT_COMPARISON_EQ, 2941 emit_comparison_jump (GCC_JIT_COMPARISON_EQ,
2952 gcc_jit_lvalue_as_rvalue (TOS), 2942 gcc_jit_lvalue_as_rvalue (TOS),
2953 nil, 2943 nil,
2954 bb_map[op].gcc_bb, bb_map[pc].gcc_bb); 2944 &bb_map[op], &bb_map[pc]);
2955 bb_map[op].top = stack; 2945 bb_map[op].top = stack;
2956 DISCARD (1); 2946 DISCARD (1);
2957 break; 2947 break;
@@ -2962,7 +2952,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
2962 emit_comparison_jump (GCC_JIT_COMPARISON_NE, 2952 emit_comparison_jump (GCC_JIT_COMPARISON_NE,
2963 gcc_jit_lvalue_as_rvalue (TOS), 2953 gcc_jit_lvalue_as_rvalue (TOS),
2964 nil, 2954 nil,
2965 bb_map[op].gcc_bb, bb_map[pc].gcc_bb); 2955 &bb_map[op], &bb_map[pc]);
2966 bb_map[op].top = stack; 2956 bb_map[op].top = stack;
2967 DISCARD (1); 2957 DISCARD (1);
2968 break; 2958 break;
@@ -3029,7 +3019,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
3029 if (pc >= bytestr_length || bytestr_data[pc] != Bswitch) 3019 if (pc >= bytestr_length || bytestr_data[pc] != Bswitch)
3030 { 3020 {
3031 gcc_jit_rvalue *c = 3021 gcc_jit_rvalue *c =
3032 emit_lisp_obj_from_ptr (comp.block, vectorp[op]); 3022 emit_lisp_obj_from_ptr (vectorp[op]);
3033 PUSH_RVAL (c); 3023 PUSH_RVAL (c);
3034 break; 3024 break;
3035 } 3025 }
@@ -3051,6 +3041,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
3051 exit: 3041 exit:
3052 xfree (stack_base); 3042 xfree (stack_base);
3053 xfree (bb_map); 3043 xfree (bb_map);
3044 SAFE_FREE ();
3054 return comp_res; 3045 return comp_res;
3055} 3046}
3056 3047