aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo2019-11-10 09:26:17 +0100
committerAndrea Corallo2020-01-01 11:38:02 +0100
commit3ed524c908d4aefd174ae6a8adc2bdaabb4bc4da (patch)
tree08d11a413175615f23f0e4a7db9e64e78fc1c8d6 /src
parentc47892201b2b9f1ef903ff2a12bb9ed9e64d19de (diff)
downloademacs-3ed524c908d4aefd174ae6a8adc2bdaabb4bc4da.tar.gz
emacs-3ed524c908d4aefd174ae6a8adc2bdaabb4bc4da.zip
add pure addr relocation mechanism
Diffstat (limited to 'src')
-rw-r--r--src/comp.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/comp.c b/src/comp.c
index 04a63c1aec5..80a59faa859 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -39,6 +39,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
39 39
40/* C symbols emited for the load relocation mechanism. */ 40/* C symbols emited for the load relocation mechanism. */
41#define CURRENT_THREAD_RELOC_SYM "current_thread_reloc" 41#define CURRENT_THREAD_RELOC_SYM "current_thread_reloc"
42#define PURE_RELOC_SYM "pure_reloc"
42#define DATA_RELOC_SYM "d_reloc" 43#define DATA_RELOC_SYM "d_reloc"
43#define IMPORTED_FUNC_RELOC_SYM "f_reloc" 44#define IMPORTED_FUNC_RELOC_SYM "f_reloc"
44#define TEXT_DATA_RELOC_SYM "text_data_reloc" 45#define TEXT_DATA_RELOC_SYM "text_data_reloc"
@@ -119,7 +120,7 @@ typedef struct {
119 gcc_jit_type *thread_state_ptr_type; 120 gcc_jit_type *thread_state_ptr_type;
120 gcc_jit_rvalue *current_thread_ref; 121 gcc_jit_rvalue *current_thread_ref;
121 /* other globals */ 122 /* other globals */
122 gcc_jit_rvalue *pure; 123 gcc_jit_rvalue *pure_ref;
123 /* libgccjit has really limited support for casting therefore this union will 124 /* libgccjit has really limited support for casting therefore this union will
124 be used for the scope. */ 125 be used for the scope. */
125 gcc_jit_type *cast_union_type; 126 gcc_jit_type *cast_union_type;
@@ -1000,7 +1001,9 @@ emit_PURE_P (gcc_jit_rvalue *ptr)
1000 GCC_JIT_BINARY_OP_MINUS, 1001 GCC_JIT_BINARY_OP_MINUS,
1001 comp.uintptr_type, 1002 comp.uintptr_type,
1002 emit_cast (comp.uintptr_type, ptr), 1003 emit_cast (comp.uintptr_type, ptr),
1003 emit_cast (comp.uintptr_type, comp.pure)), 1004 emit_cast (comp.uintptr_type,
1005 gcc_jit_lvalue_as_rvalue (
1006 gcc_jit_rvalue_dereference (comp.pure_ref, NULL)))),
1004 gcc_jit_context_new_rvalue_from_int (comp.ctxt, 1007 gcc_jit_context_new_rvalue_from_int (comp.ctxt,
1005 comp.uintptr_type, 1008 comp.uintptr_type,
1006 PURESIZE)); 1009 PURESIZE));
@@ -1737,6 +1740,15 @@ emit_ctxt_code (void)
1737 gcc_jit_type_get_pointer (comp.thread_state_ptr_type), 1740 gcc_jit_type_get_pointer (comp.thread_state_ptr_type),
1738 CURRENT_THREAD_RELOC_SYM)); 1741 CURRENT_THREAD_RELOC_SYM));
1739 1742
1743 comp.pure_ref =
1744 gcc_jit_lvalue_as_rvalue (
1745 gcc_jit_context_new_global (
1746 comp.ctxt,
1747 NULL,
1748 GCC_JIT_GLOBAL_EXPORTED,
1749 gcc_jit_type_get_pointer (comp.void_ptr_type),
1750 PURE_RELOC_SYM));
1751
1740 declare_runtime_imported_data (); 1752 declare_runtime_imported_data ();
1741 /* Imported objects. */ 1753 /* Imported objects. */
1742 EMACS_UINT d_reloc_len = 1754 EMACS_UINT d_reloc_len =
@@ -2998,11 +3010,6 @@ DEFUN ("comp--init-ctxt", Fcomp__init_ctxt, Scomp__init_ctxt,
2998 define_thread_state_struct (); 3010 define_thread_state_struct ();
2999 define_cast_union (); 3011 define_cast_union ();
3000 3012
3001 /* FIXME!! */
3002 comp.pure =
3003 gcc_jit_context_new_rvalue_from_ptr (comp.ctxt,
3004 comp.void_ptr_type,
3005 pure);
3006 return Qt; 3013 return Qt;
3007} 3014}
3008 3015
@@ -3170,6 +3177,10 @@ load_comp_unit (dynlib_handle_ptr handle)
3170 dynlib_sym (handle, CURRENT_THREAD_RELOC_SYM); 3177 dynlib_sym (handle, CURRENT_THREAD_RELOC_SYM);
3171 *current_thread_reloc = &current_thread; 3178 *current_thread_reloc = &current_thread;
3172 3179
3180 EMACS_INT ***pure_reloc =
3181 dynlib_sym (handle, PURE_RELOC_SYM);
3182 *pure_reloc = (EMACS_INT **)&pure;
3183
3173 /* Imported data. */ 3184 /* Imported data. */
3174 Lisp_Object *data_relocs = dynlib_sym (handle, DATA_RELOC_SYM); 3185 Lisp_Object *data_relocs = dynlib_sym (handle, DATA_RELOC_SYM);
3175 3186