<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 7, 2016 at 10:27 AM, Tobias Pape <span dir="ltr"><<a href="mailto:Das.Linux@gmx.de" target="_blank">Das.Linux@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><br>
<br>
On 07.07.2016, at 18:44, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br>
<br>
> On Thu, Jul 7, 2016 at 5:42 AM, Tobias Pape <<a href="mailto:Das.Linux@gmx.de">Das.Linux@gmx.de</a>> wrote:<br>
><br>
> Hi all<br>
><br>
> (cc vm-dev)<br>
> On 07.07.2016, at 14:28, David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>> wrote:<br>
><br>
> > I think the problem is in the primitive error code checking. The primitive<br>
> > is failing with #'bad argument' but the fallback code attempts to handle it<br>
> > as #'insufficient object memory'. It then tries to free some memory, fails<br>
> > to correct the problem, and raises a "Space is low" notifier.<br>
> ><br>
><br>
> I noted that when we moved to Spur initially and I tried to fix tests.<br>
> The AllocationTest failed, and I changed<br>
><br>
> ec == #'insufficient object memory' ifTrue:<br>
><br>
> to<br>
> (ec == #'insufficient object memory' or: [ec == #'bad argument']) ifTrue:<br>
><br>
> in Behavior>>#basicNew:<br>
><br>
> Maybe that was an error?<br>
><br>
> @Eliot, why does Spur return #'bad argument' instead of #'insufficient object memory' when<br>
> too much memory is to be allocated?<br>
><br>
> It doesn't. It answers bad argument for anything other than an integer in the range 0 to 2^32-1 or 0 to 2^64-1.<br>
<br>
</span>But logically, it should return #'insufficient object memory' for > 2^64-1.<br></blockquote><div><br></div><div>I disagree. There are implementation limits. So answering #'unsupported operation' or #'bad argument 's as logical and defensible as #'out of memory' and actually truer. The VM does /not/ try and allocate memory beyond the address space size. So actually the failure for > the range 0 to 2^32-1 or 0 to 2^64-1 as #'out of memory' is untrue; the reason is not because the ysste, os out of memory; the reason is that this is a bad argument, outside of the valid range of the primitive.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Your change to return #'bad argument' with Spur broke AllocationTest>>#testOutOfMemorySignal which<br>
worked on pre-Spur Cog and interpreter.<br></blockquote><div><br></div><div>That's a problem with the test.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Best regards<br>
-Tobias<br>
<br>
PS: the test that predates spur:<br>
<br>
testOutOfMemorySignal<br>
"Ensure that OOM is signaled eventually"<br>
| sz |<br>
sz := 512*1024*1024. "work around the 1GB alloc bug"<br>
self should:[(1 to: 2000) collect:[:i| Array new: sz]] raise: OutOfMemory.<br>
<br>
"Call me when this test fails, I want your machine"<br>
sz := 1024*1024*1024*1024.<br>
self should:[Array new: sz] raise: OutOfMemory.<br>
<br>
The test failed, technically you have to call David lewis now ;)<br></blockquote><div><br></div><div>Sure. IMO this should be checking Smalltalk wordSize and choosing a value which is within the available address space. Don't make the tail wag the dog.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5"><br>
<br>
<br>
> I think your commit of topa 10/7/2015 20:41 for Behavior>>basicNew: is wrong, and should be reverted.<br>
><br>
><br>
> Best regards<br>
> -Tobias<br>
><br>
><br>
> > Dave<br>
> ><br>
> ><br>
> > On Thu, Jul 07, 2016 at 09:23:14AM +0200, Levente Uzonyi wrote:<br>
> >> Someone seems to have trimmed the versions in the changes file. In Squeak<br>
> >> 4.4 Behavior >> #basicNew: had the following body:<br>
> >><br>
> >> <primitive: 71><br>
> >> self isVariable ifFalse:<br>
> >> [self error: self printString, ' cannot have variable sized<br>
> >> instances'].<br>
> >> (sizeRequested isInteger and: [sizeRequested >= 0]) ifTrue:<br>
> >> ["arg okay; space must be low."<br>
> >> OutOfMemory signal.<br>
> >> ^ self basicNew: sizeRequested "retry if user proceeds"].<br>
> >> self primitiveFailed<br>
> >><br>
> >> So, non-integer and negative arguments were primitive failures.<br>
> >><br>
> >> Levente<br>
> >><br>
> >><br>
> >> On Wed, 6 Jul 2016, David T. Lewis wrote:<br>
> >><br>
> >>> On Wed, Jul 06, 2016 at 06:43:25AM -0700, marcel.taeumel wrote:<br>
> >>>> Hi, there!<br>
> >>>><br>
> >>>> Is it okay that there is an endless recursion when evaluating "String<br>
> >>>> new: -1"?<br>
> >>><br>
> >>> No, it is not okay. It should fail with a primitive failure.<br>
> >>><br>
> >>> Dave<br>
> >>><br>
> >>><br>
> >>>><br>
> >>>> ...<br>
> >>>> ByteString class(Behavior)>>handleFailingFailingBasicNew:<br>
> >>>> ByteString class(Behavior)>>handleFailingBasicNew:<br>
> >>>> ByteString class(Behavior)>>basicNew:<br>
> >>>> ByteString class(Behavior)>>handleFailingFailingBasicNew:<br>
> >>>> ByteString class(Behavior)>>handleFailingBasicNew:<br>
> >>>> ByteString class(Behavior)>>basicNew:<br>
> >>>> ByteString class(Behavior)>>handleFailingFailingBasicNew:<br>
> >>>> ByteString class(Behavior)>>handleFailingBasicNew:<br>
> >>>> ByteString class(Behavior)>>basicNew:<br>
> >>>> ...<br>
> >>>><br>
> >>>> I would like to have an error signaled instead. Note that the -1 is just<br>
> >>>> an<br>
> >>>> example for a bad computation. The error I get is "Space is low" then. :-)<br>
> >>>><br>
> >>>><br>
> >>>> Best,<br>
> >>>> Marcel<br>
> >>>><br>
> >>>><br>
> >>>><br>
<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>