CompileMethod limits

Bert Freudenberg bert at freudenbergs.de
Sat Feb 24 11:08:47 UTC 2007


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 ;)

- Bert -





More information about the Squeak-dev mailing list