Re: What is byte-code ?

glen herrmannsfeldt <gah@ugcs.caltech.edu>
13 May 2005 17:56:26 -0400

          From comp.compilers

Related articles
[18 earlier articles]
Re: What is byte-code ? slimick@venango.upb.pitt.edu (John Slimick) (2005-04-11)
Re: What is byte-code ? kers@hpl.hp.com (Chris Dollin) (2005-04-11)
Re: What is byte-code ? anton@mips.complang.tuwien.ac.at (2005-04-11)
Re: What is byte-code ? nathan.moore@cox.net (Nathan Moore) (2005-04-16)
Re: What is byte-code ? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-04-16)
Re: What is byte-code ? ralph@inputplus.co.uk (2005-05-09)
Re: What is byte-code ? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-05-13)
| List of all articles for this month |
From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: 13 May 2005 17:56:26 -0400
Organization: Compilers Central
References: 05-03-015 05-03-026 05-03-053 05-03-088 05-03-125 05-04-005 05-04-037
Keywords: interpreter, performance
Posted-Date: 13 May 2005 17:56:26 EDT

Anton Ertl wrote:


(snip regarding switch statements or statement label arrays)


>>This will save you about 2 jumps per instructoin since the jump tables
>>that are usually spit out by compilers are:


>>jump ip+(constant*case)
>>jump CODE_THAT_ACTUALLY_DOES_CASE_0
>>jump CODE_THAT_ACTUALLY_DOES_CASE_1


> I have never seen that kind of code generated. Which compiler does it
> that way? Big, dense switch statements have been translated into a
> range check, an array access (for the target address), and an indirect
> jump to the target in the code I looked at (usually by gcc).


IBM S/360 (S/370, ESA/390, etc.) compilers generate that for computed
GOTO in Fortran, and switch in languages with that.


S/360 has pretty much only one memory addressing mode with is
12 bit constant plus register plus register.


The exit codes (return codes) of all IBM supplied S/360 programs are
multiples of four, convenient for use in indexed branch instructions.
(Hopefully after bounds testing.)


-- glen


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.