SIGPROF can be delived while the SIGSEGV handler is running. In this
situation we shouldn't access MPS-managed memory. E.g. the profiler
should not look inside closures when recording backtraces.
* src/igc.h (igc_busy_p): New.
* src/profiler.c (add_sample): When igc_busy_p, do the same as the old
GC does when it is called during GC, i.e. only increace a counter and
don't record a backtrace.
* src/igc.c (igc_busy_p): Implement it.
* src/igc.c (igc_alloc_dump): Let nbytes be the size without header.
(dump_mmap_contiguous_mps): Update accordingly.
(dump_field_fwd): Use &in_field->fwdptr instead of in_field.
* src/pdumper.c (pdumper_load): Set dump_public to the pinned region
from cold_user_data_start to heap_end. This should reduce the
probability that pdumper_object_p is misused.
Use the dump_relocs mechanism instead of relying on Vbuffer_alist to
find all existing buffers.
* src/pdumper.c (dump_buffer, dump_do_dump_relocation): Create a
RELOC_BUFFER.
* src/igc.c (igc_on_pdump_loaded): Remove the buffer related code.
* src/dumper.c (dump_discard_mem): Abort on error.
(dump_mmap_discard_contents): Call dump_mmap_release instead
of dump_discard_mem, which invokes the map specific callback.
The forwarding structs already exist in the data or bss section.
They are all created with DEFVAR_INT and similar macros. Instead
of creating new structs in the dump, create relocs to the data section.
* src/pdumper.c (dump_field_fwd): New.
(dump_blv, dump_symbol): Use it.
(dump_pre_dump_symbol): Don't dump fwd objects.
* src/igc.c (dump_mmap_contiguous_mps): New variant of
dump_mmap_contiguous.
(dump_mmap_release_mps): New.
(pdumper_load): Call igc_on_pdump_loaded with more details.
(dump_header): Record some important positions.
(dump_fwd_int, dump_fwd_bool, dump_fwd_obj, dump_fwd_buffer_obj)
(dump_fwd_kboard_obj): Add IGC_OBJ_DUMPED_FWD header.
(dump_charset_table): Add IGC_OBJ_DUMPED_CHARSET_TABLE header.
(dump_cold_charsets): New. Add IGC_OBJ_DUMPED_CODE_SPACE_MASKS header.
(dump_cold_buffer): Add IGC_OBJ_DUMPED_BUFFER_TEXT header.
(Fdump_emacs_portable): Record positions for cold_user_data_start and
heap_end.
* src/igc.h (igc_obj_type): Add some tags to mark object in the dump.
(igc_on_pdump_loaded): Add some arguments for various regions.
(igc_alloc_dump): New.
* src/igc.c (igc_alloc_dump): Implement it.
(igc_on_pdump_loaded): Insert some IGC_OBJ_PAD headers, pin some stuff,
and prepare the text of the buffers.
(builtin_obj_type_and_hash): Allow some of the new object types.
This makes the mirroring code more uniform.
* src/pdumper.c (dump_cold_string): Emit headers.
* src/igc.c (igc_dump_finish_obj): Handle objects in pure space.
(builtin_obj_type_and_hash): Renamed from builtin_obj_type.
(pure_obj_type_and_hash): New helper.
(is_builtin_obj_type): Abort for unrecognized cases.
(mirror_string): Don't copy strings in the cold dump.