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 fable, which is naturally and truly composed, so as to satisfy the imagination, ere it addresses the understanding, beautiful though strange as a wild-flower, is to the wise man an apothegm, and admits of his most generous interpretation.”
—Henry David Thoreau (18171862)