Re: hi-res profiling

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Wed, 2 Oct 2002 15:43:48 +0200

Robert Collins wrote:
> On Wed, 2002-10-02 at 21:36, Henrik Nordstrom wrote:
>
> > A staticall defined array with constant indexes (inlined functions) will
> > translate to direct memory accesses.
> >
> > A dynamically allocated array with dynamic indexes (not inlined
> > functions) translates to a indirect loopup via the pointer address plus
> > calculated entry offset plus field offset.
>
> Ok, can't argue with that :}.
> What about a dynamically allocated array with constant indexes?

Semi-ok. It at most gets into two instructions
  1. Load pointer value
  2. load/store/modify value at constant offset from pointer

        a4[12].v[2] = 24;
 8048435: a1 c4 9b 04 08 mov 0x8049bc4,%eax
 804843a: c7 80 78 02 00 00 18 movl $0x18,0x278(%eax)
 8048441: 00 00 00

The pointer may be cached in a register if you are accessing the same array
multiple times in the same function.

Regards
Henrik
Received on Wed Oct 02 2002 - 07:43:51 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:16:51 MST