limit check pushed inside loop
Matthew Fluet
fluet@research.nj.nec.com
Wed, 9 Aug 2000 14:17:47 -0400 (EDT)
> > > Which raises an interesting point -- in that non-allocating loop, there is
> > > a check for 24 additional bytes at each entry; probably for the
> > > continuation where I print out the result, but it looks like it got pushed
> > > too far back into the loop.)
> >
> > This feels like a bug. I'll look into it.
>
> Actually, it's not a bug. Limit checks are only inserted in a few places, loop
> headers being one of them. The amount is the max over all control flow paths to
> the next limit check. So, even if nothing is allocated inside the loop, as long
> as one of the exits leads to allocation before a limit check, that will get
> pushed inside the loop.
O.K. I only mentioned it because from a performance point of view, a
limitCheck with zero bytes can simply compare frontier with limit without
some calculation (whether it be via leal or movl/addl).