Error in ImageSegment primitive?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in ImageSegment primitive?

Max Leske
Hi,

I'm trying to store an image segment with the latest pharo.cog.spur VM (32 bits) but keep failing. The segment should produce a file of around 60 MB. With an old V3 VM this is no problem at all. There, the WordArrayForSegment instance has a size of 4094179 but with the new VM I always run out of space because the primitive returns nil and, therefore, the word array size is constantly being increased.

I've built a debug VM and am stepping through the code but I don't have a clear understanding of everything that's happening. The failure happens on line 46626 of gcc3x-cointerp.c:

newOop = (copy - segStart) / 8;
if (newOop > (identityHashHalfWordMask())) {
        return PrimErrLimitExceeded;  // <--------------- failure
}

What I don't understand, for example, is why "newOop" is checked against "identityHashHalfWordMask()" and not against the segment end ("endSeg"). Here's a list of the current values of the variables upon failure:

objOop sqInt 180812096
segAddr sqInt 494731288
segStart sqInt 461176856
endSeg sqInt 815841432
bodySize usqInt 64
contextSize sqInt 335672448
copy sqInt 494731288
hash sqInt 0
hash1 sqInt 4194302
i sqInt 833574680
iLimiT sqInt 833574688
methodHeader sqInt 1193471
newOop sqInt 4194304
numMediatedSlots sqInt 833574688
numSlots usqInt 14
oop sqInt 142640272

As you can see, "endSeg" would be more than large enough to hold the object. Is it possible that there's an error here?

Cheers,
Max

Reply | Threaded
Open this post in threaded view
|

Re: Error in ImageSegment primitive?

Levente Uzonyi
IIRC Spur VMs do not support image segments. There should be code written
in Smalltalk to do what the V3 VMs used to do (loading and saving).
Wrong list btw. CC'd vm-dev.

Levente

On Sun, 7 May 2017, Max Leske wrote:

> Hi,
>
> I'm trying to store an image segment with the latest pharo.cog.spur VM (32 bits) but keep failing. The segment should produce a file of around 60 MB. With an old V3 VM this is no problem at all. There, the WordArrayForSegment instance has a size of 4094179 but with the new VM I always run out of space because the primitive returns nil and, therefore, the word array size is constantly being increased.
>
> I've built a debug VM and am stepping through the code but I don't have a clear understanding of everything that's happening. The failure happens on line 46626 of gcc3x-cointerp.c:
>
> newOop = (copy - segStart) / 8;
> if (newOop > (identityHashHalfWordMask())) {
> return PrimErrLimitExceeded;  // <--------------- failure
> }
>
> What I don't understand, for example, is why "newOop" is checked against "identityHashHalfWordMask()" and not against the segment end ("endSeg"). Here's a list of the current values of the variables upon failure:
>
> objOop sqInt 180812096
> segAddr sqInt 494731288
> segStart sqInt 461176856
> endSeg sqInt 815841432
> bodySize usqInt 64
> contextSize sqInt 335672448
> copy sqInt 494731288
> hash sqInt 0
> hash1 sqInt 4194302
> i sqInt 833574680
> iLimiT sqInt 833574688
> methodHeader sqInt 1193471
> newOop sqInt 4194304
> numMediatedSlots sqInt 833574688
> numSlots usqInt 14
> oop sqInt 142640272
>
> As you can see, "endSeg" would be more than large enough to hold the object. Is it possible that there's an error here?
>
> Cheers,
> Max

Reply | Threaded
Open this post in threaded view
|

Re: Error in ImageSegment primitive?

Eliot Miranda-2
Hi Levente,


> On May 7, 2017, at 6:13 AM, Levente Uzonyi <[hidden email]> wrote:
>
> IIRC Spur VMs do not support image segments. There should be code written in Smalltalk to do what the V3 VMs used to do (loading and saving).
> Wrong list btw. CC'd vm-dev.

