Subject: Re: bug#68244: hash-table improvements

From: Eli Zaretskii <[email-masked]>
Date: Mon, 15 Jan 2024 22:21:52 +0200

> From: Andy Moreton <[email-masked]>
> Date: Mon, 15 Jan 2024 20:01:28 +0000
> 
> On Mon 15 Jan 2024, Eli Zaretskii wrote:
> 
> >> From: Andy Moreton <[email-masked]>
> >> Date: Sun, 14 Jan 2024 22:08:14 +0000
> >> 
> >> On Sat 13 Jan 2024, Mattias Engdegård wrote:
> >> 
> >> > All right, I've pushed the parts that I have little doubt about being a
> >> > definite improvement: a batch of refactoring steps, then the hash-table
> >> > printing reforms, the representation and growth algorithm improvements, and
> >> > finally documentation updates, all now on master.
> >> 
> >> Something in this patch series causes a build failure on Windows using
> >> the Mingw64 toolchain. I've tried bisecting this, and at each step doing
> >> "git clean -xdf" and then autogen, configure and make for a native build.
> >> 
> >> The last good commit on master is:
> >>   c3d0cc50faf5 ("Remove rehash-threshold and rehash-size struct members")
> >> 
> >> Bisect identifies this as the bad commit:
> >>   d3cefd3e9835 ("Leaner hash table dumping and thawing")
> >> 
> >> I have included the end of the log from the failing build below.
> >> 
> >>     AndyM
> >> 
> >>                            -----o0o-----
> >> 
> >> cp -f temacs.exe bootstrap-emacs.exe
> >> rm -f bootstrap-emacs.pdmp
> >> ./temacs --batch  -l loadup --temacs=pbootstrap \
> >> 	--bin-dest c:/emacs/30.0.50/mingw64-x86_64-O2-native/bin/ --eln-dest c:/emacs/30.0.50/mingw64-x86_64-O2-native/lib/emacs/30.0.50/
> >> Loading loadup.el (source)...
> >> Dump mode: pbootstrap
> >> Using load-path (c:/emacs/git/emacs/master/lisp c:/emacs/git/emacs/master/lisp/emacs-lisp c:/emacs/git/emacs/master/lisp/progmodes c:/emacs/git/emacs/master/lisp/language c:/emacs/git/emacs/master/lisp/international c:/emacs/git/emacs/master/lisp/textmodes c:/emacs/git/emacs/master/lisp/vc)
> >> Loading emacs-lisp/debug-early (source)...
> >> 
> >> ...[snipped]...
> >> 
> >> Loading c:/emacs/git/emacs/master/lisp/emacs-lisp/rmc.el (source)...
> >> Finding pointers to doc strings...
> >> Finding pointers to doc strings...done
> >> Dumping under the name bootstrap-emacs.pdmp
> >> Dumping fingerprint: 9f59e49a3ba95f3d7451327de9cf2863b9ddb392220c5f88f384f16245a619c2
> >> Dump complete
> >> Byte counts: header=100 hot=16147196 discardable=207320 cold=11360080
> >> Reloc counts: hot=1123689 discardable=5662
> >> ANCIENT=yes make -C ../lisp compile-first EMACS="../src/bootstrap-emacs.exe"
> >> make[3]: Entering directory '/c/emacs/git/emacs/master/build/mingw64-x86_64-O2-native/lisp'
> >>   ELC      /c/emacs/git/emacs/master/lisp/emacs-lisp/macroexp.elc
> >> 
> >> C:/emacs/git/emacs/master/src/lisp.h:2564: Emacs fatal error: assertion failed: 0 < size
> >
> > Thanks, but I see no assertion 0 < size on line 2564 of lisp.h, or
> > anywhere else in lisp.h.  Can you tell which assertion fails?
> 
> In commit d3cefd3e9835, line 2564 of lisp.h has "eassume (0 < size);" in
> HASH_TABLE_SIZE().
> 
> If the hash table changes now allow zero sized tables then that would
> trigger in a build with ENABLE_CHECKING. My build script had checking
> enabled, which would explain the failure. Sorry for not mentioning that
> earlier (I had forgotten that it was enabled).
> 
> With ENABLE_CHECKING disabled the build succeeds. Thus the invariants
> need looking at to allow a checked build to work.

I always build with ENABLE_CHECKING, so I still don't understand why I
don't see the problem.  Can you suggest a way that avoids a full
bootstrap, but just compiles a (small) bunch of Lisp files?