March 18, 2012
On 3/18/12 11:18 AM, Michel Fortin wrote:
> On 2012-03-18 15:53:42 +0000, deadalnix <deadalnix@gmail.com> said:
>
>> Le 18/03/2012 16:30, Andrei Alexandrescu a écrit :
>>> On 3/18/12 10:19 AM, Timon Gehr wrote:
>>>> No null checks are necessary as long as there is no class that would
>>>> create such a very large object.
>>>
>>> Yah, we need to insert a rule that prevents creating class objects
>>> larger than 64KB. Java has the same.
>>>
>>> Andrei
>>
>> This is another solution. In this case, we have to ensure that the
>> first 64kb of the system are page protected to detect null pointer
>> deference in druntime.
>
> On Mac OS X, the protected area is much smaller. 4 Kb I think on Snow
> Leopard 32-bit.

I realized I was mistaken. Just looked at http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#88659 and it seems the number of fields added by a class is limited to 64K, but that's fields not bytes and does not count the fields of the base class.

In order to be safe, a D implementation must figure what is the protected area size and insert null checks for all fields accesses that go beyond that.


Andrei
1 2
Next ›   Last »