Re: Pike object assembler code

Henrik Grubbström <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Organization Roxen Internet Software AB
Message-ID <[email protected]>
On Tue, 14 Oct 2014, Stephen R. van den Berg wrote:

> Say I want to see what byte code a certain piece of Pike code compiles
> into.  What would be the best way to obtain a readable output?

Getting debug output including byte code mnemonics from the 
assembler/peep-hole optimizer is done by raising the assembler 
debug level to 2 or higher (done by calling Debug.assembler_debug() 
in a pike compiled with rtl-debug). Note that at level 3 you also get 
to see the parse tree, the result of the peep-hole pass, code compiled 
to evaluate constant expressions and the resulting symbol table.

> Ideally, there would be some symbolic output which resembles
> "Pike-assembler-code" intermingled with the Pike source code it
> came frome.

Each line of debug output is prefixed with the linenumber (but not the 
file name) in the corresponding source file.

> The reason I ask is mostly educational.  I'd like to roughly understand
> what code results in what low-level construct, so that I don't have
> to run a benchmark everytime to decide between construct a or b
> (deciding on saving space or time or both).

Enabling the assembler debug and/or the optimizer debug is a good way to 
get an understanding of how the Pike compiler works.

-- 
Henrik Grubbström					[email protected]
Roxen Internet Software AB
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.