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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Hans-Martin Mosner-3
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/b6c5d1c7-bebb-49a8-9a11-ca3458c80291%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

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

Mariano Martinez Peck-2
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. 
 

On Wed, Oct 23, 2019 at 11:13 AM 'Hans-Martin Mosner' via VA Smalltalk <[hidden email]> wrote:
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

--
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 [hidden email].
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.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAOUkibEH6ENwefhLa%2Buvo15rPjgqYThSsU54YgpvD6ioD8b5HQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

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

Seth Berman
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

On Wednesday, October 23, 2019 at 10:24:38 AM UTC-4, Mariano Martinez Peck wrote:
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. 
 

On Wed, Oct 23, 2019 at 11:13 AM 'Hans-Martin Mosner' via VA Smalltalk <[hidden email]> wrote:
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

--
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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/va-smalltalk/b6c5d1c7-bebb-49a8-9a11-ca3458c80291%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/b6c5d1c7-bebb-49a8-9a11-ca3458c80291%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/b6c5d1c7-bebb-49a8-9a11-ca3458c80291%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/va-smalltalk/b6c5d1c7-bebb-49a8-9a11-ca3458c80291%40googlegroups.com.


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.
Twitter: <a href="https://twitter.com/MartinezPeck" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftwitter.com%2FMartinezPeck\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFPV-7Bnc-U6phGEh-VZU0iUtY7vw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftwitter.com%2FMartinezPeck\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFPV-7Bnc-U6phGEh-VZU0iUtY7vw&#39;;return true;">https://twitter.com/MartinezPeck
LinkedIn: <a href="https://www.linkedin.com/in/mariano-mart%C3%ADnez-peck/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.linkedin.com%2Fin%2Fmariano-mart%25C3%25ADnez-peck%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyJTUAWXPstaw4J3OpFUYRyFAqmw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.linkedin.com%2Fin%2Fmariano-mart%25C3%25ADnez-peck%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyJTUAWXPstaw4J3OpFUYRyFAqmw&#39;;return true;">www.linkedin.com/in/mariano-martinez-peck
Blog: <a href="https://marianopeck.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmarianopeck.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHAOaIsyMIYgmQWdQZRuKRdD6gBfw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmarianopeck.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHAOaIsyMIYgmQWdQZRuKRdD6gBfw&#39;;return true;">https://marianopeck.wordpress.com/

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/70657c09-7923-424d-8b4a-1f6fa95b7faa%40googlegroups.com.