[Vm-dev] Re: Compiling Cog (merge with eem.87)

Igor Stasenko siguctua at gmail.com
Tue Jun 28 12:33:20 UTC 2011


On 28 June 2011 12:32, Igor Stasenko <siguctua at gmail.com> wrote:
> /Users/sig/projects/cog/blessed/src/vm/cogit.c:15864: error: lvalue
> required as left operand of assignment
> /Users/sig/projects/cog/blessed/src/vm/cogit.c:15864: error: lvalue
> required as left operand of assignment
>
> here the problematic line:
>
>        case SSConstant:
>                                inst = (shouldAnnotateObjectReference((self_in_storeToReg->constant))
>                        ? annotateobjRef(gMoveCwR((self_in_storeToReg->constant), reg),
> (self_in_storeToReg->constant))
>>>>                     : /* begin MoveCq:R: */quickConstant = (self_in_storeToReg->constant),genoperandoperand(MoveCqR, quickConstant, reg));
>                break;
>
>
> seems like code generator producing bad code.
> Or maybe i'm not initializing stuff properly (since there are new
> options which may need to be passed?)
>

The fix is to change the generator to produce a following:

({ statement a; statement b; })

instead of

statement a, statement b

If you consider a slang code like:

v := self something ifTrue: [ 1 ] ifFalse: [ x := self doSomething.
self returnValue].

a generator should produce something like following:

v = something() ? 1 : ({ x = doSomething(); returnValue(); });

Then it will work well (at least in GCC).

I changed the C code to check if compiler can swallow it:

inst = (shouldAnnotateObjectReference((self_in_storeToReg->constant))
			? annotateobjRef(gMoveCwR ( (self_in_storeToReg->constant), reg),
(self_in_storeToReg->constant))
						: /* begin MoveCq:R: */({ quickConstant =
(self_in_storeToReg->constant); genoperandoperand(MoveCqR,
quickConstant, reg);}) );


Anyways, a code generator needs to be fixed, or code in #storeToReg:
and #popToReg: needs to be rewritten to not confuse the generator.


Another issue is with
/Users/sig/projects/cog/blessed/src/vm/gcc3x-cointerp.c:10137: error:
‘cmDynSuperEntryOffset’ undeclared (first use in this function)
/Users/sig/projects/cog/blessed/src/vm/gcc3x-cointerp.c:10137: error:
(Each undeclared identifier is reported only once
/Users/sig/projects/cog/blessed/src/vm/gcc3x-cointerp.c:10137: error:
for each function it appears in.)

as far as i see, this variable is used only when compiling newspeak vm
(there are a lot of places with
#if NEWSPEAK .. #else , and this variable used only in newspeak blocks.

But somehow it slept through and introduced in cog.
Probably #ceDynamicSuperSend:to:numArgs:
should also contain
	self cppIf: NewspeakVM
		ifTrue: []
clause.

> --
> Best regards,
> Igor Stasenko AKA sig.
>



-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list