Hi Levente,
On Sun, 24 Apr 2011, Eliot Miranda wrote:
Great catch Levente. I'll try and track this down asap.
Great, thanks. I found that primitive 148 (#shallowCopy) doesn't copy the pc and the temporaries (indexable fields). But there are some other interesting cases, where the number of indexable fields are different. To reproduce this issue, replace ContextPart >> #copyTo: with the following:
copyTo: aContext
"Copy self and my sender chain down to, but not including, aContext. End of copied chain will have nil sender."
| copy |
self == aContext ifTrue: [ ^nil ].
copy := self copy.
"Cog doesn't copy the pc, so copy it here."
copy pc: pc.
copy basicSize = self basicSize ifFalse: [ self halt ].
sender ifNotNil: [ copy privSender: (sender copyTo: aContext) ].
^copy
Then evaluate
c := [ 3 + [ :k | k ] shift ] reset.
in the workspace in the image I prepared. Two halts will appear after each other (proceed after the first). In the first case the size of the copy is smaller than the original, in the second case it's larger.
Levente