<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 9 May 2017, at 17:46, <a href="mailto:vm-dev-request@lists.squeakfoundation.org" class="">vm-dev-request@lists.squeakfoundation.org</a> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Hi Max,</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">On May 9, 2017, at 7:30 AM, Max Leske <<a href="mailto:maxleske@gmail.com" class="">maxleske@gmail.com</a>> wrote:<br class=""><br class="">Hi Eliot,<br class=""><br class=""><br class=""><blockquote type="cite" class="">On 9 May 2017, at 14:32,<span class="Apple-converted-space"> </span><a href="mailto:vm-dev-request@lists.squeakfoundation.org" class="">vm-dev-request@lists.squeakfoundation.org</a><span class="Apple-converted-space"> </span>wrote:<br class=""><br class="">Hi Max,<br class=""><br class=""><blockquote type="cite" class="">On Sun, May 7, 2017 at 4:24 AM, Max Leske <<a href="mailto:maxleske@gmail.com" class="">maxleske@gmail.com</a>> wrote:<br class=""><br class="">Hi,<br class=""><br class="">I'm trying to store an image segment with the latest pharo.cog.spur VM (32<br class="">bits) but keep failing. The segment should produce a file of around 60 MB.<br class="">With an old V3 VM this is no problem at all. There, the WordArrayForSegment<br class="">instance has a size of 4094179 but with the new VM I always run out of<br class="">space because the primitive returns nil and, therefore, the word array size<br class="">is constantly being increased.<br class=""><br class=""></blockquote><br class="">It's been a while since I wrote this code so my understanding has been<br class="">coming back in fits and starts.  The limitation on the use of the hash bits<br class="">field is in referring to "out pointers", objects that the saved segment<br class="">refers to, not on objects internal to the segment.  So I think it's fixable.<br class=""><br class="">The hash field is used to map from an object in the heap to its object in<br class="">the segment.  Right now the mapping is from hash (22 bits) to location in<br class="">the segment / 8, and so limits the size of the segment to 500kb.  If an<br class="">extra level of indirection was added so that hash maps to index in an array<br class="">of oops, then the segment could contain up to 4m objects and I think<br class="">that'll be large enough for your use.<br class=""><br class="">If that's still not enough then the al;goriqhm will have to be rewritten to<br class="">use the first field of the object in the heap to point to its location in<br class="">the segment, and the first field saved alongside.<br class=""><br class="">So let me know.  Would you be happy with a fix that provides up to 4m<br class="">objects per segment or would you want to wait for something with a much<br class="">higher limit?<br class=""></blockquote><br class="">I've sampled 10000 classes and 10000 model specific classes at random and got a median #byteSizeOfInstance of 60 bytes. For 4m objects that would mean an upper limit of 240 MB file size. That is enough for me at the moment, yes. I currently need around 120 MB (with a safety margin of 15 MB).<br class="">Not having to watch out for that limit would be nice but my priority is to be able to create and read segments.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Agreed, but that's a bigger rewrite.  It would have in common some of the approach taken with the new compactor which also uses the first field, in its case to point to eventual location, while saving the contents of the first field in an array off to the side.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">(In Spur all objects, including zero-sized ones, have at least one field so that they can be converted into a forwarding pointer).</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">How much time do you think it will take you to make the change? I just need a rough idea so I can plan my work around that.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">It shouldn't take more than a day; two at the most.  You can help me by setting up a test case (although perhaps I can hack up a quick binary tree, so that might not help as much as I expect).</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>I've tried to come up with a test case and have one that doesn't fail... Not sure what I'm missing. The test reports the sizes of the segment and its out pointers. I'm including it here, maybe you can work from that. I'm also appending my hacked version of ImageSegment for Pharo 6 (mainly use of FileSystem instead of FileDirectory).</div><div><br class=""></div><div>I hope that helps.</div><div><br class=""></div><div>Cheers,</div><div>Max</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The primitive uses a routine that answers the objects to be written to the segment in an array.  The primitive needs to be extended with a word array, let's call it the mapArray, as big as this to hold the indirection from hash field to index in the mapArray in which are held the pointers to locations in the segment data.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">It might be just as easy/difficult to use a savedFirstFields array (also one element per object to be copied into the array) and point to location from first field, which would eliminate the upper limit immediately.  I'll mull this over while at the DMV; a chore I have to do today.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">Thanks for your help!<br class=""><br class="">Cheers,<br class="">Max<br class=""><br class=""><blockquote type="cite" class=""><br class=""><br class=""><blockquote type="cite" class="">I've built a debug VM and am stepping through the code but I don't have a<br class="">clear understanding of everything that's happening. The failure happens on<br class="">line 46626 of gcc3x-cointerp.c:<br class=""><br class="">newOop = (copy - segStart) / 8;<br class="">if (newOop > (identityHashHalfWordMask())) {<br class="">      return PrimErrLimitExceeded;  // <--------------- failure<br class="">}<br class=""><br class="">What I don't understand, for example, is why "newOop" is checked against<br class="">"identityHashHalfWordMask()" and not against the segment end ("endSeg").<br class="">Here's a list of the current values of the variables upon failure:<br class=""><br class="">objOop  sqInt   180812096<br class="">segAddr sqInt   494731288<br class="">segStart        sqInt   461176856<br class="">endSeg  sqInt   815841432<br class="">bodySize        usqInt  64<br class="">contextSize     sqInt   335672448<br class="">copy    sqInt   494731288<br class="">hash    sqInt   0<br class="">hash1   sqInt   4194302<br class="">i       sqInt   833574680<br class="">iLimiT  sqInt   833574688<br class="">methodHeader    sqInt   1193471<br class="">newOop  sqInt   4194304<br class="">numMediatedSlots        sqInt   833574688<br class="">numSlots        usqInt  14<br class="">oop     sqInt   142640272<br class=""><br class="">As you can see, "endSeg" would be more than large enough to hold the<br class="">object. Is it possible that there's an error here?<br class=""><br class="">Cheers,<br class="">Max<br class=""><br class=""><br class=""></blockquote><br class=""><br class="">--<span class="Apple-converted-space"> </span><br class="">_,,,^..^,,,_<br class="">best, Eliot</blockquote></blockquote></div></blockquote></div><br class=""><div class=""><br class=""></div><div class=""></div></body></html>