#instSize in Squeak 5 seems to be broken for Traits

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

#instSize in Squeak 5 seems to be broken for Traits

Max Leske
Hi folks

I’ve been trying to load Fuel into Squeak 5 but can’t because I get errors when loading Traits (they have not instance variables). The reason for this error seems to be that #instSize answers 2 for Traits when it should answer 0.

The current implementation is:

^format bitAnd: 16rFFFF

The comment in the 4.6 version says:

"
        NOTE: This code supports the backward-compatible extension to 8 bits of instSize.
        When we revise the image format, it should become...
        ^ ((format bitShift: -1) bitAnd: 16rFF) - 1
        Note also that every other method in this category will require
        2 bits more of right shift after the change.


When I use that version in TraitBehaviour>>instSize in Squeak 5 I get 0 as expected and I can load Fuel without problems.

Cheers,
Max
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] #instSize in Squeak 5 seems to be broken for Traits

Eliot Miranda-2
Hi Max,

On Fri, Aug 21, 2015 at 8:57 AM, Max Leske <[hidden email]> wrote:
Hi folks

I’ve been trying to load Fuel into Squeak 5 but can’t because I get errors when loading Traits (they have not instance variables). The reason for this error seems to be that #instSize answers 2 for Traits when it should answer 0.

The current implementation is:

^format bitAnd: 16rFFFF

The comment in the 4.6 version says:

"
        NOTE: This code supports the backward-compatible extension to 8 bits of instSize.
        When we revise the image format, it should become...
        ^ ((format bitShift: -1) bitAnd: 16rFF) - 1
        Note also that every other method in this category will require
        2 bits more of right shift after the change.


When I use that version in TraitBehaviour>>instSize in Squeak 5 I get 0 as expected and I can load Fuel without problems.

So Spur has a different layout for format than V3.  The above implementation (format bitAnd: 16rFFFF) is correct for Spur.  In loading classes or traits via Fuel from 4.6 to 5.0 you're going to have to convert the format inst var to reflect its usage in Spur.  So we need to be clear here.

Is the issue that you're trying to load classes and/or traits from a Fuel file written by 4.6 or is it that as part of the Fuel load a new Trait gets created which has a format of 2?


Cheers,
Max



--
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] #instSize in Squeak 5 seems to be broken for Traits

Max Leske

On 21 Aug 2015, at 19:31, Eliot Miranda <[hidden email]> wrote:

Hi Max,

On Fri, Aug 21, 2015 at 8:57 AM, Max Leske <[hidden email]> wrote:
Hi folks

I’ve been trying to load Fuel into Squeak 5 but can’t because I get errors when loading Traits (they have not instance variables). The reason for this error seems to be that #instSize answers 2 for Traits when it should answer 0.

The current implementation is:

^format bitAnd: 16rFFFF

The comment in the 4.6 version says:

"
        NOTE: This code supports the backward-compatible extension to 8 bits of instSize.
        When we revise the image format, it should become...
        ^ ((format bitShift: -1) bitAnd: 16rFF) - 1
        Note also that every other method in this category will require
        2 bits more of right shift after the change.


When I use that version in TraitBehaviour>>instSize in Squeak 5 I get 0 as expected and I can load Fuel without problems.

So Spur has a different layout for format than V3.  The above implementation (format bitAnd: 16rFFFF) is correct for Spur.  In loading classes or traits via Fuel from 4.6 to 5.0 you're going to have to convert the format inst var to reflect its usage in Spur.  So we need to be clear here.

Is the issue that you're trying to load classes and/or traits from a Fuel file written by 4.6 or is it that as part of the Fuel load a new Trait gets created which has a format of 2?

The latter. This is reproducible by simply creating a new Trait:

Trait named: #NewTrait
uses: #()
category: ‘new cat’.
NewTrait instSize “—> 2”

Cheers,
Max



Cheers,
Max



-- 
_,,,^..^,,,_
best, Eliot

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] #instSize in Squeak 5 seems to be broken for Traits

Eliot Miranda-2
Hi Max,

On Fri, Aug 21, 2015 at 2:11 PM, Max Leske <[hidden email]> wrote:

On 21 Aug 2015, at 19:31, Eliot Miranda <[hidden email]> wrote:

Hi Max,

On Fri, Aug 21, 2015 at 8:57 AM, Max Leske <[hidden email]> wrote:
Hi folks

I’ve been trying to load Fuel into Squeak 5 but can’t because I get errors when loading Traits (they have not instance variables). The reason for this error seems to be that #instSize answers 2 for Traits when it should answer 0.

The current implementation is:

^format bitAnd: 16rFFFF

The comment in the 4.6 version says:

"
        NOTE: This code supports the backward-compatible extension to 8 bits of instSize.
        When we revise the image format, it should become...
        ^ ((format bitShift: -1) bitAnd: 16rFF) - 1
        Note also that every other method in this category will require
        2 bits more of right shift after the change.


When I use that version in TraitBehaviour>>instSize in Squeak 5 I get 0 as expected and I can load Fuel without problems.

