<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">well, I have the same problem but with the message #lengthOf:, but now the behavior is weird.</div><div>If I have the following code, everything works fine:</div><div><div>typesSize := (objectMemory lengthOf: types) - 1.</div></div><div><br></div><div>If I remove the - 1, like this:</div><div><div>typesSize := objectMemory lengthOf: types.</div></div><div><br></div><div>I get redefinition of labels errors:</div><div><div>../../spurstack64src/vm/gcc3x-interp.c:4879:2: error: redefinition of label 'l46'</div><div>        l46:    /* end lengthOf:format: */;</div><div>        ^</div><div>../../spurstack64src/vm/gcc3x-interp.c:4693:2: note: previous definition is here</div><div>        l46:    /* end lengthOf:format: */;</div><div>        ^</div><div><br></div><div>The thing is that in the first case #lengthOf: is not inlined but in the second it is and it looks like that the label is not regenerated every time it gets inlined.<br></div></div><div> Is there a well know workaround for this? I mean, I could do:</div><div><div><div>typesSize := (objectMemory lengthOf: types) - 0.</div></div> </div><div> and it will compile but that is not the point.</div><div> Also, why in the first case the code generator decides not to inline #lengthOf: but it does in the second case?</div><div><br></div><div>Thanks!</div><div>Hernan.</div><div><br></div><div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 9, 2018 at 8:40 PM Hernan Wilkinson <<a href="mailto:hernan.wilkinson@10pines.com">hernan.wilkinson@10pines.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div> I got compile errors when setting <inline: true> in a method I created.</div><div> The errors where a label redefinition such as:</div><div><div>../../spurstack64src/vm/gcc3x-interp.c:4790:2: error: redefinition of label 'l35'</div><div>        l35:    /* end classAtIndex: */;</div><div>        ^</div><div>../../spurstack64src/vm/gcc3x-interp.c:4634:2: note: previous definition is here</div><div>        l35:    /* end classAtIndex: */;</div><div>        ^</div><div><br></div><div> After some research I concluded that the problem was at SpurMemoryManager>>#classAtIndex: due to how it returns:</div><div>...</div><div><div><span style="white-space:pre-wrap">   </span>classTablePage = nilObj ifTrue:</div><div><span style="white-space:pre-wrap">          </span>[^nil].</div><div><span style="white-space:pre-wrap">  </span>^self</div><div><span style="white-space:pre-wrap">            </span>fetchPointer: (classIndex bitAnd: self classTableMinorIndexMask)</div><div><span style="white-space:pre-wrap">         </span>ofObject: classTablePage</div></div><div><br></div><div> I think the source code generator does not support correctly returning at different points when inlining the same method more than once. </div><div> So I changed that implementation to:</div><div>...</div><div><div><span style="white-space:pre-wrap">       </span>^classTablePage = nilObj </div><div><span style="white-space:pre-wrap">               </span>ifTrue: [nil]</div><div><span style="white-space:pre-wrap">            </span>ifFalse: [ self</div><div><span style="white-space:pre-wrap">                  </span>fetchPointer: (classIndex bitAnd: self classTableMinorIndexMask)</div><div><span style="white-space:pre-wrap">                 </span>ofObject: classTablePage ]</div></div><div><div><br></div></div><div> Doing so the compile errors were gone and the VM keeps working correctly.</div><div> Is this fix correct or does it have some performance hit I do not know?</div><div> Should I inform about this change with a PR? (Sorry about this question but I'm new to this vm stuff :-) )</div><div><br></div><div> Here is the complete code of the method:</div><div><div>classAtIndex: classIndex</div><div><span style="white-space:pre-wrap">      </span><api></div><div><span style="white-space:pre-wrap">      </span><inline: true></div><div><span style="white-space:pre-wrap">     </span>| classTablePage |</div><div><span style="white-space:pre-wrap">       </span>self assert: (classIndex >= 0 and: [classIndex <= self tagMask or: [classIndex >= self arrayClassIndexPun and: [classIndex <= self classIndexMask]]]).</div><div><span style="white-space:pre-wrap">       </span>classTablePage := self fetchPointer: classIndex >> self classTableMajorIndexShift</div><div><span style="white-space:pre-wrap">                                                  </span>ofObject: hiddenRootsObj.</div><div><span style="white-space:pre-wrap">        </span>^classTablePage = nilObj </div><div><span style="white-space:pre-wrap">               </span>ifTrue: [nil]</div><div><span style="white-space:pre-wrap">            </span>ifFalse: [ self</div><div><span style="white-space:pre-wrap">                  </span>fetchPointer: (classIndex bitAnd: self classTableMinorIndexMask)</div><div><span style="white-space:pre-wrap">                 </span>ofObject: classTablePage ]</div></div><div><br></div><div> Cheers!</div><div> Hernan.</div>-- <br><div dir="ltr" class="m_-1860032461183732376gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></span></strong></span></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></span></strong></span></div><div><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></span></strong></span></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></span></strong></span></div><div><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div></div></div></div></div>