Page MenuHome

Cleanup: Const correctness of several large arrays.
ClosedPublic

Authored by Ray Molenkamp (LazyDodo) on Jul 25 2019, 7:50 PM.

Details

Summary

While looking into the ODR issues of T55054 / D5326 I was looking at some of the linker output and noticed some rather substantial arrays sitting in one of the RW segments. Turns out there is a bunch of const data we did not mark as such.

The main offenders were the ccl::SOBOL_NUMBERS lookup table and pretty much all datatoc output

This patch properly marks these arrays const

before

Size of blender.exe is 135.972864 MB
      name:   mem size  ,  disk size
     .text: 84.303698 MB
    .rdata: 26.809392 MB
     .data: 21.529961 MB, 20.121600 MB
    .pdata:  2.831688 MB
    .idata:  0.038624 MB
    .didat:  0.001971 MB
      .tls:  0.000813 MB
    .00cfg:  0.000283 MB
    _RDATA:  0.179370 MB
     .rsrc:  0.368265 MB
    .reloc:  1.313347 MB

after

Size of blender.exe is 135.972864 MB
      name:   mem size  ,  disk size
     .text: 84.303698 MB
    .rdata: 37.246752 MB
     .data: 11.092649 MB,  9.684480 MB
    .pdata:  2.831688 MB
    .idata:  0.038624 MB
    .didat:  0.001971 MB
      .tls:  0.000813 MB
    .00cfg:  0.000283 MB
    _RDATA:  0.179370 MB
     .rsrc:  0.368265 MB
    .reloc:  1.313347 MB

Diff Detail

Repository
rB Blender
Branch
tmp_fix_const_globals (branched from master)
Build Status
Buildable 4158
Build 4158: arc lint + arc unit

Event Timeline

Assuming it does compile :)

Good catch!

source/blender/datatoc/datatoc.c
97–101

FOO const vs const FOO.
Is is possible to stick to const FOO?

This revision is now accepted and ready to land.Jul 25 2019, 9:44 PM
Ray Molenkamp (LazyDodo) marked an inline comment as done.Jul 25 2019, 10:30 PM

Assuming it does compile :)

it builds and passes the unit tests on windows.

source/blender/datatoc/datatoc.c
97–101

good catch.

Ray Molenkamp (LazyDodo) marked an inline comment as done.Jul 25 2019, 10:33 PM

Also there's no way to tag diffs for a version but any of these cleanups diffs are meant to go into the 2.81 merge window.

Everything what goes to master now will be 2.81. Unless carefully reviewed and cherry-picked to 2.80 branch.

Think you can go ahead and commit this change.