So Spur has a different layout for format than V3.  The above implementation (format bitAnd: 16rFFFF) is correct for Spur.  In loading classes or traits via Fuel from 4.6 to 5.0 you're going to have to convert the format inst var to reflect its usage in Spur.  So we need to be clear here.

Is the issue that you're trying to load classes and/or traits from a Fuel file written by 4.6 or is it that as part of the Fuel load a new Trait gets created which has a format of 2?

The latter. This is reproducible by simply creating a new Trait:

Trait named: #NewTrait
uses: #()
category: ‘new cat’.
NewTrait instSize “—> 2”

I just took a look at this and it doesn't reproduce.  I'm using a trunk Squeak 5 image and I get 0 and required. ?

Cheers,
Max



Cheers,
Max



-- 
_,,,^..^,,,_
best, Eliot




--
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] #instSize in Squeak 5 seems to be broken for Traits

Max Leske

On 22 Aug 2015, at 19:21, Eliot Miranda <[hidden email]> wrote:

Hi Max,

On Fri, Aug 21, 2015 at 2:11 PM, Max Leske <[hidden email]> wrote:

On 21 Aug 2015, at 19:31, Eliot Miranda <[hidden email]> wrote:

Hi Max,

On Fri, Aug 21, 2015 at 8:57 AM, Max Leske <[hidden email]> wrote:
Hi folks

I’ve been trying to load Fuel into Squeak 5 but can’t because I get errors when loading Traits (they have not instance variables). The reason for this error seems to be that #instSize answers 2 for Traits when it should answer 0.

The current implementation is:

^format bitAnd: 16rFFFF

The comment in the 4.6 version says:

"
        NOTE: This code supports the backward-compatible extension to 8 bits of instSize.
        When we revise the image format, it should become...
        ^ ((format bitShift: -1) bitAnd: 16rFF) - 1
        Note also that every other method in this category will require
        2 bits more of right shift after the change.


When I use that version in TraitBehaviour>>instSize in Squeak 5 I get 0 as expected and I can load Fuel without problems.

So Spur has a different layout for format than V3.  The above implementation (format bitAnd: 16rFFFF) is correct for Spur.  In loading classes or traits via Fuel from 4.6 to 5.0 you're going to have to convert the format inst var to reflect its usage in Spur.  So we need to be clear here.

Is the issue that you're trying to load classes and/or traits from a Fuel file written by 4.6 or is it that as part of the Fuel load a new Trait gets created which has a format of 2?

The latter. This is reproducible by simply creating a new Trait:

Trait named: #NewTrait
uses: #()
category: ‘new cat’.
NewTrait instSize “—> 2”

I just took a look at this and it doesn't reproduce.  I'm using a trunk Squeak 5 image and I get 0 and required. ?

Thanks Eliot. You’re right. The problem is not with #instSize, I don’t know how I managed to get the above…

The problem is actually, that TApplyingOnClassSide (which is already present) has a format of 2:

TApplyingOnClassSide instSize “—> 2”


Also, all Traits in the image have format 2, while new Traits have format 0:

format2 := Smalltalk allTraits select: [ :e | e format = 2 ].
Smalltalk allTraits size = format2 size “—> true"

Trait named: #NewTrait
uses: #()
category: 'new cat’.

NewTrait instSize “—> 0"
format2 := Smalltalk allTraits select: [ :e | e format = 2 ].
Smalltalk allTraits size = format2 size “—> false”


This is with build 15113 (which is trunk I suppose).

Cheers,
Max


Cheers,
Max



Cheers,
Max



-- 
_,,,^..^,,,_
best, Eliot




--
_,,,^..^,,,_
best, Eliot

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] #instSize in Squeak 5 seems to be broken for Traits

Eliot Miranda-2
Hi Max,

   fixed in Squeak via a preamble in a new version of Traits.  I must remember to fix this in the bootstrap so that it doesn't afflict Pharo Spur.

On Sun, Aug 23, 2015 at 4:34 AM, Max Leske <[hidden email]> wrote:

On 22 Aug 2015, at 19:21, Eliot Miranda <[hidden email]> wrote:

Hi Max,

On Fri, Aug 21, 2015 at 2:11 PM, Max Leske <[hidden email]> wrote:

On 21 Aug 2015, at 19:31, Eliot Miranda <[hidden email]> wrote:

Hi Max,

On Fri, Aug 21, 2015 at 8:57 AM, Max Leske <[hidden email]> wrote:
Hi folks

I’ve been trying to load Fuel into Squeak 5 but can’t because I get errors when loading Traits (they have not instance variables). The reason for this error seems to be that #instSize answers 2 for Traits when it should answer 0.

The current implementation is:

^format bitAnd: 16rFFFF

The comment in the 4.6 version says:

"
        NOTE: This code supports the backward-compatible extension to 8 bits of instSize.
        When we revise the image format, it should become...
        ^ ((format bitShift: -1) bitAnd: 16rFF) - 1
        Note also that every other method in this category will require
        2 bits more of right shift after the change.


