druntime investigation troubles

Jacob Carlborg doob at me.com
Wed May 23 12:46:16 PDT 2012


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.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list