Path: utzoo!news-server.csri.toronto.edu!rutgers!ucsd!dog.ee.lbl.gov!ncis.tis.llnl.gov!lance.tis.llnl.gov!turner From: turner@lance.tis.llnl.gov (Michael Turner) Newsgroups: comp.arch Subject: Re: register save Message-ID: <1353@ncis.tis.llnl.gov> Date: 11 Mar 91 23:21:19 GMT References: <3219@crdos1.crd.ge.COM> <12234@pt.cs.cmu.edu> <7403@mentor.cc.purdue.edu> <12269@pt.cs.cmu.edu> Sender: news@ncis.tis.llnl.gov Organization: University of California, Berkeley Lines: 32 In article <12269@pt.cs.cmu.edu> ddean@rain.andrew.cmu.edu (Drew Dean) writes: >Can someone give a reference to Patterson's finding that most procedures are >relatively "simple" ? (ie. I remember <= 6 local vars, and about the same >number of parameters dominates usage in real code.) If you find, after >simulation that a lot of time is being spent saving & restoring registers >from the stack, then investigate mechanisms like register windows. My first reaction to this was something like "the code *better* have fewer than 6 parameters and 6 local variables per subroutine call on average, or I'm not going to work on it." Cooling down a little, I thought: maybe there's an idea--instead of optimizing architectures around how code *is*, perhaps it would make sense to look at how code *should* be. Personally, I wouldn't mind using a machine that grossly penalized subroutines with more than 4 parameters, in exchange for some slightly greater reward for using fewer, because I seldom write code that uses more than 4 routinely, and *hate* inheriting code that does. More often than not, it seems to me, people use extra parameters rather than splitting up code into separate functions to make it more modular. Register windows are a start on killing off this pernicious tendency. I'm not sure how you'd set up an evaluation, since there are so many different views of that ineffable sense of quality about code. Perhaps you'd need to average out the responses of various programmers to various kinds of code. Preferably in some relatively objective way, like how long it took them to find planted bugs, rather than according to their immediate reactions to a code inspection. Rewarding maintainability with extra performance. Why not? Maybe compilers are being too kind.... --- Michael Turner turner@tis.llnl.gov