druntime investigation troubles
Sean Kelly
sean at invisibleduck.org
Thu May 24 12:49:37 PDT 2012
On May 23, 2012, at 12:46 PM, Jacob Carlborg wrote:
> On 2012-05-23 19:32, Denis Shelomovskij wrote:
>
>> What call have you found in "_d_criticalenter"?
>>
>> By the way, `_STI_critical_init` is called before C main (uncomment
>> printf's and check), so it is definitely called not by druntime.
>>
>
> "_STI_critical_init" is called here:
>
> * https://github.com/D-Programming-Language/druntime/blob/master/src/rt/critical_.d#L149
>
> * https://github.com/D-Programming-Language/druntime/blob/master/src/rt/critical.c#L124
>
> * https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L364
>
> Found another one:
>
> * https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L255
>
> I assume, and hope, that only one of these are actually called. That's why I said all this is a big mess.
>
> The last one is only called if the runtime is manually initialized, i.e. via C using the "rt_init" function. Which is stupid, "rt_init" should be called from the C main function as well. There's unnecessary code duplication here.
There's a difference in how unittest execution is handled. This could probably be sorted out though.
More information about the Digitalmars-d-learn
mailing list