Threaded Code - Branches

Branches

Examples above show no branches. For all interpreters, a branch changes the thread pointer (ip above). As example, a conditional branch when the top-of-stack value is zero might be encoded as follows. Note that &thread is the location to jump to, not the address of a handler, and so must be skipped (ip++) whether or not the branch is taken.

thread: brz: ... tmp = *ip++ &brz if (*sp++ == 0) &thread ip = tmp ... jump *ip++

Read more about this topic:  Threaded Code

Famous quotes containing the word branches:

    Different persons growing up in the same language are like different bushes trimmed and trained to take the shape of identical elephants. The anatomical details of twigs and branches will fulfill the elephantine form differently from bush to bush, but the overall outward results are alike.
    Willard Van Orman Quine (b. 1908)

    Go to the adolescent who are smothered in family—
    Oh how hideous it is
    To see three generations of one house gathered together!
    It is like an old tree with shoots,
    And with some branches rotted and falling.
    Ezra Pound (1885–1972)

    Certain branches cut
    certain leaves fallen
    the grapes
    cooked and put up
    for winter
    Denise Levertov (b. 1923)