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:

    They all came, some wore sentiments
    Emblazoned on T-shirts, proclaiming the lateness
    Of the hour, and indeed the sun slanted its rays
    Through branches of Norfolk Island pine as though
    Politely clearing its throat....
    John Ashbery (b. 1927)

    I know of no pursuit in which more real and important services can be rendered to any country than by improving its agriculture, its breed of useful animals, and other branches of a husbandman’s cares.
    George Washington (1732–1799)

    It is comforting when one has a sorrow to lie in the warmth of one’s bed and there, abandoning all effort and all resistance, to bury even one’s head under the cover, giving one’s self up to it completely, moaning like branches in the autumn wind. But there is still a better bed, full of divine odors. It is our sweet, our profound, our impenetrable friendship.
    Marcel Proust (1871–1922)