Related articles |
---|
[15 earlier articles] |
Re: Using C as a back end kst@cts.com (Keith Thompson) (2000-10-26) |
Re: Using C as a back end jacob@jacob.remcomp.fr (jacob navia) (2000-10-26) |
Re: Using C as a back end nr@labrador.eecs.harvard.edu (2000-10-31) |
Re: Using C as a back end sweeks@my-deja.com (Stephen T. Weeks) (2000-10-31) |
Re: Using C as a back end zs@ender.cs.mu.oz.au (2000-10-31) |
Re: Using C as a back end thp@cs.ucr.edu (Tom Payne) (2000-10-31) |
Re: Using C as a back end engler@Stanford.EDU (2000-10-31) |
Re: Using C as a back end anton@mips.complang.tuwien.ac.at (2000-10-31) |
Re: Using C as a back end joachim_d@gmx.de (Joachim Durchholz) (2000-10-31) |
Re: Using C as a back end conway@ender.cs.mu.oz.au (2000-11-01) |
Re: Using C as a back end kst@cts.com (Keith Thompson) (2000-11-01) |
Re: Using C as a back end rhyde@cs.ucr.edu (Randall Hyde) (2000-11-01) |
Re: Using C as a back end rhyde@cs.ucr.edu (Randall Hyde) (2000-11-01) |
[7 later articles] |
From: | engler@Stanford.EDU (Dawson R Engler) |
Newsgroups: | comp.compilers |
Date: | 31 Oct 2000 14:40:40 -0500 |
Organization: | Stanford University, CA 94305, USA |
References: | 00-10-148 00-10-154 00-10-212 |
Keywords: | C |
Posted-Date: | 31 Oct 2000 14:40:40 EST |
>[You can get the effect of a computed goto in standard C using a
>switch full of goto's, and any decent compiler should generate about
>the same code as for an explicit computed goto, so I don't see that
>particular wart as a major one. -John]
Last time I checked the difference was about 2x (admittedly this
was about four years ago). Two reasons for the overhead:
1. switch does a bounds check.
2. case arm ``breaks'' will jump back to the top of the
switch, rather than cutting through to exactly where you want
to go.
For writing fast threaded interpreters, computed goto is a good thing.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.