druntime investigation troubles

Sean Kelly sean at invisibleduck.org
Thu May 24 13:40:46 PDT 2012


On May 24, 2012, at 1:27 PM, "Steven Schveighoffer" <schveiguy at yahoo.com> wrote:

> On Thu, 24 May 2012 15:44:28 -0400, Sean Kelly <sean at invisibleduck.org> wrote:
> 
>> On May 22, 2012, at 2:01 PM, Steven Schveighoffer wrote:
>> 
>>> On Tue, 22 May 2012 15:16:30 -0400, Denis Shelomovskij <verylonglogin.reg at gmail.com> wrote:
>>> 
>>>> 21.05.2012 2:13, Alex Rønne Petersen написал:
>>>>> On 20-05-2012 22:13, Jacob Carlborg wrote:
>>>>>> On 2012-05-20 18:25, Alex Rønne Petersen wrote:
>>>>>> 
>>>>>>> Seems like I misunderstood what you were saying. Right, the C runtime on
>>>>>>> *Windows* is closed source. But, I don't know why you think that
>>>>>>> function is called by the C runtime; see src/rt/dmain2.d.
>>>>>> 
>>>>>> Have a look again. It's only called on Posix:
>>>>>> 
>>>>>> https://github.com/D-Programming-Language/druntime/blob/7d663821d39cfe8874cb95b0df46b5065a770cef/src/rt/dmain2.d#L364
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> I stand corrected. I had no idea about the magic involved here!
>>>>> 
>>>>> The proprietary Windows tool chain is seriously problematic...
>>>>> 
>>>> 
>>>> So can anybody do something with it? At least document a bit what does proprietary part do.
>>>> 
>>> 
>>> It looks like code that is not called on Windows.  Which doesn't make sense.  It would seem that you must initialize a critical section in order to use it.
>>> 
>>> I can't find any reference to STI_monitor in dmd, dmc, or druntime source code, except those calls that are done for Posix only.  This isn't some closed-source mystery, I think it is just unused code.
>>> 
>>> Sean, does this make sense?  Are we using uninitialized critical sections?
>> 
>> This code is before my time, but I believe that DMC implicitly treats STI functions as module ctors, and DMD inherits this behavior because it shares a C runtime with DMC.  It's been a while since I've looked at all of this, but the full C runtime source is shipped with DMC--I have a copy.
> 
> Yeah, I do too.  I did a full text search for STI_monitor and found nothing.
> 
> That's why I'm confused...

It's not STI_monitor specifically. STI_anything is a module ctor and STD_anything is a module dtor. Or at least that's my recollection. There are a few places in the DMC runtime that have initializers like this. I think one is somewhere in the floating-point support code. 


More information about the Digitalmars-d-learn mailing list