On Thu, 2002-10-03 at 00:29, Andres Kroonmaa wrote:
> > The pointer may be cached in a register if you are accessing the same array
> > multiple times in the same function.
>
> This may hold only if all code is inlined. If we use call with probe type as
> argument, func has to load array pointer, mult index by struct size, and
> then reference with offset into struct.
Yes, but if we have the probe code in an inlinable fn' then to our eyes
we use the enum, but the generated assembly will use a const.
> I wonder how does gcc compile stuff if array is across lib boundary, will
> it at all even attempt to use direct access, or will it just load pointer
> to it from some place where "relocation" has been done?
> gcc would never inline public exported funcs, and so I wonder, how it
> handles public exported arrays?
If the code is in a header and can inline, gcc doesn't care whether it
will be part of a library or not. (This goes for gcc and g++).
> We could also pass as argument pointer to the struct of array, which could
> be calculated in macro. Would make probe code even more simple.
Yes, but at a price. I'm thinking of pthread_key support again here.
Rob
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:16:51 MST