Re: Control Flow Stack deficiencies
- From: Andrew Haley <andrew29@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 24 Jun 2008 05:24:08 -0500
John Passaniti <nntp@xxxxxxxxxxxxxxxxx> wrote:
Andrew Haley wrote:
Not in Borland Pascal compilers (which compiled straight to native
code).
How bizarre. There is little excuse for that, given the ubiquity
of the P-code compilers and the way that Wirth implies the use of
a jump table with "although the efficiency of the case statement
depends on its implementation, the general rule is to use it when
one has several mutually exclusive statements with a similar
probability of selection."
It's bizarre that the authors of a Pascal compiler that generated
native code (not p-code) would consider the use of code generation
and optimization strategies specific to native code?
I did not say that it's bizarre that the authors of a Pascal compiler
that generated native code (not p-code) would consider the use of code
generation and optimization strategies specific to native code, and
neither did I say anything that might have implied it.
There's nothing about failing *ever* to use a jump table that's
specific to the generation of native code.
My memory of Apple Pascal (which was based on the UCSD p-System) was
that it did indeed have an opcode (XJP, if I remember correctly)
that was used with case statements-- but not exclusively. The
opcode required four arguments (minimum index, maximum index, a jump
past the end of the table (when the index wasn't in range), and the
table itself. If the compiler found that it was more efficient to
use another structure, it did.
Jump tables didn't make sense when the case selectors were sparse:
var i: integer;
case i of
1: something;
2147483647: another_thing;
end
And they didn't make sense when there were large ranges:
case i of
1..1000000: something;
end
Sure, we both know that. I made precisely such a point in
<2bWdnd4tWJk2VbDVnZ2dnUVZ8szinZ2d@xxxxxxxxxxxxx> a few weeks ago.
What exactly is your point? I was saying that there is little excuse
for failing ever to use an indexed jump when generating a code for a
switch.
Andrew.
.
- Follow-Ups:
- Re: Control Flow Stack deficiencies
- From: John Passaniti
- Re: Control Flow Stack deficiencies
- References:
- More fun with Miser's CASE
- From: Ed
- Re: More fun with Miser's CASE
- From: m_l_g3
- Re: More fun with Miser's CASE
- From: Ed
- Control Flow Stack deficiencies
- From: Ed
- Re: Control Flow Stack deficiencies
- From: David N. Williams
- Re: Control Flow Stack deficiencies
- From: Ed
- Re: Control Flow Stack deficiencies
- From: David N. Williams
- Re: Control Flow Stack deficiencies
- From: Coos Haak
- Re: Control Flow Stack deficiencies
- From: David N. Williams
- Re: Control Flow Stack deficiencies
- From: Elizabeth D Rather
- Re: Control Flow Stack deficiencies
- From: David N. Williams
- Re: Control Flow Stack deficiencies
- From: Andrew Haley
- Re: Control Flow Stack deficiencies
- From: Rod Pemberton
- Re: Control Flow Stack deficiencies
- From: Ed
- Re: Control Flow Stack deficiencies
- From: Andrew Haley
- Re: Control Flow Stack deficiencies
- From: Ed
- Re: Control Flow Stack deficiencies
- From: Andrew Haley
- Re: Control Flow Stack deficiencies
- From: John Passaniti
- More fun with Miser's CASE
- Prev by Date: Re: Need help getting started
- Next by Date: Re: Control Flow Stack deficiencies
- Previous by thread: Re: Control Flow Stack deficiencies
- Next by thread: Re: Control Flow Stack deficiencies
- Index(es):
Relevant Pages
|
Loading