re CGeneratorEnhancements-ajh.cs
John M McIntosh
johnmci at smalltalkconsulting.com
Sun Apr 7 06:36:25 UTC 2002
To the list & Anthony.
I was looking at CGeneratorEnhancements-ajh.cs with an eye towards
the statement about individual variables in each case statement
perhaps making things abit more optimizing friendly.
Now for the 68K gcc version, this seems true, in many places
addresses are moved into registers and manipulated, versus back and
forth to the stack. Say 8 clock cycles instead of 32, and it also
reduces the number of instructions by one or two, here and there. So
I was quite excited to attempt to build a new VM today. Mmm if there
is enought interest from the 68K mac folks, I might even build a new
VM.
But there is a problem
You see if you just apply this change set, you can't get a runnable vm.
why? well
self sharedCodeNamed: 'commonReturn' inCase: 120.
in Interpreter>>returnValue:to:
allows the code generator to build a common block of code within a
case statement (label commonReturn: in case 120), then other case
blocks can jump to the code, hint they share variables. But with
CGeneratorEnhancements-ajh.cs each case statement gets unique
variables like so:
(ack a goto aren't those evil?)
case 121:
/* returnTrue */
cntx1 = longAt(((((char *) localHomeContext))
+ 4) + (0 << 2));
val1 = trueObj;
/* begin returnValue:to: */
goto commonReturn;
l4: /* end returnValue:to: */;
break;
case 122:
/* returnFalse */
cntx2 = longAt(((((char *) localHomeContext))
+ 4) + (0 << 2));
val2 = falseObj;
/* begin returnValue:to: */
goto commonReturn;
However in commonReturn the variables used are cntx and val, and of
course we fail to proceed.
Ah but the old code used t1 and t2, and you're right if you guessed
commonReturn: used
t1 and t2 in the correct places. Design or accident?
case 121:
/* returnTrue */
t2 = longAt(((((char *) localHomeContext)) +
4) + (0 << 2));
t1 = trueObj;
/* begin returnValue:to: */
goto commonReturn;
l4: /* end returnValue:to: */;
break;
case 122:
/* returnFalse */
t2 = longAt(((((char *) localHomeContext)) +
4) + (0 << 2));
t1 = falseObj;
/* begin returnValue:to: */
goto commonReturn;
Mmm now I could hack something together, but thought I should look
for a more correct solution.
--
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
===========================================================================
More information about the Squeak-dev
mailing list
|