[Vm-dev] Direct object pointers vs indirect ones pros and cons

David T. Lewis lewis at mail.msen.com
Fri Nov 12 19:03:44 UTC 2010


On Fri, Nov 12, 2010 at 11:58:59AM +0200, Igor Stasenko wrote:
>  
> Here a 'simulated' kind of indirect pointers.
> 
> The Wrapper class having an 'object' ivar
> and in this way, we simulating indirection.

If you want to measure the effects of an extra level of indirection at a
low level, you may want to try hacking the MemoryAccess slang version of
the C macros.

These implement low level memory access at the level of pointerForOop and
oopForPointer and such. On an intepreter VM they run at the same speed as
the actual C macros, to the best of my ability to measure (this is due to
the effectiveness of the Slang inliner, which works suprisingly well).

If you use class MemoryAccess as a pattern (either write your own, or modify
this one), then you might be able to do experiments like this entirely at
the C level and maybe give you a better idea of the tradeoffs.

The code is in SqS/VMMaker in package MemoryAccess. A few changes are
needing in C headers in the platforms source, which can be found here:
  http://wiki.squeak.org/squeak/uploads/6081/MemoryAccessPlatformDiffs.zip
along with some explanations:
  http://wiki.squeak.org/squeak/6081

HTH,
Dave



More information about the Vm-dev mailing list