Subject: Re: Heap- vs. stack-based fn call frames, was: how to validate input?
From: Erik Naggum <erik@naggum.no>
Date: 2000/04/26
Newsgroups: comp.lang.lisp
Message-ID: <3165733245874405@naggum.no>

* Flemming Gram Christensen <gram@ull.mjolner.dk>
| How do you mean? The UltraSparc II and Athlon's and the like
| has prediction instructions already.

  I believe these instructions are called "prefetch", which is different
  from prediction.  "prediction" usually applies to branch prediction, but
  I'm talking about a similar automatic heap cache line prefetch or priming
  (when the memory is known to be written first) when a function call is
  coming up in the instruction stream.

  these instructions are fun to watch do weird things with one's ideas
  about cache line costs, but using them requires their actual presence and
  some computation for the effect you get for free from reusing the same
  memory the way a stack works.  most stacks are amazingly shallow and the
  cache hit rates for stacks (including temporaries in call frames) are
  typically >99.9%.  to get that good hit rates for a heap allocation
  scheme that walks over fresh memory while allocating and causes much
  scattering of allocated call frames unless the heap is optimized like a
  stack, you have to do a huge number of more or less explicit cache line
  prefetching in the absence of lots of prefetch instructions that add to
  the computational load without necessarily having any effect.

#:Erik