How common will this be ? I would think its very rare for an internal
referenced to be modified . Most of the time its a value type so copied ,
in your case of a building a large array of objects and then an external
object handing out the references you need to hold a reference to the array
to doll out the references but i dont think its a common use case.
I would however like to see the compiler generate access to the array as
base + offset just like it does with all value types in an object without
the need to hold any internal reference. eg
Class Wrapper {
Point point ;
Point[2] line;
this.point.Y ( for allign 4 and this in eax) becomes
mov r1, [eax+4 or 8]
this.line[1].Point.X becomes
mov r1, [eax+16 or +32]
Even strings are fine
Class Wrapper {
String[] lookups;
this.lookups[1] becomes
mov r1, [eax+4 or +8]
Note you now have a pointer to string which is a genuine reference.
The only time you need to hand out an internal reference is when you store
the offset ( internal ref ) in an external object ( you dont need it for
anything working on this). And only if this is modified do you incur a
"slight" penalty. Compared to the ubiquitious card table write barrier
the above is cheap . And i still have the conceptual problem in say OO
design with taking a reference for a value type its a nice optomization
but should not be common after all we spent a lot of effort making ref
objects cheap.
Ben
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev