[BUG;FIX] (was TestInterpreterPlugin Compiler)

Andrew C. Greenberg werdna at gate.net
Tue Dec 21 09:00:25 UTC 1999


--============_-1266355649==_============
Content-Type: text/plain; charset="us-ascii" ; format="flowed"


At 5:07 AM +0100 12/21/99, Stephan Rudlof wrote:
>The fragment
>...
>	[len = 0 ifTrue: [^ 0 asSmallIntegerObj].
>	(self digitOf: aLargePositiveInteger at: len)
>		= 0]
>		whileTrue: [len _ len - 1].
>...
>will be compiled to:
>...
>	do {
>		if (len == 0) {
>			return interpreterProxy->integerObjectOf(0);
>		}
>	} while((digitOfat(aLargePositiveInteger, len)) == 0);
>...
>
>
>I don't know if to declare this as a bug or a limited capability of the
>compiler...

Its a bug in all versions of the CCodeGenerator, which fails to 
generate correct code for complex loops of the form:

	[exp1. condition] whileTrue: [exp2. exp3].

With the attached changeset, the CCodeGenerator now generates for this case:

	exp1.
	while(condition) {
		exp2;
		exp3;
		exp1;
	}

I haven't had a chance to fully test the patch, but I'm hoping 
Stephen or Andreas will be able to put it through its paces.  I'd 
like to do a more elegant revision of the code generator for loops 
when I find some time, but for now this changeset should serve.  (Or 
perhaps we should build less complex loops?)
"

--============_-1266355649==_============
Content-Type: text/plain; name="CCodeGenerator.1.cs"
 ; x-mac-type="65417070"
 ; x-mac-creator="43534F6D"
Content-Disposition: attachment; filename="CCodeGenerator.1.cs"
Content-Transfer-Encoding: imap_stub

0,2557,2.2,4640,0,

--============_-1266355649==_============--





More information about the Squeak-dev mailing list