On Wed, Nov 13, 2013 at 10:18 PM, Jonathan S. Shapiro <[email protected]>wrote:

> On Wed, Nov 13, 2013 at 6:05 AM, Ben Kloosterman <[email protected]>wrote:
>
>> On Tue, Nov 12, 2013 at 11:03 PM, Jonathan S. Shapiro 
>> <[email protected]>wrote:
>>
>>> 2. Stack is modeled as a non-dense linear sequence of bump-allocated
>>> objects. Non-reference data may intervene between these objects. The cost
>>> of this is that per-line metadata must be maintained so that object start
>>> positions can be located.
>>>
>>
>>> I kind of favoured this at first but if you have a 32 bit Vtable these
>> can be put down in 1 word  which will not be much more than setting a bit
>> and a bit set will be an add for reference using methods.
>>
>
> Unfortunately not. There is a computation needed to find the metadata
> byte, and then a second computation to determine which bit to set. The bit
> tracking idea definitely has marginal overhead.
>

 The metadata "type"   should just be a static address ( could even be
written as a header to the call location) .  Yes there are is a cost here
being  the offset , and some shifts for the current stack address. That
said  I agree its more expensive , i think even in this case putting the
pointer to the meta data bits is better than copying them  ( though allow
null)  so the cost does not get huge if there are a lot of references and
you dont need to calculate the bitpage offset.


>
>
>> Its important to note we are talking about function as objects here as
>> you say.
>>
>
> I wasn't talking about functions as objects. I was talking about the
> structure of the stack.
>

I know .. but the term object on stack is confusing to me ,  we really have
functions / procedures as objects on the stack.


>
>
>>  Obviously you have to handle end of block /start of block (probably
>>> dummy calls that do nothing with a header).
>>>
>>
> I wasn't assuming a size-alterable stack. That's a separate issue.
>
>

Neither was I .. but if you use 32 bits as offset to next / previous block
  you need to handle  the fact that blocks can be more than 32 bits apart.
This adds an offset calculation which i think is cheaper than adding a 64
bit word .



key choices are

- Marking every "Object" vs only reference free objects. The advantage of
adding a vtable pointer to a meta data structures is great for  debug /
crashes and knowing what types are on the stack since most methods should
be able to state what types they belong to  (though this doesnt work as
well with generic types and a a a Haskel like type system ) . Also the
amount of methods that have references is crucial in a Java /C# type system
most methods will have a "this" reference and static methods will be
uncommon .  If  referenceless types are rare then you may as well put a
header on everything.
- If you dont have a vtable for all whether to use a 32 bit offset vs a 64
bit address.
- Variable sized stack
- Exception handling

It gets messy either way if the stack block size  ( or remaining size) is
not big enough  to handle the largest possible procedure calls  .. 4K is
too small , even 8K is pushing it as the minimum.

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

Reply via email to