[Vm-dev] Re: [squeak-dev] Endless recursion: "String new: -1"

Tobias Pape Das.Linux at gmx.de
Thu Jul 7 12:42:22 UTC 2016


Hi all

(cc vm-dev)
On 07.07.2016, at 14:28, David T. Lewis <lewis at mail.msen.com> wrote:

> I think the problem is in the primitive error code checking. The primitive
> is failing with #'bad argument' but the fallback code attempts to handle it
> as #'insufficient object memory'. It then tries to free some memory, fails
> to correct the problem, and raises a "Space is low" notifier.
> 

I noted that when we moved to Spur initially and I tried to fix tests.
The AllocationTest failed, and I changed

	ec == #'insufficient object memory' ifTrue: 

to
	(ec == #'insufficient object memory' or: [ec == #'bad argument']) ifTrue:

in Behavior>>#basicNew:

Maybe that was an error?

@Eliot, why does Spur return #'bad argument' instead of #'insufficient object memory' when
too much memory is to be allocated?

Best regards
	-Tobias


> Dave
> 
> 
> On Thu, Jul 07, 2016 at 09:23:14AM +0200, Levente Uzonyi wrote:
>> Someone seems to have trimmed the versions in the changes file. In Squeak 
>> 4.4 Behavior >> #basicNew: had the following body:
>> 
>> 	<primitive: 71>
>> 	self isVariable ifFalse:
>> 		[self error: self printString, ' cannot have variable sized 
>> 		instances'].
>> 	(sizeRequested isInteger and: [sizeRequested >= 0]) ifTrue:
>> 		["arg okay; space must be low."
>> 		OutOfMemory signal.
>> 		^ self basicNew: sizeRequested  "retry if user proceeds"].
>> 	self primitiveFailed
>> 
>> So, non-integer and negative arguments were primitive failures.
>> 
>> Levente
>> 
>> 
>> On Wed, 6 Jul 2016, David T. Lewis wrote:
>> 
>>> On Wed, Jul 06, 2016 at 06:43:25AM -0700, marcel.taeumel wrote:
>>>> Hi, there!
>>>> 
>>>> Is it okay that there is an endless recursion when evaluating "String 
>>>> new: -1"?
>>> 
>>> No, it is not okay. It should fail with a primitive failure.
>>> 
>>> Dave
>>> 
>>> 
>>>> 
>>>> ...
>>>> ByteString class(Behavior)>>handleFailingFailingBasicNew:
>>>> ByteString class(Behavior)>>handleFailingBasicNew:
>>>> ByteString class(Behavior)>>basicNew:
>>>> ByteString class(Behavior)>>handleFailingFailingBasicNew:
>>>> ByteString class(Behavior)>>handleFailingBasicNew:
>>>> ByteString class(Behavior)>>basicNew:
>>>> ByteString class(Behavior)>>handleFailingFailingBasicNew:
>>>> ByteString class(Behavior)>>handleFailingBasicNew:
>>>> ByteString class(Behavior)>>basicNew:
>>>> ...
>>>> 
>>>> I would like to have an error signaled instead. Note that the -1 is just 
>>>> an
>>>> example for a bad computation. The error I get is "Space is low" then. :-)
>>>> 
>>>> 
>>>> Best,
>>>> Marcel
>>>> 
>>>> 
>>>> 
>>>> --
>>>> View this message in context: 
>>>> http://forum.world.st/Endless-recursion-String-new-1-tp4905179.html
>>>> Sent from the Squeak - Dev mailing list archive at Nabble.com.




More information about the Vm-dev mailing list