Temporary variables

Peter William Lount peter at smalltalk.org
Thu Jun 17 20:40:39 UTC 1999


Hi,

I am wondering what the limits on "temporary variables", "instance
variables", and "method parameter variables (sometimes called temporary
variables as well)" are in the various versions of Smalltalk. If you have a
version of Smalltalk please check it out and let us know.

Squeak has a limit of 31 as enforced in the method "MethodNode>>generate:".
Why? I havn'e looked but is it because of a limit in the byte code encoding
that only allows 5 bits to hold the index of the temporary variable? Are
there other places in the VM where it's hard coded? If so where? Why? When
Squeak goes to a Native Code compiler will this limit be removed? If not,
why?

I've tested Digitalk VSE's version of Smalltalk with upto 60 temporaries
and it seems to accept them. The compiler source is hidden so I couldn't
find the limit that way.

Also, some Smalltalks can get into a situation that enables a method to
have a "instance variable" and "temporary variable" with the same name!
Digitalk's V286 is one example. This leads to nasty bugs that may not be
detectable unless you recompile the classes in your application.

All the best,

Peter William Lount
http://www.smalltalk.org
peter at smalltalk.org

Add this method to some class and compile it...
testingVariables
	| t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 t20 
	t21 t22 t23 t24 t25 t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38
t39 t40 
	t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54 t55 t56 t57 t58
t59 t60 |

	t1 := Object new. 
	t2 := Object new. 
	t3 := Object new. 
	t4 := Object new. 
	t5 := Object new. 
	t6 := Object new. 
	t7 := Object new. 
	t8 := Object new. 
	t9 := Object new. 
	t10 := Object new. 
	t11 := Object new. 
	t12 := Object new. 
	t13 := Object new. 
	t14 := Object new. 
	t15 := Object new. 
	t16 := Object new. 
	t17 := Object new. 
	t18 := Object new. 
	t19 := Object new. 
	t20 := Object new. 
	t21 := Object new. 
	t22 := Object new. 
	t23 := Object new. 
	t24 := Object new. 
	t25 := Object new. 
	t26 := Object new. 
	t27 := Object new. 
	t28 := Object new. 
	t29 := Object new. 
	t30 := Object new. 
	t31 := Object new. 
	t32 := Object new. 
	t33 := Object new. 
	t34 := Object new. 
	t35 := Object new. 
	t36 := Object new. 
	t37 := Object new. 
	t38 := Object new. 
	t39 := Object new. 
	t40 := Object new. 
	t41 := Object new. 
	t42 := Object new. 
	t43 := Object new. 
	t44 := Object new. 
	t45 := Object new. 
	t46 := Object new. 
	t47 := Object new. 
	t48 := Object new. 
	t49 := Object new. 
	t50 := Object new. 
	t51 := Object new. 
	t52 := Object new. 
	t53 := Object new. 
	t54 := Object new. 
	t55 := Object new. 
	t56 := Object new. 
	t57 := Object new. 
	t58 := Object new. 
	t59 := Object new. 
	t60 := Object new. 
	





More information about the Squeak-dev mailing list