That's not true.  I spent several me time getting them to pass certain tests.  The issue was the surrounding image level code that was assuming nextObject could be used to enumerate the results.  I didn't have the time or energy to fix this.  But the segment primitives should work.

>
> Levente
>
>> On Sun, 7 May 2017, Max Leske wrote:
>>
>> Hi,
>>
>> I'm trying to store an image segment with the latest pharo.cog.spur VM (32 bits) but keep failing. The segment should produce a file of around 60 MB. With an old V3 VM this is no problem at all. There, the WordArrayForSegment instance has a size of 4094179 but with the new VM I always run out of space because the primitive returns nil and, therefore, the word array size is constantly being increased.
>>
>> I've built a debug VM and am stepping through the code but I don't have a clear understanding of everything that's happening. The failure happens on line 46626 of gcc3x-cointerp.c:
>>
>> newOop = (copy - segStart) / 8;
>> if (newOop > (identityHashHalfWordMask())) {
>>    return PrimErrLimitExceeded;  // <--------------- failure
>> }
>>
>> What I don't understand, for example, is why "newOop" is checked against "identityHashHalfWordMask()" and not against the segment end ("endSeg"). Here's a list of the current values of the variables upon failure:
>>
>> objOop    sqInt    180812096
>> segAddr    sqInt    494731288
>> segStart    sqInt    461176856
>> endSeg    sqInt    815841432
>> bodySize    usqInt    64
>> contextSize    sqInt    335672448
>> copy    sqInt    494731288
>> hash    sqInt    0
>> hash1    sqInt    4194302
>> i    sqInt    833574680
>> iLimiT    sqInt    833574688
>> methodHeader    sqInt    1193471
>> newOop    sqInt    4194304
>> numMediatedSlots    sqInt    833574688
>> numSlots    usqInt    14
>> oop    sqInt    142640272
>>
>> As you can see, "endSeg" would be more than large enough to hold the object. Is it possible that there's an error here?
>>
>> Cheers,
>> Max
>

Reply | Threaded
Open this post in threaded view
|

Re: Error in ImageSegment primitive?

Eliot Miranda-2
In reply to this post by Max Leske
Hi Max,


> On May 7, 2017, at 4:24 AM, Max Leske <[hidden email]> wrote:
>
> Hi,
>
> I'm trying to store an image segment with the latest pharo.cog.spur VM (32 bits) but keep failing. The segment should produce a file of around 60 MB. With an old V3 VM this is no problem at all. There, the WordArrayForSegment instance has a size of 4094179 but with the new VM I always run out of space because the primitive returns nil and, therefore, the word array size is constantly being increased.
>
> I've built a debug VM and am stepping through the code but I don't have a clear understanding of everything that's happening. The failure happens on line 46626 of gcc3x-cointerp.c:
>
> newOop = (copy - segStart) / 8;
> if (newOop > (identityHashHalfWordMask())) {
>    return PrimErrLimitExceeded;  // <--------------- failure
> }
>
> What I don't understand, for example, is why "newOop" is checked against "identityHashHalfWordMask()" and not against the segment end ("endSeg"). Here's a list of the current values of the variables upon failure:
>
> objOop    sqInt    180812096
> segAddr    sqInt    494731288
> segStart    sqInt    461176856
> endSeg    sqInt    815841432
> bodySize    usqInt    64
> contextSize    sqInt    335672448
> copy    sqInt    494731288
> hash    sqInt    0
> hash1    sqInt    4194302
> i    sqInt    833574680
> iLimiT    sqInt    833574688
> methodHeader    sqInt    1193471
> newOop    sqInt    4194304
> numMediatedSlots    sqInt    833574688
> numSlots    usqInt    14
> oop    sqInt    142640272
>
> As you can see, "endSeg" would be more than large enough to hold the object. Is it possible that there's an error here?

Quite possibly.  Why don't you try and debug it in the simulator?  The Smalltalk code is much more comprehensible and is where you'd have to fix it anyway.

>
> Cheers,
> Max
>