From z Mon Dec 04 09:09:53 2000
Received: from maguro.epr.com ([198.3.162.27]) by exchange.epr.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21)
	id WNKA3AY3; Mon, 4 Dec 2000 00:06:34 -0800
Received: from magrathea.epr.com (firewall-user@magrathea.epr.com [198.3.160.1])
	by maguro.epr.com (8.9.3/8.9.3) with ESMTP id AAA02490
	for <sweeks@intertrust.com>; Mon, 4 Dec 2000 00:10:28 -0800 (PST)
Received: (from uucp@localhost) by magrathea.epr.com (8.9.3/8.7.3) id AAA23698 for <sweeks@intertrust.com>; Mon, 4 Dec 2000 00:10:28 -0800 (PST)
Received: from nodnsquery(199.222.69.4) by magrathea.epr.com via smap (V5.5)
	id xma023684; Mon, 4 Dec 00 00:10:04 -0800
Received: from clairv.com (IDENT:root@pc246.edi.nunet.net [199.249.165.246])
	by mail.acm.org (8.9.3/8.9.3) with ESMTP id DAA22838
	for <sweeks@acm.org>; Mon, 4 Dec 2000 03:10:03 -0500
Received: from simon.cs.cornell.edu (simon.cs.cornell.edu [128.84.154.10])
	by clairv.com (8.9.3/8.9.3) with ESMTP id CAA28683
	for <MLton@sourcelight.com>; Mon, 4 Dec 2000 02:10:02 -0600
Received: from sundial.cs.cornell.edu (sundial.cs.cornell.edu [128.84.96.115])
	by simon.cs.cornell.edu (8.9.3/8.9.3/R-3.1) with ESMTP id DAA25661
	for <MLton@sourcelight.com>; Mon, 4 Dec 2000 03:09:55 -0500 (EST)
Received: from hoho.cs.cornell.edu (hoho.cs.cornell.edu [128.84.96.89])
	by sundial.cs.cornell.edu (8.9.3/8.9.3/M-3.2) with ESMTP id DAA08945
	for <MLton@sourcelight.com>; Mon, 4 Dec 2000 03:09:55 -0500 (EST)
Received: from localhost (fluet@localhost)
	by hoho.cs.cornell.edu (8.9.3/8.9.3/C-3.0) with SMTP id DAA22834
	for <MLton@sourcelight.com>; Mon, 4 Dec 2000 03:09:54 -0500 (EST)
X-Authentication-Warning: hoho.cs.cornell.edu: fluet owned process doing -bs
Date: Mon, 4 Dec 2000 03:09:53 -0500 (EST)
From: Matthew Fluet <fluet@CS.Cornell.EDU>
Reply-To: Matthew Fluet <fluet@CS.Cornell.EDU>
To: MLton@sourcelight.com
Subject: jump tables and cases
Message-ID: <Pine.SOL.3.95.1001204025104.7494A-100000@hoho.cs.cornell.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on 
	eponym.sweeks.com
X-Spam-Level: 
X-Spam-Status: No, hits=-100.0 required=3.0 tests=AWL,USER_IN_WHITELIST 
	autolearn=no version=2.60


Were the changes to preserve big integer case statements ever added to
MLton?  I went ahead and added support to generate jump tables to the
x86-backend.  That was the last feature I really wanted to get into the
backend, and it should also help with compile times (in particular, the
datatype representing x86 instructions has 50 variants, and I crawl over
this a lot).  I recall that Steve pointed out that mlyacc generated
parsers have big integer case statements, so it might also improve the
parse phase.  

Right now it's just the most straight forward version of jump tables that
I could come up with.   I look at the Switch transfer, determine the min
and max integer cases and the length and produce a jump table if 
(max - min + 1) / length >= 7/8
(i.e., make sure that the jump table will be relatively dense).

I could easily produce a binary search tree as well.



