On Mon, Feb 24, 2014 at 12:21 PM, Clément Bera <[email protected]>wrote:

> Hello,
>
> Try :
>
> Smalltalk compactClassesArray at: 5 put: nil.
> LargePositiveInteger becomeUncompact.
> LargePositiveInteger becomeCompactSimplyAt: 5.
>
> then:
>
>  LargePositiveInteger indexIfCompact.
>
> is correct.
>
> Same script is needed for LargeNegativeInteger.
>
>
Good!


> I think this bug is due to the introduction of LargeInteger class in Pharo
> 3 (common superclass of LargePositiveInteger and LargeNegativeInteger).
>
> Ok


> Now this is strange that the script I gave you worked because if you look
> at
> TBehavior>>checkCanBeUncompact
> "Certain classes cannot be uncompacted in CogVM.  If you download VMMaker
> and see the VM code, these are as defined by
> StackInterpreter>>#checkAssumedCompactClasses and the ones that can't be
> uncompacted are the following: "
>  ({ Array. LargeNegativeInteger. LargePositiveInteger. Float.
> MethodContext } includes: self)
>  ifTrue: [ self error: 'Class ', self name, ' cannot be uncompact. ' ]
>
>
I debugged "LargePositiveInteger becomeUncompact": it returns before
sending #checkCanBeUncompact since
#indexIfCompact is zero.

So, it'd be enough with just:

Smalltalk compactClassesArray at: 4 put: nil.
LargeNegativeInteger becomeCompactSimplyAt: 4.
Smalltalk compactClassesArray at: 5 put: nil.
LargePositiveInteger becomeCompactSimplyAt: 5.



> However it seems that it worked with #becomeCompactSimplyAt
>
>
So we should add a test for compact classes consistency. Maybe in Slot's
class builder.

---

PS: I've found this method in Integer metaclass:

initialize "Integer initialize"
 "Ensure we have the right compact class index"

"LPI has been a compact class forever - just ensure basic correctness"
 (LargePositiveInteger indexIfCompact = 5) ifFalse:[
(Smalltalk compactClassesArray at: 5)
ifNil:[LargePositiveInteger becomeCompactSimplyAt: 5]
 ifNotNil:[self error: 'Unexpected compact class setup']].

(LargeNegativeInteger indexIfCompact = 4) ifFalse:[
 (Smalltalk compactClassesArray at: 4)
ifNil:[LargeNegativeInteger becomeCompactSimplyAt: 4]
ifNotNil:[self error: 'Unexpected compact class setup']].


(2 years old)
the only senders in the image of #becomeCompactSimplyAt:

---

Martín

Reply via email to