Subject: bug#36649: 27.0.50; pure space and pdumper

From: Robert Pluim <[email-masked]>
Date: Sun, 21 Jul 2019 15:44:51 +0200

>>>>> On Sun, 21 Jul 2019 12:53:21 +0000, Pip Cet <[email-masked]> said:
    Pip> I think we should do (1) for now, since it simplifies the code enough
    Pip> to introduce immutable objects "soon"; but until that time, we waste
    Pip> more space on duplicate objects that we no longer know to be
    Pip> immutable, so cannot merge.

    Pip> I'm attaching a first patch that removes pure space, pinned symbols,
    Pip> pinned objects, but keeps Fpurecopy (for hash consing), and doesn't
    Pip> touch the Lisp codebase.

This doesnʼt build for me on macOS. After adjusting the parameters to
the call to make_hash_table in image.c, it crashes when dumping:

make[1]: Nothing to be done for `charscript.el'.
rm -f bootstrap-emacs.pdmp
./temacs --batch  -l loadup --temacs=pbootstrap
make: *** [bootstrap-emacs.pdmp] Segmentation fault: 11

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #0: 0x000000010016dc70 temacs`mark_object [inlined] symbol_marked_p(s=0x00080401003fdde0) at alloc.c:3741:14 [opt]
   3738	{
   3739	  return pdumper_object_p (s)
   3740	    ? pdumper_marked_p (s)
-> 3741	    : s->u.s.gcmarkbit;
   3742	}
   3743

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  * frame #0: 0x000000010016dc70 temacs`mark_object [inlined] symbol_marked_p(s=0x00080401003fdde0) at alloc.c:3741:14 [opt]
    frame #1: 0x000000010016dc4c temacs`mark_object(arg=<unavailable>) at alloc.c:6082 [opt]
    frame #2: 0x000000010016f30a temacs`mark_vectorlike(header=0x0000000101804000) at alloc.c:5666:5 [opt]
    frame #3: 0x000000010016d6e0 temacs`mark_object(arg=<unavailable>) at alloc.c:5607:1 [opt] [artificial]
    frame #4: 0x000000010016c4cc temacs`garbage_collect_1 [inlined] mark_object_root_visitor(root_ptr=<unavailable>, type=GC_ROOT_STATICPRO) at alloc.c:5303:3 [opt]
    frame #5: 0x000000010016c4c4 temacs`garbage_collect_1 at alloc.c:5295 [opt]
    frame #6: 0x000000010016c34f temacs`garbage_collect_1(gcst=0x00007ffeefbff248) at alloc.c:5427 [opt]
    frame #7: 0x000000010016c114 temacs`garbage_collect at alloc.c:5551:3 [opt]
    frame #8: 0x000000010019b836 temacs`eval_sub [inlined] maybe_gc at lisp.h:4974:5 [opt]
    frame #9: 0x000000010019b824 temacs`eval_sub(form=0x000000010302e843) at eval.c:2166 [opt]
    frame #10: 0x00000001001a023a temacs`Feval(form=0x000000010302e843, lexical=<unavailable>) at eval.c:2089:28 [opt]
    frame #11: 0x000000010019f082 temacs`internal_condition_case(bfun=(temacs`top_level_2 at keyboard.c:1099), handlers=0x0000000000000090, hfun=(temacs`cmd_error at keyboard.c:919)) at eval.c:1347:25 [opt]
    frame #12: 0x00000001001107ed temacs`top_level_1(ignore=<unavailable>) at keyboard.c:1108:5 [opt]
    frame #13: 0x000000010019e617 temacs`internal_catch(tag=0x000000000000c420, func=(temacs`top_level_1 at keyboard.c:1105), arg=0x0000000000000000) at eval.c:1108:25 [opt]
    frame #14: 0x00000001000fc16f temacs`command_loop at keyboard.c:1069:2 [opt]
    frame #15: 0x00000001000fc093 temacs`recursive_edit_1 at keyboard.c:714:9 [opt]
    frame #16: 0x00000001000fc3ac temacs`Frecursive_edit at keyboard.c:786:3 [opt]
    frame #17: 0x00000001000fa9b1 temacs`main(argc=<unavailable>, argv=0x00007ffeefbff6b8) at emacs.c:2085:3 [opt]
    frame #18: 0x00007fff7f9da3d5 libdyld.dylib`start + 1
    frame #19: 0x00007fff7f9da3d5 libdyld.dylib`start + 1