Re: proposal for call_ and str_
"Mark Hahn" <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Laurent Dube wrote:
> I'd love to see all this in a diagram:
>
> object, prototype, class, instance, factory, type, metaclass, etc.
>
> If you can draw the first sketch, I can maintain it as the discussion
> evolves. I'm the visual kind.
I'm lousy at sketches. How about I describe them and you turn them into
visuals. Maybe I'll throw in some ascii art. I can put them on the web
site and use them in my Vancouver talk (giving you credit of course).
I'll start with an object. It has four parts, the misc flags, the proto
list, the attributes and the binary data.
Misc flags takes one four-byte word, proto_attr_ptr takes another word, and
data takes eight bytes (type and imm-length are actually in misc flags) for
a total of sixteen bytes minimum per object.
misc flags
garbage collector state
access privelages
read
write
cloneable
mutable
archived
has_proto_attr_alloc
locks
delete_locked
readlock_count
writelock_request_count
semaphore
proto_attr_ptr
data
type
immediate_length
immediate_data_or_ptr
If has_proto_attr_alloc is false then proto_attr_ptr points to the single
prototype for the object and the object has no attributes. If
has_proto_attr_alloc is true, then proto_attr_ptr points to a seperately
allocated data structure that holds the prototype list and the attribute
dictionary.
Data type can be NONE, IMMEDIATE, PTR, or FUNCTION. If it is IMMEDIATE then
the data is stored in the 8-bytes in the object in immediate_data_or_ptr.
If it is PTR or FUNCTION then immediate_data_or_ptr is a pointer to the data
or C function.
So an object occupies from one two three allocated chunks of memory
depending on whether it has more than one prototype, any attributes, any
binary data longer than eight bytes, or represents a C function.
Can you make a visual out of this?