summaryrefslogtreecommitdiff
path: root/src/pdumper.c
Commit message (Collapse)AuthorAge
* Add functions to open a file without quitting.Philipp Stephani2021-01-10
| | | | | | | | | | | | | | | In some situations, e.g. when the Lisp machinery isn't available, we can't quit. Don't check the quit flags in such situations, in case they contain garbage. * src/sysdep.c (emacs_open_noquit, emacs_openat_noquit): New variants of 'emacs_open' and 'emacs_openat' that don't check the quit flags. * src/emacs.c (main, Fdaemon_initialized): * src/pdumper.c (pdumper_load): * src/w32term.c (w32_initialize): * src/buffer.c (mmap_init): * src/callproc.c (emacs_spawn): Use them where we can't quit.
* Fix build for --enable-checking=structsBasil L. Contovounesios2021-01-04
| | | | | | | The last change to lisp.h only added comments in Lisp_String, so the portable dumper need not be changed. * src/pdumper.c (dump_string): Update hash for Lisp_String.
* Update copyright year to 2021Paul Eggert2021-01-01
| | | | Run "TZ=UTC0 admin/update-copyright".
* Unbreak build after commit 1a0a11f7d2d1dbecb9f754b1e129d50e489058e6.Philipp Stephani2020-12-21
| | | | | | | The commit only changed a comment in 'struct buffer', so the portable dumper doesn't need to be adapted. * src/pdumper.c (dump_buffer): Update hash for 'struct buffer'.
* Unbreak compilation with CHECK_STRUCTS.Philipp Stephani2020-11-22
| | | | | | | Commit 3963aea4f4a22da0c1fb8ca8ca80b59c58373811 modified the ‘buffer’ structure, but didn’t adapt the hash. * src/pdumper.c (dump_buffer): Update buffer hash.
* Capitalize portable dump messages.Philipp Stephani2020-11-14
| | | | | | | | | | We capitalize all other messages during the dump, so capitalize the "dump mode" and "dumping fingerprint" ones as well for consistency. * src/pdumper.c (Fdump_emacs_portable): Capitalize fingerprint message prefix. * lisp/loadup.el: Capitalize "dump mode" message.
* ; Fix typosStefan Kangas2020-09-21
|
* Fix assertion violation in pdumper.cEli Zaretskii2020-08-17
| | | | | | | * src/pdumper.c (pdumper_find_object_type_impl): When checking last_mark_bits, require the offset to be less than discardable_start, not cold_start. This fixes a typo introduced in 2020-08-14T21:33:21Z!eggert@cs.ucla.edu (Bug#42832).
* Fix bus error on Debian bullseyePaul Eggert2020-08-14
| | | | | | | | | | | | | | | | Problem reported by Lars Ingebrigtsen, and problem diagnosis and most of this patch by Pip Cet (Bug#42832). * src/pdumper.c (dump_bitsets_init): Rename from dump_bitset_init. All callers changed. Initialize two bitsets with a single malloc call. (struct pdumper_loaded_dump_private): New member last_mark_bits. (pdumper_find_object_type_impl): Return PDUMPER_NO_OBJECT if the last_mark_bits’ bit is clear. (pdumper_set_marked_impl): Assert that the last_mark_bits’ bit is set. (pdumper_clear_marks_impl): Save mark_bits into last_mark_bits before clearing mark_bits. Co-authored-by: Pip Cet <pipcet@gmail.com>
* Don’t warn about integer conversion in pdumper.cPaul Eggert2020-08-11
| | | | | | | | | | | | | Problem reported by Juanma Barranquero in: https://lists.gnu.org/r/emacs-devel/2020-08/msg00279.html and a similar glitch was reported by Eli Zaretskii (Bug#36597#67). * src/pdumper.c: Remove -Wconversion pragma. (ALLOW_IMPLICIT_CONVERSION, DISALLOW_IMPLICIT_CONVERSION): Remove. All uses removed. Although -Wconversion may have been helpful when writing pdumper.c it is now causing more trouble than it’s worth here (just as in the rest of Emacs). (dump_read_all): Avoid no-longer-necessary use of ‘size_t’ rather than ‘int’.
* Unbreak build with --enable-checking=allPhilipp Stephani2020-08-11
| | | | | | | | | Commit 16a16645f524c62f7906036b0e383e4247b58de7 has only changed a comment in ‘struct Lisp_Hash_Table’, so the portable dumper doesn’t need to be adapted. * src/pdumper.c (dump_hash_table): Update hash code for ‘struct Lisp_Hash_Table’.
* Prefer make_nil_vector to make-vector with nilPaul Eggert2020-08-11
| | | | | | | * src/pdumper.c (hash_table_thaw): Pacify -Wconversion so we can use make_nil_vector again. * src/timefns.c (syms_of_timefns): Prefer make_nil_vector to make_vector with Qnil.
* Fix MinGW build broken by recent pdumper changes.Eli Zaretskii2020-08-11
| | | | | | | | * src/pdumper.c (hash_table_thaw): Use Fmake_vector. Suggested by Pip Cet <pipcet@gmail.com>. (dump_trace): Declare ATTRIBUTE_FORMAT_PRINTF, not ATTRIBUTE_FORMAT((__printf__), so that we pick the right attribute for MinGW.
* pdumper avoid listing hash table contentsPaul Eggert2020-08-11
| | | | | * src/pdumper.c (hash_table_contents): Create a vector directly, instead of creating a list and then converting that to a vector.
* pdumper speed tweeks for hash tablesPaul Eggert2020-08-11
| | | | | | | | | * src/pdumper.c (dump_queue_empty_p): Avoid unnecessary call to Fhash_table_count on a known hash table. (dump_hash_table_list): !NILP, not CONSP. (hash_table_freeze, hash_table_thaw): ASIZE, not Flength, on vectors. Initialize in same order as struct. (hash_table_thaw): make_nil_vector, not Fmake_vector with nil.
* In pdumper, simplify INT_MAX computationPaul Eggert2020-08-11
| | | | | | * src/pdumper.c (dump_read_all): Avoid unnecessary cast. Also, round down to page size, as sysdep.c does. Also, don’t assume INT_MAX <= UINT_MAX (!).
* Don’t needlessly convert to ‘unsigned’ in pdumperPaul Eggert2020-08-11
| | | | | | | | | | * src/pdumper.c (PRIdDUMP_OFF): New macro. (EMACS_INT_XDIGITS): New constant. (struct dump_context): Use dump_off for relocation counts. All uses changed. (dump_queue_enqueue, dump_queue_dequeue, Fdump_emacs_portable): Don’t assume counts fit in ‘unsigned’ or ‘unsigned long’. Use EMACS_INT_XDIGITS instead of assuming it’s 16.
* * src/pdumper.c (pdumper_load): XSETVECTOR -> make_lisp_ptr.Paul Eggert2020-08-11
|
* Rehash hash tables eagerly after loading a dumpPip Cet2020-08-11
| | | | | | | | | | | | | | | | This simplifies code, and helps performance in some cases (Bug#36597). * src/lisp.h (hash_rehash_needed_p): Remove. All uses removed. (hash_rehash_if_needed): Remove. All uses removed. (struct Lisp_Hash_Table): Remove comment about rehashing hash tables. * src/pdumper.c (thaw_hash_tables): New function. (hash_table_thaw): New function. (hash_table_freeze): New function. (dump_hash_table): Simplify. (dump_hash_table_list): New function. (hash_table_contents): New function. (Fdump_emacs_portable): Handle hash tables by eager rehashing. (pdumper_load): Restore hash tables. (init_pdumper_once): New function.
* Ignore another memory leakPaul Eggert2020-08-03
| | | | | * src/pdumper.c (dump_mmap_contiguous_heap): Ignore the heap control block when checking for leaks.
* Port to Oracle Studio 12.6 (sparc)Paul Eggert2020-07-30
| | | | | | | | * src/alloc.c (__builtin_unwind_init) [!HAVE___BUILTIN_UNWIND_INIT]: Move from here ... * src/lisp.h: ... to here, since flush_stack_call_func uses it. * src/pdumper.c (dump_off_from_lisp): Avoid ‘return n;;’ to pacify Oracle Studio.
* Unbreak compilation with CHECK_STRUCTS defined.Philipp Stephani2020-05-31
| | | | | | * src/pdumper.c (dump_float): Update hash value after commit 9f7bfb6cb06f1480a0904184cabf187e03628e55. The struct layout is still compatible.
* --with-wide-int is a no-op on 64-bit hostsPaul Eggert2020-05-27
| | | | | | * configure.ac: Clarify wording for --with-wide-int help. * src/pdumper.c (dump_vectorlike_generic): Do the eassert even if --with-wide-int was specified unnecessarily.
* Fix compilation with CHECK_STRUCTSAndreas Schwab2020-04-01
| | | | * src/pdumper.c (dump_buffer): Update hash of struct buffer.
* Remove `all_buffers` and the associated `next` field of buffersStefan Monnier2020-03-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (enum mem_type): Remove MEM_TYPE_BUFFER. (allocate_buffer): Allocate like any other pseudovector. Don't register on `all_buffers` any more. (live_buffer_holding, live_buffer_p): Delete functions. (mark_maybe_object, valid_lisp_object_p): Don't pay attention to MEM_TYPE_BUFFER any more. (garbage_collect): Only compact the live buffers. (mark_buffer): Mark the undo_list of dead buffers here. (mark_object): Buffers are normal pseudovectors now. (sweep_buffers): Don't do the actual sweep here, just cleanup the markers and only for live buffers. * src/buffer.c (all_buffers): Remove variable. (Fkill_buffer): Don't check indirect dead buffers. Set the undo_list before we remove ourselves from the list of live buffers. (Fbuffer_swap_text, Fset_buffer_multibyte): Don't check indirect dead buffers. (init_buffer_once): Don't set `all_buffers`. (init_buffer): Don't map new memory for dead buffers. * src/buffer.h (struct buffer): Remove `next` field. (FOR_EACH_BUFFER): Remove macro. * src/pdumper.c (dump_buffer): Don't dump the `next` field.
* Pacify GCC 9.2.1 20190927 -O3Paul Eggert2020-03-04
| | | | | | | | | | | | | | | | | | | | | | | | Original problem report by N. Jackson in: https://lists.gnu.org/r/emacs-devel/2020-03/msg00047.html I found some other warnings when I used gcc, and fixed them with this patch. * lib-src/etags.c: Include verify.h. (xnmalloc, xnrealloc): Tell the compiler that NITEMS is nononnegative and ITEM_SIZE is positive. * src/conf_post.h (__has_attribute_returns_nonnull) (ATTRIBUTE_RETURNS_NONNULL): New macros. * src/editfns.c (Fuser_full_name): Don’t assume Fuser_login_name returns non-nil. * src/intervals.c (rotate_right, rotate_left, update_interval): * src/intervals.h (LENGTH, LEFT_TOTAL_LENGTH, RIGHT_TOTAL_LENGTH): Use TOTAL_LENGTH0 or equivalent on intervals that might be null. * src/intervals.h (TOTAL_LENGTH): Assume arg is nonnull. (TOTAL_LENGTH0): New macro, with the old TOTAL_LENGTH meaning. (make_interval, split_interval_right): Add ATTRIBUTE_RETURNS_NONNULL. * src/pdumper.c (dump_check_dump_off): Now returns void, since no caller uses the return value. Redo assert to pacify GCC. (decode_emacs_reloc): Add a seemingly-random eassume to pacify GCC. Ugly, and I suspect due to a bug in GCC.
* Unbreak build with CHECK_STRUCTSPhilipp Stephani2020-02-29
| | | | | * src/pdumper.c (dump_object): Fix hash for Lisp_Type after commit 202c3319a28c029d6971dccea92f92425c5e8067.
* * src/pdumper.c (dump_vectorlike): Unbreak build after 724af7671590cPhilipp Stephani2020-01-13
|
* Update copyright year to 2020Paul Eggert2020-01-01
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* * src/pdumper.c (Fdump_emacs_portable): Reword error message.Philipp Stephani2019-12-24
| | | | (cherry picked from commit ac7b2607735a64e657d65c87d8c9f73755ff3efa)
* Don’t allow portable dumping in interactive mode (Bug#38453).Philipp Stephani2019-12-24
| | | | | | | * src/pdumper.c (Fdump_emacs_portable): Don’t allow dumping in interactive mode. (cherry picked from commit e7edba42c8a525722cbd40f782b0df68e4976a62)
* Fix duplicated words in commentsRobert Pluim2019-10-15
| | | | | | | | * src/coding.c (encode_string_utf_8): * src/keyboard.c (syms_of_keyboard): * src/mini-gmp.c (gmp_lucas_mod, mpz_export): * src/pdumper.c (dump_set_referrer, dump_queue_compute_score): * src/timefns.c (Ftime_convert): Remove duplicated words.
* * src/pdumper.c (dump_buffer): Update structure hash.Philipp Stephani2019-10-05
|
* Fix compilation with CHECK_STRUCTSAndreas Schwab2019-09-22
| | | | * src/pdumper.c (dump_buffer): Update hash of struct buffer.
* Improve checking of pdump load failuresPaul Eggert2019-09-11
| | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (memory_full): Just report "memory exhausted" if failure occurs during initialization, since fancier recovery schemes are not likely to work when not initialized. * src/emacs.c (dump_error_to_string): Accept int, not enum pdumper_load_result, since the result might not fit in the enum. Use strerror if it was derived from errno. This is for better diagnostics of pdump load failures. (load_pdump_find_executable): Return char *, not enum. 2nd arg is now pointer to buffer size, rather than pointer to pointer to buffer. All callers changed. Use Emacs allocator since they should now be OK even during early startup. Use check_executable instead access, to use effective rather than real permissions. (load_pdump): Return void since callers ignore result. Use int where enum could be too narrow. Use heap rather than stack for possibly-long string. Prefer ptrdiff_t to size_t. * src/fileio.c (check_executable): Now extern. * src/pdumper.c (pdumper_load): Return int that may have errno added to it, for better diagnostics when loads fail.
* Port pdumper mmap to AIXPaul Eggert2019-09-04
| | | | | * src/pdumper.c (needs_mmap_retry_p) [_AIX]: Return true. Problem observed on AIX 7.1 and 7.2 in GCC compile farm.
* Avoid macros in pdumper.c when it’s easyPaul Eggert2019-09-03
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem with DUMP_SET_REFERRER mentioned by Pip Cet at end of: https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00548.html * src/pdumper.c (DANGEROUS, EMACS_RELOC_TYPE_BITS) (EMACS_RELOC_LENGTH_BITS, DUMP_RELOC_TYPE_BITS) (DUMP_RELOC_ALIGNMENT_BITS, DUMP_RELOC_OFFSET_BITS) (DUMP_RELOCATION_ALIGNMENT, DUMP_ALIGNMENT) (WEIGHT_NONE, WEIGHT_NORMAL, WEIGHT_STRONG) (PDUMPER_MAX_OBJECT_SIZE): Now a constant, not a macro. (divide_round_up): Now a function, not a macro DIVIDE_ROUND_UP. All uses changed. (enum link_weight_enum, WEIGHT_NONE_VALUE) (WEIGHT_NORMAL_VALUE, WEIGHT_STRONG_VALUE): Remove. (struct link_weight): Just use an int. (dump_set_referrer): New function, replacing DUMP_SET_REFERRER macro with a different API. All uses changed. (dump_clear_referrer): Rename from DUMP_CLEAR_REFERRER. All uses changed. (DEFINE_FROMLISP_FUNC, DEFINE_TOLISP_FUNC): Remove. (intmax_t_from_lisp, intmax_t_to_lisp, dump_off_from_lisp) (dump_off_to_lisp): Define without using macros, (dump_off_from_lisp): Add an eassert range check. (DUMP_FIELD_COPY): Simplify.
* Avoid casting -1 to possibly-unsigned enumPaul Eggert2019-09-03
| | | | | | | | | | | | | * src/alloc.c (mark_maybe_pointer): * src/pdumper.h (pdumper_object_p_precise): Use pdumper_valid_object_type_p. * src/pdumper.c (pdumper_find_object_type_impl): * src/pdumper.h (pdumper_find_object_type): Return int, not enum Lisp_Type. All callers changed. * src/pdumper.h (PDUMPER_NO_OBJECT): Do not cast -1 to enum Lisp_Type; in theory, C18 says this could yield 7, which would mean PDUMPER_NO_OBJECT == Lisp_Float (!). (pdumper_valid_object_type_p): New function.
* Fix compilation with CHECK_STRUCTSAndreas Schwab2019-08-31
| | | | * src/pdumper.c (dump_hash_table): Update hash of Lisp_Hash_Table.
* Be more careful about pointers to bignum valsPaul Eggert2019-08-21
| | | | | | | | | | | | | | | This uses ‘const’ to be better at catching bugs that mistakenly attempt to modify a bignum value. Lisp bignums are supposed to be immutable. * src/alloc.c (make_pure_bignum): * src/fns.c (sxhash_bignum): Accept Lisp_Object instead of struct Lisp_Bignum *, as that’s simpler now. Caller changed. * src/bignum.h (bignum_val, xbignum_val): New inline functions. Prefer them to &i->value and XBIGNUM (i)->value, since they apply ‘const’ to the result. * src/timefns.c (lisp_to_timespec): Use mpz_t const * to point to a bignum value.
* Re-port dump_bitset_clear to -fsanitize=undefinedPaul Eggert2019-08-06
| | | | | | | * src/pdumper.c (dump_bitset_clear): Skip the memset if the size is zero, because in that case the destination might be NULL. This fixes a bug introduced in 2019-07-26T06:17:52Zeggert@cs.ucla.edu. Add a comment to make the bug less likely to reoccur.
* Fix compilation with CHECK_STRUCTSEli Zaretskii2019-08-05
| | | | | * src/pdumper.c (dump_hash_table): Update hash of HASH_Lisp_Hash_Table. (Bug#36929)
* Adjust remaining uses of `NILP (HASH_HASH)`.Stefan Monnier2019-07-26
| | | | | | | | * src/json.c (lisp_to_json_toplevel_1): * src/pdumper.c (dump_hash_table_stable_p, hash_table_contents): * src/print.c (print, print_vectorlike): * src/minibuf.c (Ftry_completion, Fall_completions, Ftest_completion): Use `EQ (HASH_KEY, Qunbound)` instead of `NILP (HASH_HASH)`.
* Don't dump the `hash` vector if it will need to be recomputed anywayStefan Monnier2019-07-26
| | | | | | | | | | | * src/fns.c (hash_table_rehash): Only set `hash` field at the end. (sweep_weak_table): Only set slot of `hash` vector when that vector exists. (Fhash_table_count): No need to hash_rehash_if_needed any more. * src/lisp.h (hash_rehash_needed_p): Test the presence of `hash` instead. * src/pdumper.c (check_hash_table_rehash, dump_hash_table): Set `hash` to nil to indicate that the table needs to be rehashed.
* * src/fns.c (hash_index_size): New function, extracted from make_hash_tableStefan Monnier2019-07-26
| | | | | | (make_hash_table, maybe_resize_hash_table): Use it. * src/pdumper.c (check_hash_table_rehash): Use hash_rehash_needed_p.
* Minor pdumper tweaksPaul Eggert2019-07-25
| | | | | | | * src/pdumper.c (dump_hash_table_stable_p): Bool vectors and bignums are also stable keys. (decode_emacs_reloc, drain_reloc_list, Fdump_emacs_portable): (dump_bitset_clear): Simplify use of memset.
* Merge pdumper.c and alloc.c builtin symbol testsPaul Eggert2019-07-23
| | | | | | | * src/alloc.c (c_symbol_p): Move from here ... * src/lisp.h (c_symbol_p): ... to here, and make it more portable to hypothetical platforms where pointers are wider than ptrdiff_t. * src/pdumper.c (dump_builtin_symbol_p): Use c_symbol_p.
* Improve pdumper doc; say unexec is deprecatedPaul Eggert2019-07-23
| | | | | | | | | | | Say that pdumping cannot redump unless -batch is used. Say that the traditional unexec dumping method is by default not available, and is deprecated. Don't call dump files "portable", as dump files are not any more portable than the Emacs executables themselves. Just call them "dump files". Similar, prefer "portable dumper" (since the dumper code is portable) to "portable dumping" (since the dump file is not). Be more systematic about calling them "dump files" instead of "dumped images" or whatnot.
* Do not pdump user-defined hashtabsPaul Eggert2019-07-22
| | | | | | * src/pdumper.c (dump_hash_table_stable_p): Signal an error if a hash table has user-defined tests (Bug#36769). * src/fns.c (hashfn_user_defined): Now extern.
* Fix crash if user test munges hash tablePaul Eggert2019-07-20
| | | | | | | | | | | | | | | | | * src/fns.c (restore_mutability) (hash_table_user_defined_call): New functions. (cmpfn_user_defined, hashfn_user_defined): Use them. (make_hash_table, copy_hash_table): Mark new hash table as mutable. (check_mutable_hash_table): New function. (Fclrhash, Fputhash, Fremhash): Use it instead of CHECK_IMPURE. * src/lisp.h (struct hash_table_test): User-defined functions now take pointers to struct Lisp_Hash_Table, not to struct hash_table_test. All uses changed. (struct Lisp_Hash_Table): New member ‘mutable’. * src/pdumper.c (dump_hash_table): Copy it. * test/src/fns-tests.el (test-hash-function-that-mutates-hash-table): New test, which tests for the bug.