Trampoline (computing)
In computer programming, the word trampoline has a number of meanings, and is generally associated with jump instructions (i.e. moving to different code paths).
In computer programming, the word trampoline has a number of meanings, and is generally associated with jump instructions (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: Trampoline can be used to overcome the limitations imposed by a central processing unit (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 bootstrap 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. 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. In Mono Runtime, trampolines are small, hand-written pieces of assembly code used to perform various tasks. When interfacing pieces of code with incompatible calling conventions, a trampoline is used to convert the caller's convention into the callee's convention. In embedded systems, trampolines are short snippets of code that start up other snippets of code. For example, rather than write interrupt handlers entirely in assembly language, another option is to write interrupt handlers mostly in C, and use a short trampoline to convert the assembly-language interrupt calling convention into the C calling convention. When passing a callback to a system that expects to call a C function, but one wants it to execute the method of a particular instance of a class written in C++, one uses a short trampoline to convert the C function-calling convention to the C++ method-calling convention. One way of writing such a trampoline is to use a thunk. Another method is to use a generic listener. In Objective-C, a trampoline is an object returned by a method that captures and reifies all messages sent to it and then "bounces" those messages on to another object, for example in higher order messaging. In the GCC compiler, trampoline refers to a technique for implementing pointers to nested functions when -ftrampolines option is enabled. The trampoline is a small piece of code which is constructed on the fly on the stack when the address of a nested function is taken. The trampoline sets up the static link pointer, which allows the nested function to access local variables of the enclosing function. The function pointer is then simply the address of the trampoline. This avoids having to use "fat" function pointers for nested functions which carry both the code address and the static link. This, however, conflicts with the desire to make the stack non-executable for security reasons. In the esoteric programming language Befunge, a trampoline is an instruction to skip the next cell in the control flow. ==No-execute stacks== Some implementations of trampolines cause a loss of no-execute stacks (NX stack). In the GNU Compiler Collection (GCC) in particular, a nested function builds a trampoline on the stack at runtime, and then calls the nested function through the data on stack. The trampoline requires the stack to be executable. No-execute stacks and nested functions are mutually exclusive under GCC. If a nested function is used in the development of a program, then the NX stack is silently lost. GCC offers the -Wtrampolines warning to alert of the condition. Software engineered using secure development lifecycle often do not allow the use of nested functions due to the loss of NX stacks. ==See also== DLL trampolining Retpoline ==References==
References
- Trampolines · retrieved 2026-11-17 · rev 1350986590
Cite this reference
MLA "Trampolines." 2026-11-17. https://github.com/mono/website/blob/b4f3b7ad0413743e35e9cfe009302e57c1cd0c61/docs/advanced/runtime/docs/trampolines.md. Accessed 24 November 2026.
Chicago "Trampolines." 2026-11-17. https://github.com/mono/website/blob/b4f3b7ad0413743e35e9cfe009302e57c1cd0c61/docs/advanced/runtime/docs/trampolines.md.
APA encyclopegia.org. (2026). Trampolines. Retrieved November 24, 2026, from https://github.com/mono/website/blob/b4f3b7ad0413743e35e9cfe009302e57c1cd0c61/docs/advanced/runtime/docs/trampolines.md
- CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A. · retrieved 2026-11-17 · rev 1350986590
Cite this reference
MLA "CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A." Baker, Henry G. 2026-11-17. https://en.wikipedia.org/wiki/Henry_Baker_(computer_scientist). Accessed 24 November 2026.
Chicago "CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A." Baker, Henry G. 2026-11-17. https://en.wikipedia.org/wiki/Henry_Baker_(computer_scientist).
APA Baker, Henry G. (2026). CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Henry_Baker_(computer_scientist)
- Lexical Closures for C++ · retrieved 2018-05-25 · rev 1350986590
Cite this reference
MLA "Lexical Closures for C++." Breuel, Thomas M. 2018-05-25. http://www-cs-students.stanford.edu/~blynn/files/lexic.pdf. Accessed 24 November 2026.
Chicago "Lexical Closures for C++." Breuel, Thomas M. 2018-05-25. http://www-cs-students.stanford.edu/~blynn/files/lexic.pdf.
APA Breuel, Thomas M. (2018). Lexical Closures for C++. Retrieved November 24, 2026, from http://www-cs-students.stanford.edu/~blynn/files/lexic.pdf
- Nested functions · retrieved 2018-05-25 · rev 1350986590
Cite this reference
MLA "Nested functions." 2018-05-25. http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html. Accessed 24 November 2026.
Chicago "Nested functions." 2018-05-25. http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html.
APA encyclopegia.org. (2018). Nested functions. Retrieved November 24, 2026, from http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html
- Trampolines for Nested Functions · retrieved 2018-05-25 · rev 1350986590
Cite this reference
MLA "Trampolines for Nested Functions." 2018-05-25. http://gcc.gnu.org/onlinedocs/gccint/Trampolines.html. Accessed 24 November 2026.
Chicago "Trampolines for Nested Functions." 2018-05-25. http://gcc.gnu.org/onlinedocs/gccint/Trampolines.html.
APA encyclopegia.org. (2018). Trampolines for Nested Functions. Retrieved November 24, 2026, from http://gcc.gnu.org/onlinedocs/gccint/Trampolines.html
- Trampolines for Embedded Systems: Minimizing interrupt handlers latency · retrieved 2018-05-25 · rev 1350986590
Cite this reference
MLA "Trampolines for Embedded Systems: Minimizing interrupt handlers latency." Link, Joseph M. 2018-05-25. http://www.drdobbs.com/184404772. Accessed 24 November 2026.
Chicago "Trampolines for Embedded Systems: Minimizing interrupt handlers latency." Link, Joseph M. 2018-05-25. http://www.drdobbs.com/184404772.
APA Link, Joseph M. (2018). Trampolines for Embedded Systems: Minimizing interrupt handlers latency. Retrieved November 24, 2026, from http://www.drdobbs.com/184404772
- Implementation of nested functions · retrieved 2018-05-25 · rev 1350986590
Cite this reference
MLA "Implementation of nested functions." fuz (2011-11-18). 2018-05-25. https://stackoverflow.com/questions/8179521/implementation-of-nested-functions. Accessed 24 November 2026.
Chicago "Implementation of nested functions." fuz (2011-11-18). 2018-05-25. https://stackoverflow.com/questions/8179521/implementation-of-nested-functions.
APA fuz (2011-11-18). (2018). Implementation of nested functions. Retrieved November 24, 2026, from https://stackoverflow.com/questions/8179521/implementation-of-nested-functions
- Thunking in Win32 with C++ · retrieved 2026-11-17 · rev 1350986590
Cite this reference
MLA "Thunking in Win32 with C++." Stangvik, Einar Otto (2006-08-16). 2026-11-17. https://web.archive.org/web/20121015180318/http://www.codeproject.com/Articles/16785/Thunking-in-Win32-Simplifying-Callbacks-to-Non-sta. Accessed 24 November 2026.
Chicago "Thunking in Win32 with C++." Stangvik, Einar Otto (2006-08-16). 2026-11-17. https://web.archive.org/web/20121015180318/http://www.codeproject.com/Articles/16785/Thunking-in-Win32-Simplifying-Callbacks-to-Non-sta.
APA Stangvik, Einar Otto (2006-08-16). (2026). Thunking in Win32 with C++. Retrieved November 24, 2026, from https://web.archive.org/web/20121015180318/http://www.codeproject.com/Articles/16785/Thunking-in-Win32-Simplifying-Callbacks-to-Non-sta
- C-Based Toolchain Hardening · retrieved 2018-03-01 · rev 1350986590
Cite this reference
MLA "C-Based Toolchain Hardening." Walton, Jeffrey; Manico, Jim; Wall, Kevin (2018-03-02) [2013]. 2018-03-01. http://www.owasp.org/index.php/C-Based_Toolchain_Hardening#GCC.2FBinutils. Accessed 24 November 2026.
Chicago "C-Based Toolchain Hardening." Walton, Jeffrey; Manico, Jim; Wall, Kevin (2018-03-02) [2013]. 2018-03-01. http://www.owasp.org/index.php/C-Based_Toolchain_Hardening#GCC.2FBinutils.
APA Walton, Jeffrey; Manico, Jim; Wall, Kevin (2018-03-02) [2013]. (2018). C-Based Toolchain Hardening. Retrieved November 24, 2026, from http://www.owasp.org/index.php/C-Based_Toolchain_Hardening#GCC.2FBinutils
- Higher Order Messaging (HOM) · retrieved 2018-05-25 · rev 1350986590
Cite this reference
MLA "Higher Order Messaging (HOM)." Weiher, Marcel (2004). 2018-05-25. http://www.metaobject.com/papers/HOM-Presentation.pdf. Accessed 24 November 2026.
Chicago "Higher Order Messaging (HOM)." Weiher, Marcel (2004). 2018-05-25. http://www.metaobject.com/papers/HOM-Presentation.pdf.
APA Weiher, Marcel (2004). (2018). Higher Order Messaging (HOM). Retrieved November 24, 2026, from http://www.metaobject.com/papers/HOM-Presentation.pdf
- Asserting Control Over the GUI: Commands, Defaults, and Resource Bundles · retrieved 2015-11-05 · rev 1350986590
Cite this reference
MLA "Asserting Control Over the GUI: Commands, Defaults, and Resource Bundles." a b Muller, Hans (2005-01-31). 2015-11-05. http://today.java.net/pub/a/today/2005/01/31/controlGUI.html#trampolines. Accessed 24 November 2026.
Chicago "Asserting Control Over the GUI: Commands, Defaults, and Resource Bundles." a b Muller, Hans (2005-01-31). 2015-11-05. http://today.java.net/pub/a/today/2005/01/31/controlGUI.html#trampolines.
APA a b Muller, Hans (2005-01-31). (2015). Asserting Control Over the GUI: Commands, Defaults, and Resource Bundles. Retrieved November 24, 2026, from http://today.java.net/pub/a/today/2005/01/31/controlGUI.html#trampolines
Cite this article
MLA
"Trampoline (computing)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/trampoline-computing. Accessed 24 November 2026.
Chicago
"Trampoline (computing)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/trampoline-computing.
APA
encyclopegia.org. (2026). Trampoline (computing). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/trampoline-computing
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON