Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Walter Banks Newsgroups: comp.lang.forth Subject: Re: Metrics on stack usage Date: Fri, 19 Sep 2014 07:21:41 -0400 Organization: Aioe.org NNTP Server Lines: 37 Message-ID: <541C11C5.5AD2C7E0@bytecraft.com> References: <541855C0.2558D27D@bytecraft.com> <7xmw9zletd.fsf@ruckus.brouhaha.com> <541891FE.9157C03@bytecraft.com> <7xoaufyxch.fsf@ruckus.brouhaha.com> NNTP-Posting-Host: kjvqv0Ez85EeIrZV4QHUBA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Mailer: Mozilla 4.79 [en]C-CCK-MCD NSCPCD479 (Windows NT 5.0; U) X-Accept-Language: en X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.forth:33433 rickman wrote: > On 9/16/2014 7:11 PM, Paul Rubin wrote: > > Walter Banks writes: > >> The stack question comes from a bigger argument about what is > >> an appropriate stack size for a processor. Part of the discussion > >> has been about the nature of code written for a stack machine and > >> how it affects machine resources. > > > > You should look up Philip Koopman's old book "Stack Machines" and > > related papers, if you haven't. Also the more recent work by Tikhon > > Jelvis about compiling for the GreenArrays processor: > > > > http://jelv.is/chlorophyll.pdf > > I was glancing through this paper and see they discuss a "trick" that > can be used on the GA144 that won't work in most other machines. The > stack is a circular file it doesn't matter if you leave data littering > the bottom of the stack. In fact, that can be a "feature" if you happen > to find the circular size to be convenient. But as long as your code > does not get called with other parameters on the stack it can leave junk > on the stack and just ignore it potentially shortening the program and > running faster. This would likely not be unusual in the tiny apps that > are common on the GA144 processors. I hadn't seen the chlorophyll paper until you posted the link a couple days ago. Earlier in this project I specifically looked at the use of a circular stack and what the advantages it would have to just leave junk lying around and not needing to care. The answer we arrived at was not much of an advantage. We compared two code generators each optimized one for a circular stack and one not. There are differences in code generation strategy but the metrics on cycles and code size were very similar. w..