From: Gerd Möllmann Date: Sun, 16 Oct 2022 06:01:58 +0000 (+0200) Subject: Workaround for something Stefan missed X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bdca01dd38636d77279ae29aed132df3a21389ff;p=emacs.git Workaround for something Stefan missed See comment there for an explanation. * src/alloc.c (xmake_pure_vector): Former make_pure_vector. (init_vectors): Use it to allocate zero_vecgtor. --- diff --git a/src/alloc.c b/src/alloc.c index e8a1688104a..3b1d7cf0b2e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3030,6 +3030,23 @@ allocate_vector_from_block (ptrdiff_t nbytes); /* Called once to initialize vector allocation. */ + +/* PKG-FIXME: Stefan's original patch allocates the zero vector + from a block, which doesn't work because that code is not + prepared to handle allocations of that size. Do it as before + Stefan's patch, because I don't want to deal with it now. */ + +static Lisp_Object +xmake_pure_vector (ptrdiff_t len) +{ + Lisp_Object new; + size_t size = header_size + len * word_size; + struct Lisp_Vector *p = pure_alloc (size, Lisp_Vectorlike); + XSETVECTOR (new, p); + XVECTOR (new)->header.size = len; + return new; +} + static void init_vectors (void) { @@ -3041,9 +3058,7 @@ init_vectors (void) normal heap, e.g. as a static object, and then to "hide" it from the GC, for example by marking it by hand at the beginning of the GC and unmarking it by hand at the end. */ - struct Lisp_Vector *zv = allocate_vector_from_block (vroundup (header_size)); - zv->header.size = 0; - zero_vector = make_lisp_ptr (zv, Lisp_Vectorlike); + zero_vector = xmake_pure_vector (0); staticpro (&zero_vector); }