[Vm-dev] Reed Solomon plugins & performance slow down

Robert robert.withers at pm.me
Sat Jun 5 23:54:04 UTC 2021


Hi Eliot, I hope all is well with you!

I will try to make these changes, both in my working primitives and in my 7 broken primitives. See if that might help.

Grazie Mille!

Kindly,
Robert
. .. ... ‘...^,^

On Sat, Jun 5, 2021 at 19:39, Eliot Miranda <eliot.miranda at gmail.com> wrote:

> Hi Robert,
>
> _,,,^..^,,,_ (phone)
>
>> On Jun 4, 2021, at 11:52 AM, Robert Withers <robert.withers at pm.me> wrote:
>>
>> fieldSize := interpreterProxy stackIntegerValue: 1.
>> coefficientsOop := interpreterProxy stackObjectValue: 0.
>
> Since you check for isBytes: below you can use stackValue:. isBytes: can safely be passed any object, including immediates. So the stackObjectValue: call implies a redundant validation.
>
>>
>> (interpreterProxy isIntegerValue: fieldSize)
>> ifFalse: [ ^interpreterProxy primitiveFailFor: PrimErrBadArgument ].
>
> This is implicit. stackIntegerValue: fails if the object is not a SmallInteger (retiring zero) and otherwise answers its integerValue. So you should check if stackIntegerValue: fails since its return value will always answer true to isIntegerValue:
>
>> (interpreterProxy isBytes: coefficientsOop)
>> ifFalse: [ ^interpreterProxy primitiveFailFor: PrimErrBadArgument ].
>
> I would write
>
> fieldSize := interpreterProxy stackIntegerValue: 1.
> coefficientsOop := interpreterProxy stackValue: 0.
>
> (interpreterProxy failed not
> and: [interpreterProxy isBytes: coefficientsOop])
> ifFalse: [ ^interpreterProxy primitiveFailFor: PrimErrBadArgument ].
>
> or
>
> fieldSizeOop := interpreterProxy stackValue: 1.
> coefficientsOop := interpreterProxy stackValue: 0.
>
> ((interpreterProxy isIntegerObject: fieldSizeOop)
> and: [interpreterProxy isBytes: coefficientsOop])
> ifFalse: [ ^interpreterProxy primitiveFailFor: PrimErrBadArgument ].
>
> fieldSize := interpreterProxy integerValueOf: fieldSizeOop.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20210605/67473d43/attachment.html>


More information about the Vm-dev mailing list