help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Adding data to OOPs


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Adding data to OOPs
Date: Mon, 05 Jul 2004 10:01:53 +0200
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)

Unfortunately, this is out of discussion. You are wasting up to 33% more space for every object (33% for FloatEs and short strings, 25% for FloatDs, Points and Associations, ...).

And it should be alright from here, with mst_Object and gst_object_header
being sized somewhat correctly for GST memory management. As you can see it
is a Smalltalk <-> Objective-C bridge I developed, which I am moving almost
directly into GST for this project. Actually, it would be ince if objClass
was the first, and could transparently act as OOP class and ObjC Class...

If you can manage to do so this is fine.

If you really need the pointer to come first, allocate Objective-C objects with malloc (in FixedSpace, so they do not move across GC's and the GC does not need to walk them), reserve 4 more bytes than necessary, put your objc_class* there, return to Smalltalk the pointer to objSize, and add a new mapping to the C call-out mechanism that adjusts back the pointer to point to the objc_class*.

The idea of bridging GST and Objective-C has came up a few times in the past and is indeed a good one, but it needs to be as little invasive as possible. For example, the Java bridge in Smalltalk 2.1e requires *no* change to the VM that was not desirable on its one (the only change required was the implementation of variable classes for values other than unsigned 8- and 32-bit integers).

Paolo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]