Thread overview
What exactly the --allinst compiler flag does.
Sep 28
realhet
Sep 28
user1234
Sep 28
realhet
September 28

Hi,

I have some statements in my mind about --allinst, but I'm not sure they are correct or not.

  1. Normally the compiler analyzes the full code with all the modules, and it only compiles code for template things that are used in the given code.

  2. It is not needed for compiling the code with a single compiler instance, but is required for projects that are compiled in parallel by using multiple compiler instances.

Please someone tell me that these statements are valid or I know this wrong. (These are just my speculations, feelings, I didn't find documentation on this.)

September 28

On Saturday, 28 September 2024 at 12:20:43 UTC, realhet wrote:

>

Hi,

I have some statements in my mind about --allinst, but I'm not sure they are correct or not.

  1. Normally the compiler analyzes the full code with all the modules, and it only compiles code for template things that are used in the given code.

  2. It is not needed for compiling the code with a single compiler instance, but is required for projects that are compiled in parallel by using multiple compiler instances.

Please someone tell me that these statements are valid or I know this wrong. (These are just my speculations, feelings, I didn't find documentation on this.)

Speaking of speculation... "-allinst" disable an internal system of speculation that is: "this instance is already emitted so dont do it again".

Over the years it has appeared that the speculation does not always work as it should.

The classic symptom of that is when people encounter linker errors related to missing symbols. "-allinst" is the number one workaround. When activated, it's likely that things get emitted more than once, but at least, speculation bugs are gone.

You may ask "but then there should be other linker errors about double definition ?". No, those syms has to be emitted as "weak" symbols, so the linker ignore duplicated definitions.

September 28

Thank You!

I just did a test, I did not used the --allinst flag for the first time since 4-5 years.
It was a superstition since that, because back then it fixed something.

Now to my surprise the test build was successful :D
80KLOC, 20 modules -> 20 obj files, and the full compiling time went from 120 sec down to 107 sec. The exe started without any problems.

Hopefully my other project will run too.

So from now on I will only use --allinst again if I get linker errors in the future.