[Vm-dev] Problem generating cog v3 related to primitiveVMParameter

Eliot Miranda eliot.miranda at gmail.com
Sun Mar 22 17:20:34 UTC 2015


Hi Nicolas

On Mar 22, 2015, at 3:07 AM, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:

> Hi,
> I currently get link failure when compiling squeak.cog.v3 for my own VM brand.
> 
> The unresolved symbols are related to Spur (like numSegments).
> 
> It seems that the CCodeGenerator correctly eliminated the tests like
>     objectMemory hasSpurMemoryManagerAPI ifTrue: [...]
> 
> But failed to eliminate this one:
>         (arg = 53
>          and: [objectMemory hasSpurMemoryManagerAPI]) ifTrue:
>             [result := objectMemory integerObjectOf: objectMemory numSegments].
> 
> which is generated as:
>         if ((arg == 53)
>          && (0)) {
>             result = (((numSegments()) << 1) | 1);
>         }
> 
> So we should either rewrite primitiveVMParameter test like this:
>     objectMemory hasSpurMemoryManagerAPI ifTrue: [arg = 53 ifTrue: [...]]
> 
> or patch the generator again with more complex pattern analysis...

The latter I think.  But I'm surprised it isn't doing this correctly anyway.  I thought I'd handled and: and or: chains.  I'll take a look l8r today

> 
> Nicolas


More information about the Vm-dev mailing list