Problem generating cog v3 related to primitiveVMParameter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem generating cog v3 related to primitiveVMParameter

Nicolas Cellier
 
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...

Nicolas
Reply | Threaded
Open this post in threaded view
|

Re: Problem generating cog v3 related to primitiveVMParameter

Eliot Miranda-2

Hi Nicolas

On Mar 22, 2015, at 3:07 AM, Nicolas Cellier <[hidden email]> 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