<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        <div>Hi all! :-)</div><div><br></div><div>I think I managed to (somewhat) complete the refactoring of #literalsDo:, #allLiterals, and #hasLiteral:. My goals were as follows:</div><div><br></div><div>1. Reduce duplicate enumeration code in the form of "1 to: self numLiterals -1 do:".</div><div>2. Fix regresssions that occurred in SistaV1 because of blocks not being inlined at the byte-code level anymore (compared to V3).</div><div>3. Understand and clarify the meaning of "literal" in the programming interface.</div><div>4. Always enumerate literals thoroughly for #allLiteralsDo: (new) and #hasLiteral:.</div><div><br></div><div><b>Please find attached a changeset to try out.</b> The interface to please review is:</div><div><br></div><div>- all implementors of <b>#literalsDo: </b>and<b> #literals </b>and<b> #literalAt:</b> (-> does not decend)</div><div>- all implementors of <b>#codeLiteralsDo: </b>and<b> #codeLiterals</b> (-> decends into compiled code objects)</div><div>- all implementors of <b>#allLiteralsDo: </b>and<b> #allLiterals</b> (-> decends into compiled code objects and arrays and bindings and pragmas ... to make enumeration "thorough")</div><div>- all implementors of<b> #hasLiteral: </b>and<b> #hasLiteralSuchThat: </b>and<b> #literalEqual:</b></div><div>- all implementors of <b>#messagesDo: </b>and<b> #messages </b>and<b> #sendsMessage:</b></div><div><br></div><div>Please also take a look at the (rewritten) tests:</div><div><br></div><div><b>LiteralRefLocatorTest >> #testFindLiteralsInBytecode</b></div><div><b>LiteralRefLocatorTest >> #testThoroughFindLiteralsInBytecode</b></div><div><br></div><div>The following benchmarks look promising:</div><div><br></div><div>[SystemNavigation default allCallsOn: #drawOn:] bench </div><div><br></div><div> BEFORE: '41.3 per second. 24.2 milliseconds per run.'</div><div> AFTER: '37.7 per second. 26.5 milliseconds per run.'</div><div> </div><div>[SystemNavigation default allSelectorsAndMethodsDo: [:b :s :m | m allLiterals]] bench</div><div><br></div><div>BEFORE:  '33.1 per second. 30.2 milliseconds per run.'</div><div>AFTER: '32 per second. 31.2 milliseconds per run.'</div><div><br></div><div>[SystemNavigation default allCallsOnClass: OrderedCollection] bench</div><div><br></div><div>BEFORE:  '34.9 per second. 28.7 milliseconds per run.'</div><div><span style="color: #ff0000"> AFTER: '4.04 per second. 248 milliseconds per run.'</span></div><div><br></div><div>[(PasteUpMorph >> #tryInvokeHalo:) allLiterals] bench</div><div><br></div><div>BEFORE: '1,320,000 per second. 759 nanoseconds per run.'</div><div>AFTER:  '951,000 per second. 1.05 microseconds per run.'</div><div><br></div><div>[(PasteUpMorph >> #tryInvokeHalo:) hasLiteral: #second] bench</div><div><br></div><div>BEFORE: '3,710,000 per second. 270 nanoseconds per run.'</div><div><span style="color: #ff0000">AFTER: '1,170,000 per second. 855 nanoseconds per run.'</span></div><div><br></div><div>[(Object >> #yourself) allLiterals] bench</div><div><br></div><div>BEFORE: '3,570,000 per second. 280 nanoseconds per run.'</div><div>AFTER:  '3,660,000 per second. 273 nanoseconds per run.'</div><div><br></div><div>Here are the things I could not manage to fix or implement yet:</div><div><br></div><div>1. Enumerating <b>special selectors</b> via #allLiteralsDo:. Yet, works for #hasLiteral: and #messagesDo: because of using InstructionStream scanning.</div><div>2. Enumerating <b>special literals</b> via #allLiteralsDo:. Yet, works for #hasLiteral: because of using InstructionStream scanning.</div><div><br></div><div>It would be nice to have a version of BytecodeEncoder class >> #scanBlockOrNilForLiteral: that would be able to just check for any special selector or literal.</div><div><br></div><div>Best,</div><div>Marcel</div><div><br></div><div class="mb_sig"></div>
                                        
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 27.06.2019 09:31:56 schrieb Marcel Taeumel <marcel.taeumel@hpi.de>:</p><div style="font-family:Arial,Helvetica,sans-serif"><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        Hi Eliot,<div><br></div><div>thanks for the reply. :-) </div><div><br></div><div>Do you think we need a way to not decend into Array literals and Pragmas *but* CompiledCode (i.e., SistaV1)? At the time of writing, my changeset offers #allLiteralsDo: to go all the way down and #literalsDo: to just enumerate the stuff between header and first bytecode.</div><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div>
                                        
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 27.06.2019 00:42:03 schrieb Eliot Miranda <eliot.miranda@gmail.com>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Marcel,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 24, 2019 at 5:32 AM Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de">marcel.taeumel@hpi.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div id="gmail-m_-8297468213761953301__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">
                                        
                                        
                                            
                                        
                                        
                                        Hi all,<div><br></div><div>next round. Please find attached a changeset:</div></div></blockquote><div><br></div><div>thanks.  Sorry to be late to this party.</div><div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div id="gmail-m_-8297468213761953301__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)"><div><br></div><div>- senders browsing is only slightly slower but *thorough* all the time</div></div></blockquote><div><br></div><div>I think that's safe.  Thorough might be retained as a way of not descending into Array literals and Pragmas.  But if you're happy that we always traverse these (and avoid being caught by recursion in circular strucutres0 THEN FINE.</div><div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div id="gmail-m_-8297468213761953301__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)"><div>- #hasLiteral: now also works for #>= and other special literals, even though not enumerable</div><div>- #literalsDo: enumerates the *raw* literals (for copy etc.) in that byte array (i.e. after header, before first byte code)</div><div>- #allLiteralsDo: enumerates the *real* literals, that is, it is thorough but skips special objects such as outer scope, method selector, and class binding -- (for #hasLiteral:, tools etc.)</div><div><br></div><div><span style="font-size: 13.3333px">I just thought about writing some tests for it but those would have to account for V3 vs. SistaV1. Hmmm... maybe just tests for #hasLiteral: and #allLiteralsDo:. Not that low-level #literalsDo:.</span></div></div></blockquote><div><br></div><div>Alas yes.  ut there are some prototype tests you can use.  See LiteralRefLocatorTest.  These tests compile two versions of each tested method, in the primary and secondary bytecode sets.  So if you start there you'll find that testing both V3PlusClosures and SistaV1 is taken care of.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div id="gmail-m_-8297468213761953301__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)"><div><br></div><div>Best,</div><div>Marcel</div><div class="gmail-m_-8297468213761953301mb_sig"></div>
                                        
                                        <blockquote class="gmail-m_-8297468213761953301history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 24.06.2019 11:27:31 schrieb Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif"><div id="gmail-m_-8297468213761953301__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">
                                        Hi Nicolas,<div><br></div><div>thanks. :-) That's correct. It's an extension to high-level test and enumeration. I just discovered that I have to integrate (or update) CompiledCode >> #refersTo:bytecodeScanner:thorough: to respect those special selectors.</div><div><br></div><div>Best,</div><div>Marcel</div><div class="gmail-m_-8297468213761953301mb_sig"></div><blockquote class="gmail-m_-8297468213761953301history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 24.06.2019 10:56:21 schrieb Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr"><div>Hi Marcel,</div><div>beware, there are specialSelectors and inlined selectors too (do: ifTrue: etc...), so it might happen that low level literals enumeration does not fit higher level...<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 24 juin 2019 à 10:48, Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div id="gmail-m_-8297468213761953301gmail-m_8493271781242486928__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">
                                        
                                        
                                            
                                        
                                        
                                        Hi, there.<div><br></div><div>Please find attached a new version of this refactoring.</div><div><br></div><div>I discovered more recent code for scanning literals (that seems to be at the <b>bytecode</b> level, not <b>object</b> level):</div><div><br></div><div>BytecodeEncoder class >> #scanBlockOrNilForLiteral:</div><div><span style="font-size: 13.3333px">EncoderForSistaV1 class >> #scanBlockOrNilForLiteral:</span></div><div><span style="font-size: 13.3333px">EncoderForV3 class >> #scanBlockOrNilForLiteral:</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">However, I could not see a way to <b>enumerate</b> literals this way. Did I miss something? Makes me wonder about the entire use of CompiledCode >> #literalsDo:. We could replace #hasLiteral: with an implementation similar to Behavior >> #whichSelectorsreferTo:thorough: using #scanBlockOrNilForLiteral:.</span></div><div><br></div><div><img width="auto"></img></div><div><br></div><div><span style="font-size: 13.3333px;line-height: 20px">Thoughts? Eliot? :-) How is the conceptional relationship between "has literal" and "literals do"?</span></div><div><span style="font-size: 13.3333px;line-height: 20px"><br></span></div><div><span style="font-size: 13.3333px;line-height: 20px">Best,</span></div><div><span style="font-size: 13.3333px;line-height: 20px">Marcel</span></div><div class="gmail-m_-8297468213761953301gmail-m_8493271781242486928mb_sig"></div>
                                        
                                        <blockquote class="gmail-m_-8297468213761953301gmail-m_8493271781242486928history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 28.05.2019 14:49:59 schrieb Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif"><div id="gmail-m_-8297468213761953301gmail-m_8493271781242486928__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">Hi, there.<div class="gmail-m_-8297468213761953301gmail-m_8493271781242486928mb_sig"></div><div><br></div><div>Please find attached a change set that (tries to) clean up everything related to enumerating or testing literals in CompiledCode, CompiledMethod, and CompiledBlock.</div><div><br></div><div>I have three important questions:</div><div><br></div><div>- The purpose of #hasLiteralThorough is not needed anymore because we enumerate and test always in a "thorough" way?</div><div><span style="font-size: 10pt;line-height: 1.5">- Are the enumeration boundaries in CompiledCode, CompiledMethod, CompiledBlock in #literalsDo: correct?</span></div><div><span style="font-size: 10pt;line-height: 1.5">- What is a literal as expected in #hasLiteral: etc. to answer true? Just symbols or also bindings (symbol-to-class) and classes themselves?</span></div><div><span style="font-size: 10pt;line-height: 1.5"><br></span></div><div><span style="font-size: 10pt;line-height: 1.5">Try exploring this result: "(Morph >> #fullDrawOn:) literals" or similar.</span></div><div><br></div><div><img width="auto"></img></div><div><br></div><div>Best,</div><div>Marcel</div></div></div></blockquote></div><br>
</blockquote></div>
</div></blockquote>
                                        </div></div></blockquote></div><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size: 10pt;border-collapse: separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div>
</div></blockquote></div></div></blockquote></div>