Re: [Pharo-project] #getSource is broken for temp names
On May 4, 2012, at 11:03 AM, Mariano Martinez Peck wrote:
| trailer materializedCompiledMethod method |
trailer := CompiledMethodTrailer new tempNames: 'param1 param2 temp1 temp2'. self assert: trailer kind = #TempsNamesQCompress. self assert: trailer kindAsByte = 8. method := (self class >> #fooWith:and:) copyWithTrailerBytes: trailer. self assert: (method getSource includesSubString: 'param1').
this last assert fails.
Problem is that #getSource is broken and somehow it looks like if the part of tempNames was removed. I propose to put back its original verison or just add at the beginning:
trailer tempNames ifNotNil: [:namesString | "Magic sources -- decompile with temp names" ^ ((class decompilerClass new withTempNames: namesString) decompile: selector in: class method: self) decompileString].
agree? if true I open an issue.
No, the idea was to remove temp name embedding because it is not needed. Why do you need it? Marcus -- Marcus Denker -- http://marcusdenker.de
On Fri, May 4, 2012 at 11:09 AM, Marcus Denker <marcus.denker@inria.fr>wrote:
On May 4, 2012, at 11:03 AM, Mariano Martinez Peck wrote:
| trailer materializedCompiledMethod method |
trailer := CompiledMethodTrailer new tempNames: 'param1 param2 temp1 temp2'. self assert: trailer kind = #TempsNamesQCompress. self assert: trailer kindAsByte = 8. method := (self class >> #fooWith:and:) copyWithTrailerBytes: trailer. self assert: (method getSource includesSubString: 'param1').
this last assert fails.
Problem is that #getSource is broken and somehow it looks like if the part of tempNames was removed. I propose to put back its original verison or just add at the beginning:
trailer tempNames ifNotNil: [:namesString | "Magic sources -- decompile with temp names" ^ ((class decompilerClass new withTempNames: namesString) decompile: selector in: class method: self) decompileString].
agree? if true I open an issue.
No, the idea was to remove temp name embedding because it is not needed.
Why do you need it?
I don't know. In Fuel we have tests for each kind of trailer, included those which store temp names. If this kind of trailer is not supported any more, I can remove the tests. If you want to remove temp names, then I think we still need to remove: #hasTempNames #encodeTempsNamesQCompress #encodeTempsNamesZip #encodeUsingQCompress #encodeUsingZip #tempNames #tempNames: #decodeTempsNamesQCompress #decodeTempsNamesZip remove the trailer type from #trailerKinds and maybe more stuff. We should analyze this with care. Cheers
Marcus
-- Marcus Denker -- http://marcusdenker.de
-- Mariano http://marianopeck.wordpress.com
participants (2)
-
Marcus Denker -
Mariano Martinez Peck