digitalmars.D.learn - druntime investigation troubles
- Denis Shelomovskij (10/10) May 20 2012 Looks like `_STI_monitor_staticctor` is called by C runtime on Windows.
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (6/13) May 20 2012 Huh? It's perfectly open source. Read src/rt/monitor.c.
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (8/20) May 20 2012 Seems like I misunderstood what you were saying. Right, the C runtime on...
- Jacob Carlborg (5/8) May 20 2012 Have a look again. It's only called on Posix:
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (7/13) May 20 2012 I stand corrected. I had no idea about the magic involved here!
- Denis Shelomovskij (6/21) May 22 2012 So can anybody do something with it? At least document a bit what does
- Steven Schveighoffer (18/40) May 22 2012 =D0=B0=D0=BB:
- Jacob Carlborg (5/13) May 22 2012 "_STI_critical_init" is defined both in critical.c and critical_.d, but
- Jacob Carlborg (5/13) May 22 2012 I found a call now, it's in "_d_criticalenter", both in critical.c and
- Steven Schveighoffer (5/20) May 23 2012 OK, so does this mean monitor is only used on Posix, and critical is use...
- Jacob Carlborg (14/37) May 23 2012 No, there's a "_d_criticalenter" for Posix in critical(_).d/c which
- Sean Kelly (17/54) May 24 2012 make
- Denis Shelomovskij (7/21) May 23 2012 What call have you found in "_d_criticalenter"?
- Jacob Carlborg (19/22) May 23 2012 "_STI_critical_init" is called here:
- Steven Schveighoffer (5/27) May 23 2012 +1
- Jacob Carlborg (6/10) May 23 2012 I previously made a pull request and tried to fix code duplication in
- Sean Kelly (15/38) May 24 2012 https://github.com/D-Programming-Language/druntime/blob/master/src/rt/cr...
- Jacob Carlborg (5/6) May 24 2012 Yeah, I've noticed that. Does the unit test really need to run when you
- Sean Kelly (5/10) May 25 2012 ll rt_init from C?
- Sean Kelly (17/47) May 24 2012 =D0=B0=D0=BB:
-
Steven Schveighoffer
(15/59)
May 24 2012
On Thu, 24 May 2012 15:44:28 -0400, Sean Kelly
... - Sean Kelly (21/61) May 24 2012 ote:
- Steven Schveighoffer (6/10) May 25 2012 oh. That's.... horrible.
- Sean Kelly (8/15) May 25 2012 ote:
Looks like `_STI_monitor_staticctor` is called by C runtime on Windows. And C runtime isn't open-source. It creates troubles for investigation druntime (for me at least). Why is it so? Why not to call everything in C `main`, what's the reason? If there is no list of stuff done before C `main` druntime isn't open-source for me because I can't understand what is taking place just with druntime sources. -- Денис В. Шеломовский Denis V. Shelomovskij
May 20 2012
On 20-05-2012 10:41, Denis Shelomovskij wrote:Looks like `_STI_monitor_staticctor` is called by C runtime on Windows. And C runtime isn't open-source. It creates troubles for investigation druntime (for me at least). Why is it so? Why not to call everything in C `main`, what's the reason? If there is no list of stuff done before C `main` druntime isn't open-source for me because I can't understand what is taking place just with druntime sources.Huh? It's perfectly open source. Read src/rt/monitor.c. -- Alex Rønne Petersen alex lycus.org http://lycus.org
May 20 2012
On 20-05-2012 18:20, Alex Rønne Petersen wrote:On 20-05-2012 10:41, Denis Shelomovskij 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. -- Alex Rønne Petersen alex lycus.org http://lycus.orgLooks like `_STI_monitor_staticctor` is called by C runtime on Windows. And C runtime isn't open-source. It creates troubles for investigation druntime (for me at least). Why is it so? Why not to call everything in C `main`, what's the reason? If there is no list of stuff done before C `main` druntime isn't open-source for me because I can't understand what is taking place just with druntime sources.Huh? It's perfectly open source. Read src/rt/monitor.c.
May 20 2012
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 -- /Jacob Carlborg
May 20 2012
On 20-05-2012 22:13, Jacob Carlborg wrote:On 2012-05-20 18:25, Alex Rønne Petersen wrote:I stand corrected. I had no idea about the magic involved here! The proprietary Windows tool chain is seriously problematic... -- Alex Rønne Petersen alex lycus.org http://lycus.orgSeems 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
May 20 2012
21.05.2012 2:13, Alex Rønne Petersen написал:On 20-05-2012 22:13, Jacob Carlborg wrote:So can anybody do something with it? At least document a bit what does proprietary part do. -- Денис В. Шеломовский Denis V. ShelomovskijOn 2012-05-20 18:25, Alex Rønne Petersen wrote:I stand corrected. I had no idea about the magic involved here! The proprietary Windows tool chain is seriously problematic...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
May 22 2012
On Tue, 22 May 2012 15:16:30 -0400, Denis Shelomovskij = <verylonglogin.reg gmail.com> wrote:21.05.2012 2:13, Alex R=C3=B8nne Petersen =D0=BD=D0=B0=D0=BF=D0=B8=D1=81==D0=B0=D0=BB:me =On 20-05-2012 22:13, Jacob Carlborg wrote:On 2012-05-20 18:25, Alex R=C3=B8nne Petersen wrote:Seems like I misunderstood what you were saying. Right, the C runti=fe8874cb95b0df46b5065a770cef/src/rt/dmain2.d#L364on *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/7d663821d39c==So can anybody do something with it? At least document a bit what does=I stand corrected. I had no idea about the magic involved here! The proprietary Windows tool chain is seriously problematic...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 ord= er = to use it. I can't find any reference to STI_monitor in dmd, dmc, or druntime sourc= e = 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 section= s? -Steve
May 22 2012
On 2012-05-22 23:01, Steven Schveighoffer wrote: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? -Steve"_STI_critical_init" is defined both in critical.c and critical_.d, but I can't find a place where it's called on Windows. -- /Jacob Carlborg
May 22 2012
On 2012-05-22 23:01, Steven Schveighoffer wrote: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? -SteveI found a call now, it's in "_d_criticalenter", both in critical.c and critical_.d. -- /Jacob Carlborg
May 22 2012
On Wed, 23 May 2012 02:21:14 -0400, Jacob Carlborg <doob me.com> wrote:On 2012-05-22 23:01, Steven Schveighoffer wrote:OK, so does this mean monitor is only used on Posix, and critical is used only on windows? This seems a little weird. Especially since we are still compiling monitor.c. -SteveIt 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? -SteveI found a call now, it's in "_d_criticalenter", both in critical.c and critical_.d.
May 23 2012
On 2012-05-23 13:31, Steven Schveighoffer wrote:On Wed, 23 May 2012 02:21:14 -0400, Jacob Carlborg <doob me.com> wrote:No, there's a "_d_criticalenter" for Posix in critical(_).d/c which calls "_STI_critical_init". It seems there's a duplicate call for "_STI_critical_init" on Posix, in dmain2.d and in critical(_).d/c. Also this actually looks like a big mess: * critical_.d and critical.c contains the same code. critical_.d is used in the posix makefile. critical.c _and_ critical_.d is used in the win32 makefile * "_STI_critical_init" is implemented on both Posix and Windows, but it's only called on Posix * "_STI_critical_init" is called on multiple places on Posix. In dmain2.d and in "_d_criticalenter". -- /Jacob CarlborgOn 2012-05-22 23:01, Steven Schveighoffer wrote:OK, so does this mean monitor is only used on Posix, and critical is used only on windows? This seems a little weird. Especially since we are still compiling monitor.c. -SteveIt 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? -SteveI found a call now, it's in "_d_criticalenter", both in critical.c and critical_.d.
May 23 2012
On May 23, 2012, at 7:49 AM, Jacob Carlborg wrote:On 2012-05-23 13:31, Steven Schveighoffer wrote:wrote:On Wed, 23 May 2012 02:21:14 -0400, Jacob Carlborg <doob me.com> =make=20On 2012-05-22 23:01, Steven Schveighoffer wrote: =20It looks like code that is not called on Windows. Which doesn't =isn'tsense. It would seem that you must initialize a critical section in order to use it. =20 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 =andsome closed-source mystery, I think it is just unused code. =20 Sean, does this make sense? Are we using uninitialized critical sections? =20 -Steve=20 I found a call now, it's in "_d_criticalenter", both in critical.c =arecritical_.d. =20=20 OK, so does this mean monitor is only used on Posix, and critical is used only on windows? This seems a little weird. Especially since we =calls "_STI_critical_init". It seems there's a duplicate call for = "_STI_critical_init" on Posix, in dmain2.d and in critical(_).d/c.still compiling monitor.c. =20 -Steve=20 No, there's a "_d_criticalenter" for Posix in critical(_).d/c which ==20 Also this actually looks like a big mess: =20 * critical_.d and critical.c contains the same code. critical_.d is =used in the posix makefile. critical.c _and_ critical_.d is used in the = win32 makefile=20 * "_STI_critical_init" is implemented on both Posix and Windows, but =it's only called on Posix=20 * "_STI_critical_init" is called on multiple places on Posix. In =dmain2.d and in "_d_criticalenter". If I remember correctly, Brad Roberts tried porting the old C critical = section code to D a while back and something didn't work right. Both = versions of the code still exist, and at some point the D code needs to = be sorted and the C code should be thrown away. I suppose I should make = this my top priority, when I find the time.=
May 24 2012
23.05.2012 10:21, Jacob Carlborg написал:On 2012-05-22 23:01, Steven Schveighoffer 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. -- Денис В. Шеломовский Denis V. ShelomovskijIt 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? -SteveI found a call now, it's in "_d_criticalenter", both in critical.c and critical_.d.
May 23 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
May 23 2012
On Wed, 23 May 2012 15:46:16 -0400, Jacob Carlborg <doob me.com> wrote:On 2012-05-23 19:32, Denis Shelomovskij wrote:+1 dmain2 has that "magic runtime" feel where you look at it and are so confused that you are afraid to touch anything :P -SteveWhat 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.
May 23 2012
On 2012-05-23 21:58, Steven Schveighoffer wrote:+1 dmain2 has that "magic runtime" feel where you look at it and are so confused that you are afraid to touch anything :P -SteveI previously made a pull request and tried to fix code duplication in dmain2.d. Unfortunately some test case failed, I'm going to look into it again. -- /Jacob Carlborg
May 23 2012
On May 23, 2012, at 12:46 PM, Jacob Carlborg wrote:On 2012-05-23 19:32, Denis Shelomovskij wrote: =20https://github.com/D-Programming-Language/druntime/blob/master/src/rt/crit= ical_.d#L149What call have you found in "_d_criticalenter"? =20 By the way, `_STI_critical_init` is called before C main (uncomment printf's and check), so it is definitely called not by druntime. =20=20 "_STI_critical_init" is called here: =20 * ==20 * =https://github.com/D-Programming-Language/druntime/blob/master/src/rt/crit= ical.c#L124=20 * =https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmai= n2.d#L364=20 Found another one: =20 * =https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmai= n2.d#L255=20 I assume, and hope, that only one of these are actually called. That's =why I said all this is a big mess.=20 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.=
May 24 2012
On 2012-05-24 21:49, Sean Kelly wrote:There's a difference in how unittest execution is handled. This could probably be sorted out though.Yeah, I've noticed that. Does the unit test really need to run when you call rt_init from C? -- /Jacob Carlborg
May 24 2012
On May 24, 2012, at 11:25 PM, Jacob Carlborg <doob me.com> wrote:On 2012-05-24 21:49, Sean Kelly wrote: =20obably be sorted out though.There's a difference in how unittest execution is handled. This could pr==20 Yeah, I've noticed that. Does the unit test really need to run when you ca=ll rt_init from C? Not really. I wanted initialization to be the same either way, but unittests= seem optional.=20=
May 25 2012
On May 22, 2012, at 2:01 PM, Steven Schveighoffer wrote:On Tue, 22 May 2012 15:16:30 -0400, Denis Shelomovskij =<verylonglogin.reg gmail.com> wrote:=20=D0=B0=D0=BB:21.05.2012 2:13, Alex R=C3=B8nne Petersen =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=runtime onOn 20-05-2012 22:13, Jacob Carlborg wrote:On 2012-05-20 18:25, Alex R=C3=B8nne Petersen wrote: =20Seems like I misunderstood what you were saying. Right, the C =https://github.com/D-Programming-Language/druntime/blob/7d663821d39cfe8874= cb95b0df46b5065a770cef/src/rt/dmain2.d#L364*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.=20 Have a look again. It's only called on Posix: =20 =does proprietary part do.=20 So can anybody do something with it? At least document a bit what ==20 =20 =20=20 I stand corrected. I had no idea about the magic involved here! =20 The proprietary Windows tool chain is seriously problematic... =20sense. It would seem that you must initialize a critical section in = order to use it.=20=20 It looks like code that is not called on Windows. Which doesn't make ==20 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.=20 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.=
May 24 2012
On Thu, 24 May 2012 15:44:28 -0400, Sean Kelly <sean 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 ==81=D0=B0=D0=BB:<verylonglogin.reg gmail.com> wrote:21.05.2012 2:13, Alex R=C3=B8nne Petersen =D0=BD=D0=B0=D0=BF=D0=B8=D1=On 20-05-2012 22:13, Jacob Carlborg wrote:On 2012-05-20 18:25, Alex R=C3=B8nne Petersen wrote:Seems like I misunderstood what you were saying. Right, the C =9cfe8874cb95b0df46b5065a770cef/src/rt/dmain2.d#L364runtime 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/7d663821d3=es =So can anybody do something with it? At least document a bit what do=I stand corrected. I had no idea about the magic involved here! The proprietary Windows tool chain is seriously problematic...=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 a=ll =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... -Steve
May 24 2012
On May 24, 2012, at 1:27 PM, "Steven Schveighoffer" <schveiguy yahoo.com> wr= ote:On Thu, 24 May 2012 15:44:28 -0400, Sean Kelly <sean invisibleduck.org> wr=ote:=20g gmail.com> wrote:On May 22, 2012, at 2:01 PM, Steven Schveighoffer wrote: =20On Tue, 22 May 2012 15:16:30 -0400, Denis Shelomovskij <verylonglogin.re==D0=B0=D0=BB:=2021.05.2012 2:13, Alex R=C3=B8nne Petersen =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=e onOn 20-05-2012 22:13, Jacob Carlborg wrote:On 2012-05-20 18:25, Alex R=C3=B8nne Petersen wrote: =20Seems like I misunderstood what you were saying. Right, the C runtim=e8874cb95b0df46b5065a770cef/src/rt/dmain2.d#L364*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.=20 Have a look again. It's only called on Posix: =20 https://github.com/D-Programming-Language/druntime/blob/7d663821d39cf=roprietary part do.=20 So can anybody do something with it? At least document a bit what does p==20 =20 =20=20 I stand corrected. I had no idea about the magic involved here! =20 The proprietary Windows tool chain is seriously problematic... =20nse. It would seem that you must initialize a critical section in order to u= se it.=20=20 It looks like code that is not called on Windows. Which doesn't make se=e code, except those calls that are done for Posix only. This isn't some cl= osed-source mystery, I think it is just unused code.=20 I can't find any reference to STI_monitor in dmd, dmc, or druntime sourc=s?=20 Sean, does this make sense? Are we using uninitialized critical section=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, b= ut the full C runtime source is shipped with DMC--I have a copy.=20 This code is before my time, but I believe that DMC implicitly treats STI==20 Yeah, I do too. I did a full text search for STI_monitor and found nothin=g.=20 That's why I'm confused...It's not STI_monitor specifically. STI_anything is a module ctor and STD_any= thing is a module dtor. Or at least that's my recollection. There are a few p= laces in the DMC runtime that have initializers like this. I think one is so= mewhere in the floating-point support code.=20=
May 24 2012
On Thu, 24 May 2012 16:40:46 -0400, Sean Kelly <sean invisibleduck.org> wrote: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.oh. That's.... horrible. Yeah, we should eliminate this ASAP. Is there any reason it has to be done before C's main? -Steve
May 25 2012
On May 25, 2012, at 7:31 AM, "Steven Schveighoffer" <schveiguy yahoo.com> wr= ote:On Thu, 24 May 2012 16:40:46 -0400, Sean Kelly <sean invisibleduck.org> wr=ote:=20anything is a module dtor. Or at least that's my recollection. There are a f= ew places in the DMC runtime that have initializers like this. I think one i= s somewhere in the floating-point support code.It's not STI_monitor specifically. STI_anything is a module ctor and STD_==20 oh. That's.... horrible. =20 Yeah, we should eliminate this ASAP. Is there any reason it has to be don=e before C's main? None that I can think of. I bet it's just really old code.=20=
May 25 2012