Raymond Toy pushed to branch issue-243-weak-pointer-to-static-array at cmucl / cmucl
Commits: 79ea44b8 by Raymond Toy at 2024-02-01T16:47:51-08:00 Fix some logic errors.
When checking the header value, we want a header value of exactly 1, which means that we have a static vector and that the mark is clear. This means the static vector is not referenced by anything.
We were also breaking the weak pointer in the wrong place. We only want to break the weak pointer when the static vector can be freed. Otherwise, leave the weak pointer alone.
- - - - -
1 changed file:
- src/lisp/gencgc.c
Changes:
===================================== src/lisp/gencgc.c ===================================== @@ -5441,8 +5441,14 @@ scan_weak_pointers(void) lispobj *header = (lispobj *) PTR(value);
if (maybe_static_array_p(*header)) { - if ((HeaderValue(*header) & 1) == 1) { - printf(" vectors_to_free[%d] = %p\n", k, (lispobj *) value); + if (HeaderValue(*header) == 1) { + /* + * We have a static array with the mark + * cleared which means it's not used. + */ + printf(" vectors_to_free[%d] = %p %08lx\n", + k, (lispobj *) value, *header); + /* * Only add it if we don't already have it. */ @@ -5461,12 +5467,13 @@ scan_weak_pointers(void) vectors_to_free[k] = value; ++k; } + + /* + * Now we can break the weak pointer to the static vector. + */ + wp->value = NIL; + wp->broken = T; } - /* - * Now we can break the weak pointer to the static vector. - */ - wp->value = NIL; - wp->broken = T; } } }
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/79ea44b89034e0086e3ba118...