[Vm-dev] Cross file updates

David T. Lewis lewis at mail.msen.com
Fri Mar 8 04:44:17 UTC 2013


On Thu, Mar 07, 2013 at 11:06:32PM -0500, David T. Lewis wrote:
>  
> On Thu, Mar 07, 2013 at 06:07:45PM -0800, tim Rowledge wrote:
> > 
> > The self var: #dispBits type: 'unsigned char * '. line seems to do nothing in the current VMMaker; I'm pretty sure it used to. Somewhere the SmartSyntax codegen stuff is over-riding that decl (or ignoring is more likely I guess) because of the primitive declaration using a 'WordArray'; that causes the use of (unsigned *). Using ByteArray makes is use (char *) instead.
> > 
> 
> It's certainly something related to that line. Nowadays, declarations of the form:
> 
> 	self var: #dispBits type: 'unsigned char * '.
> 
> are done instead with method annotations:
> 
> 	<var: #dispBits type: 'unsigned char * '>
> 
> but I have tried to keep the original mechanism intact in trunk VMMaker.
> 
> I tried changing the declaration to <var: #dispBits type: 'unsigned char * '>
> and I still get exactly the same incorrect code generation.
> 
> Tim, if you have an older version of VMMaker readily at hand from your
> recent Pi work, could you take a look at the generated code for HostWindowPlugin
> and see if it has this same bug?
> 
> Dave

Actually, looking that this again I have to say that the slang makes no
sense at all. We have:

	self var: #dispBits type: 'unsigned char * '.

which as you pointed out is a declaration that contradicts the WordArray
declaration in the parameter list:

	self primitive: 'primitiveShowHostWindowRect'
		parameters: #(SmallInteger WordArray SmallInteger SmallInteger SmallInteger
				SmallInteger SmallInteger SmallInteger SmallInteger).

My guess is that the SmartSyntax generator declares the parameter #dispBits
improperly, and somebody noticed that problem and tried to fix it by adding
the self var: #dispBits type: 'unsigned char * ', which does not the fix the
problem at all. In fact it has no effect on the generated code, but it looks
like it *should* be doing something, thus contributing to the general confusion.

I dug up and older version of HostWindowPlugin from the Squeak 3.8 time frame,
and the self var: #dispBits type: 'unsigned char * ' is not present in that
version.

Bottom line: The "self var: #dispBits type: 'unsigned char * ' " is probably
a mistake that should be removed, and there is also a bug(let) in the SmartSyntax
code generator that should be fixed.

And I hate to say it but you were probably right to change the header declaration
to (unsigned *) in the first place, so maybe your last reversion should be reverted.
Better to get the declarations right in Cross and fix up VMM and elsewhere as needed.

Dave



More information about the Vm-dev mailing list