Ensure special static slots respect alignment. (#43683)
authormonojenkins <jo.shields+jenkins@xamarin.com>
Tue, 5 Jan 2021 21:19:04 +0000 (16:19 -0500)
committerGitHub <noreply@github.com>
Tue, 5 Jan 2021 21:19:04 +0000 (22:19 +0100)
commit2ab8e2d0e58ff166ea67f72f7e59a304c5590d17
treebdce9eb4fef5e090c2282060426082e80b769770
parent2ca626ada37cdd8edaa2bd3679a3d660736766fb
Ensure special static slots respect alignment. (#43683)

Without proper alignment, this may lead to reference types
being stored at non-pointer aligned offsets. Among other
issues this may lead to the GC not scanning those pointers
properly.

For example, a type such as
```
struct Point
{
    public int X;
    public int Y;
}
```
will have size 8 and alignment 4 on x64 platforms.

If we reuse the special slot allocated for the `Point` type to store
a reference pointer, it may not be pointer aligned.

Co-authored-by: joncham <joncham@users.noreply.github.com>
src/mono/mono/metadata/threads.c