codegen: write constant array size (refactor)