[squeak-dev] How to become immediate objects? :-)

Eliot Miranda eliot.miranda at gmail.com
Thu Apr 16 00:01:51 UTC 2020


Hi Chris, Hi All,

On Wed, Apr 15, 2020 at 3:14 PM Chris Muller <asqueaker at gmail.com> wrote:

> But the hash can't always be copied over, so it's a tough decision what
>> the default should be:
>> - if the hash is not copied by default, the lack of rehashing will cause
>> elements to be not found in the affected collections
>
> - if the hash is copied, runtime errors will be raised when coping the
>> hash is not possible.
>>
>
> I think a "lack of rehashing" issue could also occur in the latter case,
> too, if the target of the become (the argument) was in a identity hashed
> collection..
>

Right.  The major use case for which copyHash being true is correct is
class reshaping where new instances of the reshaped class are created and
all existing instances are forwarded to the new instances.  Were the new
instances' hashes too be left alone, all hell would break lose.

So I did the deed.  See commits below.  elementsForwardIdentityTo: now uses
the primitive (number) that implicitly has copyHash false.
elementsForwardIdentityAndHashTo: has the old behaviour with copyHash true;
it is effectively the rename ing of the old elementsForwardIdentityTo:.
The become: wrappers have been moved down to Object from ProtoObject.  The
ClassBuilder and ClassDescription have been changed to use
elementsForwardIdentityAndHashTo: when migrating.  So hopefully the system
should continue as normal except that a casual use of becomeForward: to a
read-only object should now work as expected.

The change to the error c ode of the primitive will require new VMs.  Those
should be ready by week's end. Apologies until then.

Name: Collections-eem.885

Author: eem

Time: 15 April 2020, 4:37:54.800631 pm

UUID: 45d219d3-6ed0-4401-a820-44eebe21d71a

Ancestors: Collections-eem.883, Collections-dtl.884


Switch elementsForwardIdentityTo: to not copy the hash, see
http://forum.world.st/How-to-become-immediate-objects-td5114931.html.

Add elementsForwardIdentityAndHashTo: for the old behavior.


Name: Kernel-eem.1322

Author: eem

Time: 15 April 2020, 4:39:29.367332 pm

UUID: 94e874d1-0572-4a1d-9934-edcf87b8ecb5

Ancestors: Kernel-eem.1321


Move the become: methods from ProtoObject to Object.  See
http://forum.world.st/How-to-become-immediate-objects-td5114931.html


Name: Kernel-eem.1323

Author: eem

Time: 15 April 2020, 4:46:14.261016 pm

UUID: 5ea740f0-f4c6-4808-b7b6-2e3aee87aa91

Ancestors: Kernel-eem.1322


Update the ClassBuilder and instance migration, given the changes in
Collections-eem.885.  See
http://forum.world.st/How-to-become-immediate-objects-td5114931.html.





-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200415/28523a1d/attachment.html>


More information about the Squeak-dev mailing list