[m-dev.] for review: switches via binary search
Fergus Henderson
fjh at cs.mu.oz.au
Wed Dec 31 03:38:00 AEDT 1997
On 30-Dec-1997, Zoltan Somogyi <zs at cs.mu.oz.au> wrote:
>
> Fergus, can you please review this? I'd ask Tom, but he won't be around
> for a while.
>
> compiler/tag_switch.m:
> Add a new way of generating code for switches, binary search chains.
I don't think "chain" is the right term to use to describe it.
How about
Add a new way of generating code for switches, using binary search.
options.m:
> + io__write_string("\t--binary-switch-size <n>\n"),
> + io__write_string("\t\tThe number of alternatives in a binary search chain switch\n"),
> + io__write_string("\t\tmust be at least this number (default: 4).\n"),
I suggest deleting the word "chain" here.
(Ditto for doc/user_guide.texi.)
tag_switch.m:
> + % 4. binary search chains have the form
How about
% 4. binary searches have the form
> + % For binary search chains, we want the case of the most frequently
Ditto.
> +:- type switch_method ---> try_me_else_chain
> + ; try_chain
> + ; jump_table
> + ; binary_chain.
I suggest s/binary_chain/binary_search/g
> tag_switch__generate(Cases, Var, CodeModel, CanFail, StoreMap, EndLabel, Code)
...
> - ( { PtagsUsed > DenseSwitchSize } ->
> + ( { PtagsUsed >= DenseSwitchSize } ->
...
> - ; { PtagsUsed > TrySwitchSize } ->
> + ; { PtagsUsed >= TrySwitchSize } ->
I think those changes weren't mentioned in the log message.
I haven't really looked in any detail at the new slabs of code,
but if it works, then apart from the things mentioned above I'm
happy with it.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list