9.1x64: Array>>#replaceFrom:to:withObject: does not work correctly for EsWeakArray (and other Array subclasses with named inst vars)

38 views
Skip to first unread message

Hans-Martin Mosner

unread,
Oct 23, 2019, 10:13:20 AM10/23/19
to VA Smalltalk
Today I found a curious bug in the VMprPointerReplaceFromToWithObject primitive:
In EsWeakArray, it only fills the slots up to the next-to-last one.
    (EsWeakArray new: 5) replaceFrom: 1 to: 5 withObject: 1
results in
    (1 1 1 1 nil)

Apparently, in computing the limit it does not skip the named instance variable. I could verify this assumption by defining a subclass of Array with two named instance variables, and for this subclass, the last two slots will be left nil.

I see this behavior in Windows and Linux 64 bit 9.1 VMs with fixpack 9.1.1.
Is this a known bug, and will it been fixed in 9.2?

Cheers,
Hans-Martin

Mariano Martinez Peck

unread,
Oct 23, 2019, 10:24:38 AM10/23/19
to VA Smalltalk
Hi Hans-Martin,

Great catch. I can reproduce it very easily as you pointed out:

Array variableSubclass: #MyArray
    classInstanceVariableNames: ''
    instanceVariableNames: 'instVar1 instVar2 '
    classVariableNames: ''
    poolDictionaries: ''

(MyArray new: 5) replaceFrom: 1 to: 5 withObject: 1 
-----> (1 1 1 nil nil)

I am already writing a unit test for this and I have forwarded this issue to our VM team.

I will keep you posted. 
 

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/b6c5d1c7-bebb-49a8-9a11-ca3458c80291%40googlegroups.com.


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.

Seth Berman

unread,
Oct 23, 2019, 1:25:23 PM10/23/19
to VA Smalltalk
Thanks for reporting Hans-Martin,

We have made the appropriate fix to the 'end' counter of the for loop which was not adjusted for namedInstVarSize.
It has been committed and will be in 9.2

- Seth
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk+unsubscribe@googlegroups.com.


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.
Reply all
Reply to author
Forward
0 new messages