HEADS UP: Forth Optimizations

Devin Teske devin.teske at fisglobal.com
Sun Nov 11 00:53:15 UTC 2012

Hi Everybody,

Adrian (my co-mentor) wanted some additional eyes/names for review on a patch I'm making to sys/boot/forth (patch attached as patch.txt).

The patch makes no changes to user experience or functionality (but _does_ fix one incident of stack leakage -- among other things).

I wrote/tested this over a 2-day period using (as usual) VMware. I booted up several times (10+) and fiddled with many things (twiddled every knob, dropped to the loader prompt and went back to the menu several times, tried throwing various options like boot_single="YES" and boot_verbose="YES" into loader.conf(5) to make sure dynamic initialization is still working etc.).

The only thing I noticed after applying the patch was a drop in heap usage (one of the goals of the patch), showing that the optimizations did their job to make a leaner running menu. Also, the code is a lot more readable and got slightly reduced in size during the process.

Can someone help review this for the commit log?


+ This patch does not change user experience or functionality
+ Cleanup syntax, slim-down code, and make things more readable
+ Introduce new +c! operator and ilk to reduce heap usage/allocations
+ Fix a stack leak in [unused] cycle_menuitem function while we're here
 (required misconfiguration and/or missing environment vars to occur)
+ Add safemode_enabled? safemode_enable and safemode_disable functions
+ Add singleuser_enabled? singleuser_enable singleuser_disable functions
+ Add verbose_enabled? verbose_enable and verbose_disable functions
+ Centralize strings (also to reduce heap usage)

Submitted by:
Reviewed by:    Your_Name_Here, adrian (co-mentor) [pending his/your review]
Approved by:    adrian (co-mentor) [pending his approval]
Obtained from:
MFC after:
--This line, and those below, will be ignored--
> Description of fields to fill in above:                     76 columns --|
> PR:            If a GNATS PR is affected by the change.
> Submitted by:  If someone else sent in the change.
> Reviewed by:   If someone else reviewed your modification.
> Approved by:   If you needed approval for this commit.
> Obtained from: If the change is from a third party.
> MFC after:     N [day[s]|week[s]|month[s]].  Request a reminder email.
> Security:      Vulnerability reference (one per line) or description.
> Empty fields above will be automatically removed.

M    forth/menu-commands.4th
M    forth/menu.4th

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20121110/38210187/attachment.txt>

More information about the freebsd-current mailing list