aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorAndreaCorallo2020-02-02 15:39:29 +0000
committerAndrea Corallo2020-02-03 12:58:09 +0100
commit6696b561d4d37aebdbb42833d8b5a8d1f4e14482 (patch)
treecda7cfa5ee56b47c3e4afc1bb1811163edfe70c5 /src/alloc.c
parent9e08edf98fdf1a2547eef7b5d9d3debdddb6e7c6 (diff)
downloademacs-6696b561d4d37aebdbb42833d8b5a8d1f4e14482.tar.gz
emacs-6696b561d4d37aebdbb42833d8b5a8d1f4e14482.zip
Fix load_comp_unit for non zero speeds
'dlopen' returns the same handle when trying to load two times the same shared. Touching 'd_reloc' etc leads to fails in case a frame with a reference to it in a register is active. (comp-speed >= 0)
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index faa8e703937..431238b13e6 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -517,6 +517,14 @@ Lisp_Object const *staticvec[NSTATICS]
517 517
518int staticidx; 518int staticidx;
519 519
520/* Lisp of freed native compilation unit handles.
521
522 Because during GC Vcomp_loaded_handles can't be used (hash table) temporary
523 annotate here and update Vcomp_loaded_handles when finished.
524*/
525
526static Lisp_Object freed_cu_handles[NATIVE_COMP_FLAG];
527
520static void *pure_alloc (size_t, int); 528static void *pure_alloc (size_t, int);
521 529
522/* Return PTR rounded up to the next multiple of ALIGNMENT. */ 530/* Return PTR rounded up to the next multiple of ALIGNMENT. */
@@ -3030,6 +3038,10 @@ cleanup_vector (struct Lisp_Vector *vector)
3030 PSEUDOVEC_STRUCT (vector, Lisp_Native_Comp_Unit); 3038 PSEUDOVEC_STRUCT (vector, Lisp_Native_Comp_Unit);
3031 eassert (cu->handle); 3039 eassert (cu->handle);
3032 dynlib_close (cu->handle); 3040 dynlib_close (cu->handle);
3041 /* We'll update Vcomp_loaded_handles when finished. */
3042 freed_cu_handles[0] =
3043 Fcons (make_mint_ptr (cu->handle), freed_cu_handles[0]);
3044 set_cons_marked (XCONS (freed_cu_handles[0]));
3033 } 3045 }
3034} 3046}
3035 3047
@@ -5937,6 +5949,9 @@ garbage_collect (void)
5937 if (garbage_collection_messages) 5949 if (garbage_collection_messages)
5938 message1_nolog ("Garbage collecting..."); 5950 message1_nolog ("Garbage collecting...");
5939 5951
5952 if (NATIVE_COMP_FLAG)
5953 freed_cu_handles[0] = Qnil;
5954
5940 block_input (); 5955 block_input ();
5941 5956
5942 shrink_regexp_cache (); 5957 shrink_regexp_cache ();
@@ -6001,6 +6016,10 @@ garbage_collect (void)
6001 6016
6002 gc_in_progress = 0; 6017 gc_in_progress = 0;
6003 6018
6019 if (NATIVE_COMP_FLAG)
6020 FOR_EACH_TAIL (freed_cu_handles[0])
6021 Fputhash (XCAR (freed_cu_handles[0]), Qnil, Vcomp_loaded_handles);
6022
6004 unblock_input (); 6023 unblock_input ();
6005 6024
6006 consing_until_gc = gc_threshold 6025 consing_until_gc = gc_threshold