Re: [Sablevm-user] SableVM question
Brought to you by:
egagnon
From: Etienne M. G. <eg...@j-...> - 2000-08-29 00:35:54
|
Hi Marcel. I'm sorry for the delay; I had a pretty hectic day. Marcel Ammerlaan wrote: > My question is: why use goto instead of switch()? The concept of using goto's in the interpreter loop is usually referred to as "threaded" interpretation. This name originates, if I am right, from implementations of the FORTH language. The short answer to your question is: because it's (usually) much faster. But, your experiment suggests that this is not the case... I would be very interested in looking at your small benchmark program, to see if there's something wrong with it. Would it be possible to send a copy of it on the list? (This shouldn't be a long program, I guess). The reason "labels as values" were added in gcc was explicitly for cases like interpreter loops. Here's some excerpt from gcc's documentation: "Another use of label values is in an interpreter for threaded code. The labels within the interpreter function can be stored in the threaded code for super-fast dispatching." Cheers, Etienne -- ---------------------------------------------------------------------- Etienne M. Gagnon, M.Sc. e-mail: eg...@j-... Author of SableVM: http://www.sablevm.org/ ---------------------------------------------------------------------- |