Alternative Implementation Using Addresses
Another method of implementing a branch table is with an array of pointers from which the required function's address is retrieved. This method is also more recently known under such different names as "dispatch table" or "virtual method table" but essentially performing exactly the same purpose. This pointer function method can result in saving one machine instruction, and avoids the indirect jump (to one of the branch instructions).
The resulting list of pointers to functions is almost identical to direct threaded code, and is conceptually similar to a control table.
The actual method used to implement a branch table is usually based on:
- the architecture of the processor on which the code is to be executed,
- whether it is a compiled or interpreted language and
- whether late binding is involved or not.
Read more about this topic: Branch Table
Famous quotes containing the words alternative and/or addresses:
“No alternative to the
one-man path.”
—Denise Levertov (b. 1923)
“The pleasures and the cares of the luckiest ambition, even of limitless power, are nothing next to the intimate happiness that tenderness and love give. I am man before being a prince, and when I have the good fortune to be in love, my mistress addresses a man and not a prince.”
—Stendhal [Marie Henri Beyle] (17831842)