<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2014-05-03 2:46 GMT+02:00 <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Eliot Miranda uploaded a new version of Kernel to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Kernel-eem.847.mcz" target="_blank">http://source.squeak.org/trunk/Kernel-eem.847.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Kernel-eem.847<br>
Author: eem<br>
Time: 2 May 2014, 5:45:56.76 pm<br>
UUID: 61cf122b-e7e3-4c10-9d8b-17df1509d656<br>
Ancestors: Kernel-eem.846<br>
<br>
Fix class reshaping losing the correct methodClassAssociation<br>
in instance side methods.<br>
<br>
=============== Diff against Kernel-eem.846 ===============<br>
<br>
Item was changed:<br>
----- Method: Behavior>>compileAllFrom: (in category 'compiling') -----<br>
compileAllFrom: oldClass<br>
"Compile all the methods in the receiver's method dictionary.<br>
This validates sourceCode and variable references and forces<br>
all methods to use the current bytecode set"<br>
+ | envBinding binding |<br>
- | binding |<br>
"ar 7/10/1999: Use oldClass selectors not self selectors"<br>
oldClass selectorsDo: [:sel | self recompile: sel from: oldClass].<br>
<br>
"Ensure that we share a common binding after recompilation.<br>
+ This is so that ClassBuilder reshapes avoid creating new bindings<br>
+ for every method when recompiling a large class hierarchy.<br>
+ eem 5/2/2014 17:43: Further, if we're not yet in the environment<br>
+ (because we're about to be mutated into oldClass), use oldClass's<br>
+ binding, so as not to end up with the wrong binding post recompile."<br>
- This is so that ClassBuilder reshapes avoid creating new bindings<br>
- for every method when recompiling a large class hierarchy."<br>
binding := self binding.<br>
+ (self name = oldClass name<br>
+ and: [(envBinding := self environment bindingOf: self name) ~= binding<br>
+ and: [envBinding = oldClass binding]]) ifTrue:<br>
+ [binding := envBinding].<br></blockquote><div><br></div><div>Hi Eliot, this is breaking Traits as shown by PureBehaviorTests>>testReshapeClass<br></div><div><br>We must look into ClassBuilder>>newSubclassOf: newSuper type: type instanceVariables: instVars from: oldClass,<br>
After this instruction: [newClass compileAllFrom: oldClass]<br></div><div>newClass methodDictionary has bindings that points to oldClass instead of newClass (the bindings are #C2 -> oldClass)<br></div><div><br></div><div>
Then what happens in newClass setTraitComposition: -> uses: -> installTraitsFrom: -> assembleTraitMethodsFrom: ???<br></div><div>The methods are not recognized as local methods (isLocalMethod:) because the binding points to the oldClass, not the newClass...<br>
</div><div>As a consequence, the local methods #(foo bar) are not re-installed in newClass, but lost.<br></div><div><br></div><div>What do you think?<br></div><div>Should we revert this?<br></div><div>Or hack isLocalMethod: to rely on name rather than identity?<br>
</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
self methodsDo:[:m|<br>
m methodClassAssociation == binding<br>
ifFalse:[m methodClassAssociation: binding]].<br>
!<br>
<br>
<br>
</blockquote></div><br></div></div>