[Vm-dev] getting rid of pointer aliasing
eliot.miranda at gmail.com
Sat Mar 5 00:26:15 UTC 2016
On Fri, Mar 4, 2016 at 1:46 PM, Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> wrote:
> pointer aliasing is evil/dangerous on modern C Compiler.
> Though it's kind of easy to remove most of them.
> For example:
> self cCode:'((long *)addr) = ((long *)(&floatValue))'.
> can easily become:
> self cCode: [self mem: addr cp: (self addressOf: floatValue) y: (self
> sizeof: floatValue)].
> Modern compiler will generate very efficient code for that.
> Would you like me to proceed?
Yes, but please use this form where possible:
self mem: addr cp: (self addressOf: floatValue) y: (self sizeof:
The cCode: approach is not a;ways needed. VMClass and SpurMemoryManager
provide implementations of some of the C library that actually work in
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev