[gPXE-devel] (no subject)
Stefan Hajnoczi
stefanha at gmail.com
Sun Mar 14 05:58:23 EDT 2010
The 'loopif' command does two things: a conditional and a loop. I wanted to
see how expensive a general form of control flow would be with if/goto.
Expressing 'loopif' using if/goto looks like this:
#!gpxe
: start
[...]
if ${condition} goto start
The 'if' command can be used to predicate any command, not just a 'goto':
if ${initrd} initrd ${initrd}
Similarly, 'goto' is its own command and can be used independent of 'if':
: loop
[...]
goto loop
The uncompressed code size of my 'ifgoto' branch is +541 bytes:
http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=shortlog;h=refs/heads/ifgoto
(Note that we don't have expression evaluation in mainline gPXE, so the 'if' command is not very useful yet.)
The if/goto approach is not as nice as the control flow (if, while, for, and try) that Lynus Vaz developed for his Summer of Code project, but I am going to compare code size to see what the difference is.
Thoughts?
Stefan
More information about the gPXE-devel
mailing list