I'm trying to learn how to get temp names from a BlockClosure. Well, I try to be able to treat BlockClosures the same way than CompileMethod when it comes to arguments. I can do
[:a :b :c| ] asContext tempNames #('a' 'b' 'c') but I'm not sure if this is the best to go. While looking I found [:a :b :c| ] method tempNames #('[a' 'b' 'c]') For me there are two errors. The obvious one is that the first element is [a instead of a (it splits the string "[a b c]" by spaces). The second point is that "method" is defined as "outerContext method" and I don't understand why it is visible as temps there. It gets the information from the method trailer. Is this a reminiscent from the pre-closure times? thanks, Norbert
|
On Oct 17, 2011, at 4:57 PM, Norbert Hartl wrote: > I'm trying to learn how to get temp names from a BlockClosure. Well, I try to be able to treat BlockClosures the same way than CompileMethod when it comes to arguments. I can do > > [:a :b :c| ] asContext tempNames #('a' 'b' 'c') > > but I'm not sure if this is the best to go. Yes, this uses the DebuggerMethodMap and thus should hide the temps that are there just to store the tempVecor. (with the closure design, there are temps that are just implementation artefacts, not temps that where defined). > While looking I found > > [:a :b :c| ] method tempNames #('[a' 'b' 'c]') > > For me there are two errors. yes, this is wrong. The real problem is that the CompiledMethod does not store any info about temp names, so you need to either go to the source text or (better) AST... and than there is Dan's clever hack that can save temp names in the method trailer to allow decompiling without sources, complicating the logic in addition. I always think that all this is an epic mess... but other people like it. Marcus -- Marcus Denker -- http://marcusdenker.de |
On Oct 24, 2011, at 12:40 PM, Marcus Denker wrote: > >> While looking I found >> >> [:a :b :c| ] method tempNames #('[a' 'b' 'c]') >> >> For me there are two errors. > > yes, this is wrong. > > The real problem is that the CompiledMethod does not store any info about temp names, > so you need to either go to the source text or (better) AST... and than there is Dan's clever hack > that can save temp names in the method trailer to allow decompiling without sources, complicating > the logic in addition. > Ah, and the temp-names embedded in the trailer is used excactly for DoIts... because normally the #tempNames should always return an empty list. It only has meaning when using Dan's embedded temp-names in the trailer hack, which for the whole image nobody ever uses since years. Marcus -- Marcus Denker -- http://marcusdenker.de |
On 24 October 2011 12:44, Marcus Denker <[hidden email]> wrote:
> > On Oct 24, 2011, at 12:40 PM, Marcus Denker wrote: >> >>> While looking I found >>> >>> [:a :b :c| ] method tempNames #('[a' 'b' 'c]') >>> >>> For me there are two errors. >> >> yes, this is wrong. >> >> The real problem is that the CompiledMethod does not store any info about temp names, >> so you need to either go to the source text or (better) AST... and than there is Dan's clever hack >> that can save temp names in the method trailer to allow decompiling without sources, complicating >> the logic in addition. >> > > Ah, and the temp-names embedded in the trailer is used excactly for DoIts... because normally the > #tempNames should always return an empty list. > > It only has meaning when using Dan's embedded temp-names in the trailer hack, which for the whole > image nobody ever uses since years. > yes, i think this is too much effort(s) for displaying a do-it temp names in debugger. As you said, it is possible to embed temps into compiled method, but it is largely unused in system, and used only for doits. Definitely, the way how (often) we using it in our system(s) was not worth spending manhours implementing it. > Marcus > > > -- > Marcus Denker -- http://marcusdenker.de > > > -- Best regards, Igor Stasenko. |
Free forum by Nabble | Edit this page |