Sébastien Doeraene <sjrdoera...@gmail.com> writes: > local X Y Z T in > X = 5 > Z = foo(Z bar Y) > T = foo(Z 3 true) > % Note: Y is still unbound > end
Thanks for the example; it makes it clear that you have made a choice I was not expecting. The following is not criticism: a choice of representation is a tradeoff, and certain tradeoffs work better for certain purposes, or certain people. I'll just state what I expected, what I think you did, and what I perceive certain consequences may be. If I am mistaken, I hope you can set me straight. The traditional choices of representation in a VM are: 1. (heavy) tag on data: the 1st word is a tag (type), the subsequent words are the contents of the aggregate; typically pointers to other data. 2. (light) tag on pointers: this is purely a memory optimization on top of (1) permitting: 2a. small immediate data (smallint, bool, char, ...) 2b. references to untagged data (e.g. cons) 2c. references to tagged data I was expecting you to go for (1), reserving the option of adding (2) should you ever feel the need later. Instead you went for (3): 3. (heavy) tag on pointers, permitting: 3a. small immediate data (but not as small as in 2a) 3c. references to untagged data (typically an aggregate) It seems to me that this doubles the memory requirements for any aggregate compared to (1). It also means that the tag for an aggregate is repeated everywhere it is referenced. Also, since you allow pointers into an aggregate, copying garbage collection may well end up being inflationary: if GC reaches a word hosted in an aggregate before the aggregate is itself GCed, it will create a non-hosted copy of that word in the TO heap; then when the aggregate is GCed, the embedded word in question will somehow have to refer to the copy previously made; but the net result, is that GC has created a TO heap with 1 more word that the FROM heap. IIRC, mozart (the old generation) also had this issue, but only for optimized unbound variables; it solved it by detecting embedding in an aggregate by scanning backwards for the aggregate's initial tag, and gcing the aggregate. But, since your aggregates are untagged, that option is not open to you. Cheers, --Denys _________________________________________________________________________________ mozart-hackers mailing list mozart-hackers@mozart-oz.org http://www.mozart-oz.org/mailman/listinfo/mozart-hackers