Trampoline (computing)
In computer programming, the word trampoline has a number of meanings, and is generally associated with jumps (i.e., moving to different code paths).
Low-level programming
Trampolines (sometimes referred to as indirect jump vectors) are memory locations holding addresses pointing to interrupt service routines, I/O routines, etc. Execution jumps into the trampoline and then immediately jumps out, or bounces, hence the term trampoline. They have many uses:
CPUs
- Trampoline can be used to overcome the limitations imposed by a CPU architecture that expects to always find vectors in fixed locations.
- When an operating system is booted on a symmetric multiprocessing (SMP) machine, only one processor, the boot-strap processor, will be active. After the operating system has configured itself, it will instruct the other processors to jump to a piece of trampoline code that will initialize the processors and wait for the operating system to start scheduling threads on them.
High-level programming
- As used in some Lisp implementations, a trampoline is a loop that iteratively invokes thunk-returning functions (continuation-passing style). A single trampoline suffices to express all control transfers of a program; a program so expressed is trampolined, or in trampolined style; converting a program to trampolined style is trampolining. Programmers can use trampolined functions to implement tail-recursive function calls in stack-oriented programming languages.[1]
- In Java, trampoline refers to using reflection to avoid using inner classes, for example in event listeners. The time overhead of a reflection call is traded for the space overhead of an inner class. Trampolines in Java usually involve the creation of a GenericListener to pass events to an outer class.[2]
References
- ↑ Baker, Henry G. (September 1995). "CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A.". ACM SIGPLAN Notices. 30 (9): 17–20. doi:10.1145/214448.214454.
- ↑ Muller, Hans (31 January 2005). "Asserting Control Over the GUI: Commands, Defaults, and Resource Bundles". today.java.net. Retrieved 6 November 2015.
|section=
ignored (help)
This article is issued from Wikipedia - version of the 8/4/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.