convert primitive

21 views
Skip to first unread message

pduti

unread,
Nov 9, 2012, 11:10:53 AM11/9/12
to newspeak...@googlegroups.com
Hi,

While porting  Smalltalkcode to Newspeak (NSFuel) I have to port the following code (that was added by Fuel to ProtoObject):

largeIdentityHash

<primitive: 75>
self primitiveFailed

Anybody has an idea ?

Gilad Bracha

unread,
Nov 9, 2012, 11:20:10 AM11/9/12
to newspeak...@googlegroups.com
This is an example of a special syntax used in Smalltalk to invoke VM primitives. Primitives are a Smalltalkism that has been eradicated from Newspeak.  In Newspeak, you call VM primitives by sending messages to a VMMirror.

You can use the method primitveIdentityHash  declared in SqueakVMMirror`ObjectMirrorHelper
--
Cheers, Gilad

Ryan Macnak

unread,
Nov 9, 2012, 1:36:19 PM11/9/12
to newspeak...@googlegroups.com
In this case I would just replace sends of largeIdentityHash with identityHash, which is understood by all objects. Someday the object model in Cog will be replaced with one that has a larger hash field.

Mariano Martinez Peck

unread,
Nov 18, 2012, 8:22:25 AM11/18/12
to newspeak...@googlegroups.com


On Friday, November 9, 2012 7:36:20 PM UTC+1, Ryan Macnak wrote:
In this case I would just replace sends of largeIdentityHash with identityHash, which is understood by all objects. Someday the object model in Cog will be replaced with one that has a larger hash field.


Exactly. That was because of an optimized LargeHashedCollection specially to perform better for large sets and dictionaries since the identity hash in Cog is only a few bits (around 12 I think).
So for the moment you can use use #identityHash, or even simpler, use IdentityDictionary instead of LargeIdentityDictionary and IdentitySet instead of LargeIdentitySet. 

Cheers,
Reply all
Reply to author
Forward
0 new messages