[Chapel Merge] Fix constness issues for codegen-time arrays

Branch: refs/heads/main
Revision: e2dc2cdae97120489aecd101b722ba19ae62ebdd
Author: dlongnecke-cray
Link: Fix constness issues for codegen-time arrays by dlongnecke-cray · Pull Request #28777 · chapel-lang/chapel · GitHub
Log Message:
Fix constness issues for codegen-time arrays (#28777)

In a previous PR I tried to adjust the types of several codegen-time
arrays in order to simplify them, but that caused problems. Revert my
changes, and mark several arrays that can be constant as constant under
LLVM.

In my ideal world, within the runtime, the types of these arrays
wouldn't have any const decorators at all, because const usually
just causes grief within C code. However, in the generated Chapel
program code, they do need to be marked as const in some capacity
because we need to ensure that they are correctly placed in read-only
memory by the C compiler.

In the future when chplcgfns.h is removed we can decouple the types a
bit more, but for now, we need to make sure that things still strongly
match w.r.t. constness.

TESTING

  • standard
  • LLVM=none, TARGET_COMPILER=gnu
  • COMM=gasnet

Reviewed by @benharsh. Thanks!

Compare: Comparing ab9448daa43017d85c8b8f90693912ba5464f5f7...6529a9185eb3c475f517efc18dc0a68d69b75382 · chapel-lang/chapel · GitHub

Diff:
M compiler/codegen/codegen.cpp
M runtime/include/chpl-comm.h
M runtime/include/chpl-mem-desc.h
M runtime/include/chpl-prginfo-data-macro.h
M runtime/include/chplcgfns.h
M runtime/src/chpl-comm.c
M test/dynamic-loading/CodegenTimeArrays.chpl
https://github.com/chapel-lang/chapel/pull/28777.diff