On Thu, Oct 31, 2013 at 10:56 AM, William ML Leslie <
[email protected]> wrote:

> On 31 October 2013 12:26, Ben Kloosterman <[email protected]> wrote:
> > Here you can map the data onto C but you have variable sized object
> header..
> >
> > Obj Header
> > Field1
> > Internal Header 1..
> > Value type  1
> > Internal Header 2..
> > Value type  2
> > Field 3
> >
> > Here you cant map the whole object onto a C object  ( or say a network
> > packet header) as the C object doesnt have the header so you need fancy
> > marshalling avoiding it is one of the main drivers for embedded nonboxed
> > arrays .
>
> References to C value types are not garbage collected, at least, not
> directly; so there is no problem here.
>
>
> I wasnt refering to interop how it relates to the GC but the fact that if
you have a native structure you cant setup a strucure that matches it and
then cast the header as a immutable typed reference.. .if you dont have a
1:1 representation. . You then have to copy everything to the GC and
Marshal it - probably the major obstacle with C# in being used at more low
level . Consider writing out a page table /LDT /GDT .  Even if you copy it,
it is MUCH more eficient to have a 1:1 representation without headers
interspersed.

Also note you can never  have an internal reference to an value  object in
the array ( well you could but it wouldnt be clever) so you still need a
slice mechanism.

For this reason i think Shap  means add the sub headers to the main object
header.. ( which is why he was talking about finding the object start) .
This however has its own negatives .. Structure is probably

Sub Object Headers.
Vtable
GC Header
Obj Header
Object

So common things are still headerAddress minus a constant.

Negatives
- More complicated size calcs.
-  Header and object could be located far apart spaning cache lines or even
pages. eg an object with a mid to large array and a value / second array
after it. Or a whole tree of objects .
- Finding the header  ( As Shap said prob best way is get the line and scan
backwards but you could have a large object so you may need to walk
multiple lines ( which is cheap due to the wrap flag)   )
- And we talked about header cost already a small object with a Point in it
would require a sub header for the point if you can take an internal
reference to it..  you could only have internal reference to sub arrays.

Talking Internal reference doesnt extend to native value types like int .
So maybe it can be more restrictive.


>
> Discussions of barriers and GC I'm still meditating on.
>

meditating is the right word... :-)

Ben
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to