Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!ucsd!ucbvax!agate!shelby!neon!pescadero.Stanford.EDU!philip From: philip@pescadero.Stanford.EDU (Philip Machanick) Newsgroups: comp.arch Subject: Re: It looks like he's at it again! Message-ID: <1990Jul15.013016.16786@Neon.Stanford.EDU> Date: 15 Jul 90 01:30:16 GMT References: <37569@ucbvax.BERKELEY.EDU> <2328@l.cc.purdue.edu> <1990Jul10.072443.4844@cs.UAlberta.CA> <9896@celit.fps.com> <2338@l.cc.purdue.edu> <9911@celit.fps.com> <24358@estelle.udel.EDU> <3060@osc.COM> Sender: news@Neon.Stanford.EDU (USENET News System) Reply-To: philip@pescadero.stanford.edu Organization: Computer Science Department, Stanford University Lines: 21 In article <37569@ucbvax.BERKELEY.EDU>, tve@sprite.berkeley.edu (Thorsten von Eicken) writes: > In article <3060@osc.COM> jgk@osc.COM (Joe Keane) writes: > >One real problem with using C for threaded interpreters is that there is no > >way to make an arbitrary jump instruction. If you could `goto' some address > >expression there would be no problem. > Yep, typically the C program ends up being a hunge switch statement: > loop: switch(next_thread) { > case 0: .... goto loop; > case 1: .... goto loop; > } > and one hopes that a) a jump table is produced (and not a binary search > tree) and b) the compiler doesn't dump core with some silly error when > the number of cases reaches into the thousands... > > Or can anyone suggest a better method? If you can afford the overhead of a function call, you can use an array of function pointers to implement a jump table. Philip Machanick philip@pescadero.stanford.edu