From mika at async.caltech.edu Sun Dec 10 22:19:25 2017 From: mika at async.caltech.edu (Mika Nystrom) Date: Sun, 10 Dec 2017 13:19:25 -0800 Subject: [M3devel] Fwd: Strange code in Rd.CharsReady In-Reply-To: References: Message-ID: not sure the list allows my other email address to email to it... ---------- Forwarded message ---------- From: Mika Nystrom Date: Sun, Dec 10, 2017 at 1:07 PM Subject: Strange code in Rd.CharsReady To: m3devel at elegosoft.com Hello m3devel, Long time no see! I am trying to resurrect some old code I have, and I have run into a strange issue. According to https://github.com/modula3/cm3/blame/master/m3-libs/libm3/src/rw/Rd.m3 the current source code for the routine Rd.CharsReady is as follows below. I am truly suspicious of line 389, which says it comes from some Unicode merge. IF NextBuff (rd) THEN RETURN 1 END (*line 389*) I have a program that misbehaves. This program appears to be BLOCKING in CharsReady. This behavior obviously defeats the purpose of CharsReady. I can't seem to cut and paste the traceback for some reason but it's calling Rd__NextBuff at line 151 and further then to ConnRW__RdSeek with dontBlock FALSE (so "OK to block") and then SchedulerPosix__AlertWait. The old version of line 389 I believe was IF rd.seek(rd.cur, TRUE) = SeekResult.Eof THEN RETURN 1 END where TRUE means "don't block". Can someone tell me the rationale for the change and whether I am correct if I say that the new version is wrong? I am wonder how this change could even have gotten into the code in the first place if it's causing CharsReady to block, seems like a pretty obvious bug and I don't see a reason for tthe change in the first place. Mika PROCEDURE CharsReady(rd: T): CARDINAL 383 RAISES {Failure} = [image: @hosking] Hide warning. 3 years ago 384 <*FATAL Thread.Alerted*> [image: @jaykrell] initial diff from ../config/PPC_LINUX 10 years ago 385 BEGIN [image: @RodneyBates] Merge Unicode branch into head. For a summary of the changes, see 4 years ago 386 LOCK rd DO [image: @jaykrell] initial diff from ../config/PPC_LINUX 10 years ago 387 IF rd.cur = rd.hi THEN 388 IF rd.closed THEN Die() END; [image: @RodneyBates] Merge Unicode branch into head. For a summary of the changes, see 4 years ago 389 IF NextBuff (rd) THEN RETURN 1 END [image: @jaykrell] initial diff from ../config/PPC_LINUX 10 years ago 390 END; 391 RETURN rd.hi - rd.cur; [image: @RodneyBates] Merge Unicode branch into head. For a summary of the changes, see 4 years ago 392 END; [image: @jaykrell] initial diff from ../config/PPC_LINUX 10 years ago 393 END CharsReady; -------------- next part -------------- An HTML attachment was scrubbed... URL: From mika at async.caltech.edu Mon Dec 11 07:27:43 2017 From: mika at async.caltech.edu (Mika Nystrom) Date: Sun, 10 Dec 2017 22:27:43 -0800 Subject: [M3devel] Strange code in Rd.CharsReady In-Reply-To: References: Message-ID: Next question. Why does this keep coming and going? In m3-libs/libm3/src/m3makefile: % include_dir ("types") % which no longer has an m3makefile This was broken (removed) once before and unbroken somehow... I keep losing "LongrealType", which is an interface needed to instantiate generics with LONGREAL. Now it's been re-broken? On Sun, Dec 10, 2017 at 1:19 PM, Mika Nystrom wrote: > not sure the list allows my other email address to email to it... > > ---------- Forwarded message ---------- > From: Mika Nystrom > Date: Sun, Dec 10, 2017 at 1:07 PM > Subject: Strange code in Rd.CharsReady > To: m3devel at elegosoft.com > > > Hello m3devel, > > Long time no see! > > I am trying to resurrect some old code I have, and I have run into a > strange issue. > > According to > > https://github.com/modula3/cm3/blame/master/m3-libs/libm3/src/rw/Rd.m3 > > the current source code for the routine Rd.CharsReady is as follows below. > > I am truly suspicious of line 389, which says it comes from some Unicode > merge. > > IF NextBuff (rd) THEN RETURN 1 END (*line 389*) > > I have a program that misbehaves. > > This program appears to be BLOCKING in CharsReady. This behavior > obviously defeats the purpose of CharsReady. I can't seem to cut and paste > the traceback for some reason but it's calling Rd__NextBuff at line 151 and > further then to ConnRW__RdSeek with dontBlock FALSE (so "OK to block") and > then SchedulerPosix__AlertWait. > > The old version of line 389 I believe was > > IF rd.seek(rd.cur, TRUE) = SeekResult.Eof THEN RETURN 1 END > > where TRUE means "don't block". > > Can someone tell me the rationale for the change and whether I am correct > if I say that the new version is wrong? > > I am wonder how this change could even have gotten into the code in the > first place if it's causing CharsReady to block, seems like a pretty > obvious bug and I don't see a reason for tthe change in the first place. > > Mika > > > > PROCEDURE CharsReady(rd: T): CARDINAL > 383 > RAISES {Failure} = > [image: @hosking] > Hide warning. > > 3 years ago > > > 384 > <*FATAL Thread.Alerted*> > [image: @jaykrell] > initial diff from ../config/PPC_LINUX > > 10 years ago > 385 > BEGIN > [image: @RodneyBates] > Merge Unicode branch into head. For a summary of the changes, see > > 4 years ago > > > 386 > LOCK rd DO > [image: @jaykrell] > initial diff from ../config/PPC_LINUX > > 10 years ago > 387 > IF rd.cur = rd.hi THEN > 388 > IF rd.closed THEN Die() END; > [image: @RodneyBates] > Merge Unicode branch into head. For a summary of the changes, see > > 4 years ago > > > 389 > IF NextBuff (rd) THEN RETURN 1 END > [image: @jaykrell] > initial diff from ../config/PPC_LINUX > > 10 years ago > 390 > END; > 391 > RETURN rd.hi - rd.cur; > [image: @RodneyBates] > Merge Unicode branch into head. For a summary of the changes, see > > 4 years ago > > > 392 > END; > [image: @jaykrell] > initial diff from ../config/PPC_LINUX > > 10 years ago > 393 > END CharsReady; > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mika at async.caltech.edu Mon Dec 11 08:06:06 2017 From: mika at async.caltech.edu (Mika Nystrom) Date: Sun, 10 Dec 2017 23:06:06 -0800 Subject: [M3devel] Strange code in Rd.CharsReady In-Reply-To: References: Message-ID: My program started working when I reverted the code. (CharsReady no longer blocks) I guess I probably broke some Unicode though...?? On Sun, Dec 10, 2017 at 1:19 PM, Mika Nystrom wrote: > not sure the list allows my other email address to email to it... > > ---------- Forwarded message ---------- > From: Mika Nystrom > Date: Sun, Dec 10, 2017 at 1:07 PM > Subject: Strange code in Rd.CharsReady > To: m3devel at elegosoft.com > > > Hello m3devel, > > Long time no see! > > I am trying to resurrect some old code I have, and I have run into a > strange issue. > > According to > > https://github.com/modula3/cm3/blame/master/m3-libs/libm3/src/rw/Rd.m3 > > the current source code for the routine Rd.CharsReady is as follows below. > > I am truly suspicious of line 389, which says it comes from some Unicode > merge. > > IF NextBuff (rd) THEN RETURN 1 END (*line 389*) > > I have a program that misbehaves. > > This program appears to be BLOCKING in CharsReady. This behavior > obviously defeats the purpose of CharsReady. I can't seem to cut and paste > the traceback for some reason but it's calling Rd__NextBuff at line 151 and > further then to ConnRW__RdSeek with dontBlock FALSE (so "OK to block") and > then SchedulerPosix__AlertWait. > > The old version of line 389 I believe was > > IF rd.seek(rd.cur, TRUE) = SeekResult.Eof THEN RETURN 1 END > > where TRUE means "don't block". > > Can someone tell me the rationale for the change and whether I am correct > if I say that the new version is wrong? > > I am wonder how this change could even have gotten into the code in the > first place if it's causing CharsReady to block, seems like a pretty > obvious bug and I don't see a reason for tthe change in the first place. > > Mika > > > > PROCEDURE CharsReady(rd: T): CARDINAL > 383 > RAISES {Failure} = > [image: @hosking] > Hide warning. > > 3 years ago > > > 384 > <*FATAL Thread.Alerted*> > [image: @jaykrell] > initial diff from ../config/PPC_LINUX > > 10 years ago > 385 > BEGIN > [image: @RodneyBates] > Merge Unicode branch into head. For a summary of the changes, see > > 4 years ago > > > 386 > LOCK rd DO > [image: @jaykrell] > initial diff from ../config/PPC_LINUX > > 10 years ago > 387 > IF rd.cur = rd.hi THEN > 388 > IF rd.closed THEN Die() END; > [image: @RodneyBates] > Merge Unicode branch into head. For a summary of the changes, see > > 4 years ago > > > 389 > IF NextBuff (rd) THEN RETURN 1 END > [image: @jaykrell] > initial diff from ../config/PPC_LINUX > > 10 years ago > 390 > END; > 391 > RETURN rd.hi - rd.cur; > [image: @RodneyBates] > Merge Unicode branch into head. For a summary of the changes, see > > 4 years ago > > > 392 > END; > [image: @jaykrell] > initial diff from ../config/PPC_LINUX > > 10 years ago > 393 > END CharsReady; > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rodney_bates at lcwb.coop Tue Dec 12 22:16:42 2017 From: rodney_bates at lcwb.coop (Rodney M. Bates) Date: Tue, 12 Dec 2017 15:16:42 -0600 Subject: [M3devel] Strange code in Rd.CharsReady In-Reply-To: References: Message-ID: <8f43a5e0-9ac6-daca-6e05-5d9f5f177d2b@lcwb.coop> These got moved to m3core, where similar interfaces for other types were all along. Also expanded some, and renamed. Specifically, in m3-libs/m3core/src/float/Common, RealFloat.i3 LongFloat.i3, and ExtendedFloat.i3. Subdirectory m3-libs/libm3/src/types is leftover stuff that, by now, should probably be removed altogether. On 12/11/2017 12:27 AM, Mika Nystrom wrote: > Next question. > > Why does this keep coming and going? > > In > > m3-libs/libm3/src/m3makefile: > > % include_dir ("types") % which no longer has an m3makefile > > This was broken (removed) once before and unbroken somehow... I keep losing "LongrealType", which is an interface needed to instantiate generics with LONGREAL. > > Now it's been re-broken? > > > On Sun, Dec 10, 2017 at 1:19 PM, Mika Nystrom > wrote: > > not sure the list allows my other email address to email to it... > > ---------- Forwarded message ---------- > From: *Mika Nystrom* > > Date: Sun, Dec 10, 2017 at 1:07 PM > Subject: Strange code in Rd.CharsReady > To: m3devel at elegosoft.com > > > Hello m3devel, > > Long time no see! > > I am trying to resurrect some old code I have, and I have run into a strange issue. > > According to > > https://github.com/modula3/cm3/blame/master/m3-libs/libm3/src/rw/Rd.m3 > > the current source code for the routine Rd.CharsReady is as follows below. > > I am truly suspicious of line 389, which says it comes from some Unicode merge. > > IF NextBuff (rd) THEN RETURN 1 END (*line 389*) > > I have a program that misbehaves. > > This program appears to be BLOCKING in CharsReady. This behavior obviously defeats the purpose of CharsReady. I can't seem to cut and paste the traceback for some reason but it's calling Rd__NextBuff at line 151 and further then to ConnRW__RdSeek with dontBlock FALSE (so "OK to block") and then SchedulerPosix__AlertWait. > > The old version of line 389 I believe was > > IF rd.seek(rd.cur, TRUE) = SeekResult.Eof THEN RETURN 1 END > > where TRUE means "don't block". > > Can someone tell me the rationale for the change and whether I am correct if I say that the new version is wrong? > > I am wonder how this change could even have gotten into the code in the first place if it's causing CharsReady to block, seems like a pretty obvious bug and I don't see a reason for tthe change in the first place. > > Mika > > > > PROCEDURE CharsReady(rd: T): CARDINAL > 383 > RAISES {Failure} = > @hosking > Hide warning. > 3 years ago > > 384 > <*FATAL Thread.Alerted*> > @jaykrell > initial diff from ../config/PPC_LINUX > 10 years ago > 385 > BEGIN > @RodneyBates > Merge Unicode branch into head. For a summary of the changes, see > 4 years ago > > 386 > LOCK rd DO > @jaykrell > initial diff from ../config/PPC_LINUX > 10 years ago > 387 > IF rd.cur = rd.hi THEN > 388 > IF rd.closed THEN Die() END; > @RodneyBates > Merge Unicode branch into head. For a summary of the changes, see > 4 years ago > > 389 > IF NextBuff (rd) THEN RETURN 1 END > @jaykrell > initial diff from ../config/PPC_LINUX > 10 years ago > 390 > END; > 391 > RETURN rd.hi - rd.cur; > @RodneyBates > Merge Unicode branch into head. For a summary of the changes, see > 4 years ago > > 392 > END; > @jaykrell > initial diff from ../config/PPC_LINUX > 10 years ago > 393 > END CharsReady; > > > > > > > > > _______________________________________________ > M3devel mailing list > M3devel at elegosoft.com > https://m3lists.elegosoft.com/mailman/listinfo/m3devel > -- Rodney Bates rodney.m.bates at acm.org