When I use that version in TraitBehaviour>>instSize in Squeak 5 I get 0 as expected and I can load Fuel without problems.

So Spur has a different layout for format than V3.  The above implementation (format bitAnd: 16rFFFF) is correct for Spur.  In loading classes or traits via Fuel from 4.6 to 5.0 you're going to have to convert the format inst var to reflect its usage in Spur.  So we need to be clear here.

Is the issue that you're trying to load classes and/or traits from a Fuel file written by 4.6 or is it that as part of the Fuel load a new Trait gets created which has a format of 2?

The latter. This is reproducible by simply creating a new Trait:

Trait named: #NewTrait
uses: #()
category: ‘new cat’.
NewTrait instSize “—> 2”

I just took a look at this and it doesn't reproduce.  I'm using a trunk Squeak 5 image and I get 0 and required. ?

Thanks Eliot. You’re right. The problem is not with #instSize, I don’t know how I managed to get the above…

The problem is actually, that TApplyingOnClassSide (which is already present) has a format of 2:

TApplyingOnClassSide instSize “—> 2”


Also, all Traits in the image have format 2, while new Traits have format 0:

format2 := Smalltalk allTraits select: [ :e | e format = 2 ].
Smalltalk allTraits size = format2 size “—> true"

Trait named: #NewTrait
uses: #()
category: 'new cat’.

NewTrait instSize “—> 0"
format2 := Smalltalk allTraits select: [ :e | e format = 2 ].
Smalltalk allTraits size = format2 size “—> false”


This is with build 15113 (which is trunk I suppose).

Cheers,
Max


Cheers,
Max



Cheers,
Max



-- 
_,,,^..^,,,_
best, Eliot




--
_,,,^..^,,,_
best, Eliot







--
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] #instSize in Squeak 5 seems to be broken for Traits

Max Leske

On 28 Aug 2015, at 02:15, Eliot Miranda <[hidden email]> wrote:

Hi Max,

   fixed in Squeak via a preamble in a new version of Traits.  I must remember to fix this in the bootstrap so that it doesn't afflict Pharo Spur.

Great, thanks!


On Sun, Aug 23, 2015 at 4:34 AM, Max Leske <[hidden email]> wrote:

On 22 Aug 2015, at 19:21, Eliot Miranda <[hidden email]> wrote:

Hi Max,

On Fri, Aug 21, 2015 at 2:11 PM, Max Leske <[hidden email]> wrote:

On 21 Aug 2015, at 19:31, Eliot Miranda <[hidden email]> wrote:

Hi Max,

On Fri, Aug 21, 2015 at 8:57 AM, Max Leske <[hidden email]> wrote:
Hi folks

I’ve been trying to load Fuel into Squeak 5 but can’t because I get errors when loading Traits (they have not instance variables). The reason for this error seems to be that #instSize answers 2 for Traits when it should answer 0.

The current implementation is:

^format bitAnd: 16rFFFF

The comment in the 4.6 version says:

"
        NOTE: This code supports the backward-compatible extension to 8 bits of instSize.
        When we revise the image format, it should become...
        ^ ((format bitShift: -1) bitAnd: 16rFF) - 1
        Note also that every other method in this category will require
        2 bits more of right shift after the change.


When I use that version in TraitBehaviour>>instSize in Squeak 5 I get 0 as expected and I can load Fuel without problems.

So Spur has a different layout for format than V3.  The above implementation (format bitAnd: 16rFFFF) is correct for Spur.  In loading classes or traits via Fuel from 4.6 to 5.0 you're going to have to convert the format inst var to reflect its usage in Spur.  So we need to be clear here.

Is the issue that you're trying to load classes and/or traits from a Fuel file written by 4.6 or is it that as part of the Fuel load a new Trait gets created which has a format of 2?

The latter. This is reproducible by simply creating a new Trait:

Trait named: #NewTrait
uses: #()
category: ‘new cat’.
NewTrait instSize “—> 2”

I just took a look at this and it doesn't reproduce.  I'm using a trunk Squeak 5 image and I get 0 and required. ?

Thanks Eliot. You’re right. The problem is not with #instSize, I don’t know how I managed to get the above…

The problem is actually, that TApplyingOnClassSide (which is already present) has a format of 2:

TApplyingOnClassSide instSize “—> 2”


Also, all Traits in the image have format 2, while new Traits have format 0:

format2 := Smalltalk allTraits select: [ :e | e format = 2 ].
Smalltalk allTraits size = format2 size “—> true"

Trait named: #NewTrait
uses: #()
category: 'new cat’.

NewTrait instSize “—> 0"
format2 := Smalltalk allTraits select: [ :e | e format = 2 ].
Smalltalk allTraits size = format2 size “—> false”


This is with build 15113 (which is trunk I suppose).

Cheers,
Max


Cheers,
Max



Cheers,
Max



-- 
_,,,^..^,,,_
best, Eliot




--
_,,,^..^,,,_
best, Eliot







--
_,,,^..^,,,_
best, Eliot