Skip to content

Complex array accessors are not foldable

Raymond Toy requested to merge rtoy-fix-61-62-not-flushable into master

Fixes #61 (closed) and #62 (closed).

The ARRAY-HAS-FILL-POINTER-P and ARRAY-DISPLACEMENT functions are declared inline and the compiler tries to constant-fold these inlined functions operating on simple arrays.

Thus don't allow the compiler to constant-fold calls to %ARRAY-FILL-POINTER-P. This is normally protected by a call to ARRAY-HEADER-P, but when it's inlined, the compiler tries to constant-fold %ARRAY-FILL-POINTER-P on an array without such a slot.

Likewise ARRAY-DISPLACEMENT calls %ARRAY-DISPLACED-P, %ARRAY-DATA-VECTOR, and %ARRAY-DISPLACEMENT, and the calls are protected by ARRAY-HEADER-P. So don't constant-fold these either.

Maybe we could also make CONSTANT-FOLD-CALL be smarter about this?

  • src/compiler/generic/objdef.lisp
    • Remove flushable from these ref-trans methods.
  • src/general-info/release-21d.md
    • Update
  • tests/issues.lisp
    • Add tests from the bug reports.

Merge request reports