dotnet / runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
MIT License
1.36k stars 188 forks source link

[NativeAOT-LLVM] Workaround to align thread statics to 8 byte boundary #2609

Closed yowl closed 3 weeks ago

yowl commented 3 weeks ago

This PR is a workaround to align all thread statics to 8 byte boundary to ensure those statics that do require 8 byte alignment are aligned.

Follows https://github.com/dotnet/runtimelab/issues/2606

yowl commented 3 weeks ago

cc @dotnet/nativeaot-llvm

SingleAccretion commented 3 weeks ago

Can we add a test that reliable fails without this change and reliably passes with this change?

Idea: since objects are allocated next to each other, usually, and thread static bases are allocated lazily, check that if we access thread statics of three types, A, B and C, where A and C need to be 8-aligned, while B has an 'odd' size (three pointers, so, just an int thread static field, for example), both A and C get aligned properly.

yowl commented 3 weeks ago

Not sure this is the simplest test, but it was failing.