[Vm-dev] [Spur] endless recursion in forward become

Bert Freudenberg bert at freudenbergs.de
Wed Jun 22 12:57:54 UTC 2016


Hi Eliot,

the become-forward works now, indeed.

But why is it different with the swapping become? This still gets into an
endless recursion:

(ByteString new: 20000000) become: (WideString new: 20000000)

Why is it creating copies at all?

- Bert -

On Mon, Jun 20, 2016 at 10:36 PM, Eliot Miranda <eliot.miranda at gmail.com>
wrote:

>
> Hi Bert,
>
>     it was a regression in argument validation for become introduced in
> fixing argument validation for the one-way copy hash case.  The code was
> erroneously checking that it had space to create copies of the input
> arguments, even though it was a one-way become.  It's a copyHash become and
> that confused it.  It's now fixed.  I'll generate sources and push and new
> builds should appear shortly ;-)
>
> On Thu, Jun 16, 2016 at 5:11 AM, Bert Freudenberg <bert at freudenbergs.de>
> wrote:
>
>>
>> I'm reading a 20MB text file. At some point it tries to convert the 20 MB
>> ByteString into an 80 MB WideString using forward become. This fails
>> resulting in an endless loop. The primitive failure code for
>> elementsForwardIdentityTo: (primitive 72) is  #'insufficient object memory'
>> and it tries again after growing:
>>
>> ec == #'insufficient object memory' ifTrue:
>> [Smalltalk garbageCollect < 1048576 ifTrue:
>> [Smalltalk growMemoryByAtLeast: 1048576].
>> ^self elementsForwardIdentityTo: otherArray].
>>
>> but the growMemoryByAtLeast: does not actually grow the memory:
>>
>> {Smalltalk garbageCollect.
>> Smalltalk growMemoryByAtLeast: 1048576.
>> Smalltalk garbageCollect.}
>>
>> ==>  #(58576608 16777216 58576608)
>>
>> 58 MB are not enough, but it doesn't grow any further.
>>
>> The question is, why does it try to allocate a new object at all? The
>> WideString exists already. I thought Spur would simply install a forwarder?
>>
>> To reproduce, execute
>>
>> (ByteString new: 20000000) writeStream nextPut: (Character value: 128169)
>>
>> You probably want to follow that with a user interrupt (Cmd-period).
>>
>> This happens using the latest Spur VM from github (r201606160944)
>>
>> - Bert -
>>
>>
>
>
> --
> _,,,^..^,,,_
> best, Eliot
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160622/00029e62/attachment.htm


More information about the Vm-dev mailing list