CompileMethod limits

Klaus D. Witzel klaus.witzel at cobss.com
Sat Feb 24 11:22:57 UTC 2007


On Sat, 24 Feb 2007 12:08:47 +0100, Bert Freudenberg wrote:
> On Feb 24, 2007, at 10:07 , Klaus D. Witzel wrote:
>
>> Hi Milan,
>>
>>>     byteArr := #(80 75 3 4 20 0 0 0 0 0 76 134 203) asByteArray.
>>>     byteArrStoreString := byteArr storeString.
>>>     method := 'method1 ^',  '''', byteArrStoreString, ''''.
>>>     TestCompile compile: method classified: 'my-compile-test'
>>>
>>> This worked for the short ByteArray above, but for a long one, I get  
>>> an Error
>>> from CompileMethod:
>>>
>>>   "Error: Cannot compile - too many literal variables"
>
>>>   -# So I ended up "manually serializing" the ByteArray, esentially as  
>>> a
>>> literal String such as '80 75 3 4 20 0 0 0 0 0 76 134 203' in the small
>>> example above. Then deserialized after the method answered.
>
>
> I was suggesting using #storeString on the Form, not the ByteArray. This  
> is more efficient because it uses words instead of bytes, and it uses  
> only one literal. This way, the parsing work is done only once when  
> compiling. Reading decimal from a String at runtime is particularly  
> inefficient. Don't do that ;)

Milan, listen to Bert and Don't do that ;)

> - Bert -
>




More information about the Squeak-dev mailing list