|Jump tables and OOP in Oberon email@example.com (1996-07-13)|
|Re: Jump tables and OOP in Oberon firstname.lastname@example.org (Tim Dwyer) (1996-07-18)|
|Re: Jump tables and OOP in Oberon email@example.com (1996-07-22)|
|Re: Jump tables and OOP in Oberon firstname.lastname@example.org (1996-07-23)|
|Re: Jump tables and OOP in Oberon email@example.com (Darius Blasband) (1996-07-23)|
|From:||firstname.lastname@example.org (Paul Hudson)|
|Date:||23 Jul 1996 23:28:22 -0400|
|Organization:||The Harlequin Group.|
Robert A Duff <email@example.com> wrote:
>... Can someone clearly define how jump tables are used in
>pascal-type CASE statements?
>Ram Meenakshisundaram <firstname.lastname@example.org> wrote:
>The compiler first checks that the case labels are "reasonably" close
>together. If so, generate an array, indexed by the case expression, of
>code addresses to jump to.
>If the case labels are not reasonably close together, it's better to
>generate a table of code addresses that can be binary-searched.
>And if there are just a couple of case labels, treating it like a series
>of if-then-else's makes sense.
You can develop this idea a bit. In a C compiler I wrote for the Acorn
ARM, I used to scan the labels looking for areas of reasonably-close
labels and implement a jump table for that bit, test-and-jump for a
few isolated cases, and binary switch on the rest (the test-and-jump
and tables get treated as one case when considering the binary
This works rather well given that case values are often runs of adjacent
values + a small number of 'exceptional' or error cases.
Paul Hudson, Chief Designer, Information Systems, Harlequin Ltd, Longstanton
House. Longstanton, Cambs. CB4 5BU, England +44 1954 785473 (fax 785444)
Personal: email@example.com Learning: firstname.lastname@example.org
Work: email@example.com http://www.harlequin.com
Return to the
Search the comp.compilers archives again.