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

David T. Lewis lewis at mail.msen.com
Wed Nov 10 03:30:47 UTC 2010


On Mon, Nov 08, 2010 at 06:41:57PM -0800, Andreas Raab wrote:
>  
> 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.

Andreas,

Your fix does indeed resolve the underlying problem. I added it
to VMMaker (with a note to Eliot to do likewise with oscog), and
also added unit tests based on Levente's example. This should
allow the various WideString workarounds to be removed once the
updated VMs are in circulation.

Thanks,
Dave



More information about the Vm-dev mailing list