aboutsummaryrefslogtreecommitdiffstats
path: root/src/comp.c
diff options
context:
space:
mode:
authorAndrea Corallo2019-08-18 18:43:33 +0200
committerAndrea Corallo2020-01-01 11:34:02 +0100
commitc8a0b81f8ffe093910dd3ad2852dd47a15587d9e (patch)
tree0f5c53ec85192d96562426aac196f4f5d60fc8ab /src/comp.c
parent6f6362207f7d39b5fb10b2968d238e37848a5a9d (diff)
downloademacs-c8a0b81f8ffe093910dd3ad2852dd47a15587d9e.tar.gz
emacs-c8a0b81f8ffe093910dd3ad2852dd47a15587d9e.zip
basic reload almost working
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/comp.c b/src/comp.c
index 65bca050b0e..953a1dd9d0f 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -1474,6 +1474,30 @@ emit_integerp (Lisp_Object insn)
1474} 1474}
1475 1475
1476/* 1476/*
1477 Is not possibile to initilize static data in libgccjit therfore will create
1478 the following:
1479
1480 char *str_name (void)
1481 {
1482 return "payload here";
1483 }
1484*/
1485
1486static void
1487emit_litteral_string_func (const char *str_name, const char *str)
1488{
1489 gcc_jit_function *f =
1490 gcc_jit_context_new_function (comp.ctxt, NULL,
1491 GCC_JIT_FUNCTION_EXPORTED,
1492 comp.char_ptr_type,
1493 str_name,
1494 0, NULL, 0);
1495 DECL_BLOCK (block, f);
1496 gcc_jit_rvalue *res = gcc_jit_context_new_string_literal (comp.ctxt, str);
1497 gcc_jit_block_end_with_return (block, NULL, res);
1498}
1499
1500/*
1477This emit the code needed by every compilation unit to be loaded. 1501This emit the code needed by every compilation unit to be loaded.
1478*/ 1502*/
1479static void 1503static void
@@ -1493,24 +1517,11 @@ emit_ctxt_code (void)
1493 comp.lisp_obj_type, 1517 comp.lisp_obj_type,
1494 d_reloc_len), 1518 d_reloc_len),
1495 "data_relocs"); 1519 "data_relocs");
1496 /*
1497 Is not possibile to initilize static data in libgccjit therfore will create
1498 the following:
1499 1520
1500 char *text_data_relocs (void) 1521 emit_litteral_string_func ("text_data_relocs", d_reloc);
1501 { 1522
1502 return "[a b c... etc]"; 1523 const char *func_list = SSDATA (FUNCALL1 (comp-ctxt-funcs, Vcomp_ctxt));
1503 } 1524 emit_litteral_string_func ("text_funcs", func_list);
1504 */
1505 gcc_jit_function *f =
1506 gcc_jit_context_new_function (comp.ctxt, NULL,
1507 GCC_JIT_FUNCTION_EXPORTED,
1508 comp.char_ptr_type,
1509 "text_data_relocs",
1510 0, NULL, 0);
1511 DECL_BLOCK (block, f);
1512 gcc_jit_rvalue *res = gcc_jit_context_new_string_literal (comp.ctxt, d_reloc);
1513 gcc_jit_block_end_with_return (block, NULL, res);
1514} 1525}
1515 1526
1516 1527
@@ -2868,7 +2879,6 @@ syms_of_comp (void)
2868 defsubr (&Scomp__release_ctxt); 2879 defsubr (&Scomp__release_ctxt);
2869 defsubr (&Scomp__add_func_to_ctxt); 2880 defsubr (&Scomp__add_func_to_ctxt);
2870 defsubr (&Scomp__compile_ctxt_to_file); 2881 defsubr (&Scomp__compile_ctxt_to_file);
2871 defsubr (&Scomp_compile_and_load_ctxt);
2872 2882
2873 staticpro (&comp.func_hash); 2883 staticpro (&comp.func_hash);
2874 comp.func_hash = Qnil; 2884 comp.func_hash = Qnil;