[Vm-dev] Re: latest vmmaker wont run with pharo 1.1.1 (dev)

Andreas Raab andreas.raab at gmx.de
Tue Nov 9 02:41:57 UTC 2010


On 11/8/2010 5:08 PM, Levente Uzonyi wrote:
> The problem is that the method expects ByteStrings as arguments, but it
> won't fail if one of them is a WideString. Instead it returns wrong
> results. Here's an example (in Squeak):
>
> ByteString new
> findSubstring: 'b'
> in: 'abc' asWideString
> startingAt: 1
> matchTable: ((0 to: 255) as: ByteArray). "===> 0"
>
> The result is 0, while it should be 2. The problem is worked around in
> Squeak by making sure that the primitive is not used in this case.
>
> 'abc' asWideString
> findString: 'b'
> startingAt: 1
> caseSensitive: true. "===> 2"
>
> Though a naive user can still use the method as shown here.

Thanks. Looks like a problem in extracting string arguments in 
translated primitives. With Squeaksource being down again (should we 
move VMMaker to source.squeak.org?) I've attached a change set with a 
fix. This adds an additional check for char* arguments in translated 
prims to ensure that they're actually byte objects.

Cheers,
   - Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TMethod-argConversionExprForstackIndex.st
Type: application/squeak-changeset
Size: 1656 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20101108/9c56c6d9/TMethod-argConversionExprForstackIndex.bin


More information about the Vm-dev mailing list