Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Jump threading
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Examples== The following [[pseudocode]] demonstrates when a jump may be threaded. 10. a = SomeNumber(); 20. IF a > 10 GOTO 50 ... 50. IF a > 0 GOTO 100 ... The jump on line 50 will always be taken if the jump on line 20 is taken. Therefore, for as long as line 100 is within the reachable range of the jump (or the size of the jump doesn't matter), the jump on line 20 may safely be modified to jump directly to line 100. Another example shows jump threading of 2 partial overlap conditions: <syntaxhighlight lang="cpp" line="1"> void baz(bool x, bool y, bool z) { if (x && y) bar(); if (y || z) foo(); } </syntaxhighlight> The above can be transformed into: <syntaxhighlight lang="cpp" line="1"> void baz(bool x, bool y, bool z) { if (x && y) { bar(); goto jmp; } if (y || z) { jmp: foo(); } } </syntaxhighlight> If the first branch is taken, <code>x</code> and <code>y</code> are both [[Truth value|true]] ([[logical conjunction]]), hence evaluation of [[Expression (computer science)|expression]] <code>y || z</code> is not needed ([[logical disjunction]]). Therefore, a jump to [[Label (computer science)|label]] <code>jmp</code> is performed.<ref name="redhat"/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)