On Sun, Jan 12, 2014 at 8:50 PM, William ML Leslie <
[email protected]> wrote:

> On 12 January 2014 22:41, Ben Kloosterman <[email protected]> wrote:
>


> >   Will moving between heap and stack here result in worse
> > performance ? Should interfaces wrapping heap objects always be
> allocated on
> > the heap ?
>
>

> Interfaces never really want to live on the heap.  If implemented as
> pairs of (this ref, vtable ref), it's cheaper to pass this around as a
> well-typed unboxed value than to stick it in the heap where it needs
> metadata to describe its allocation, as well as possibly a header for
> RTTI.
>

Yes. And because interfaces are deep-constant, we don't need to worry about
reference equality on them. If needed, we can "fake" EQ as a special case.


> > Also what about interfaces to internal value objects  ?
>
> Are you asking about objects whose allocation is maintained outside
> the runtime, or values living unboxed within some other value?
>

An interface to an unboxed member of a boxed container is effectively an
interior pointer to the containing boxed object. No big deal there.

An interface to a value whose allocation is maintained outside the runtime
is no more or less difficult than a managed pointer or object reference to
a similar value. Think of an interfaces as a pair consisting of a managed
pointer and an opaque constant value (the ifTable pointer). It's just
another managed reference.

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

Reply via email to