[Mono-list] mcs compiles on linux. Now what?

Paolo Molaro lupus@ximian.com
Sat, 9 Mar 2002 11:22:43 +0100

On 03/08/02 Serge wrote:
> If I understand it correctly this is how Object.GetHashCode is implemented
> in ORP.
> Each object has special 32-bit header stored in memory just before the
> object itself.
> Say if p_obj is java_lang_Object* then
>     uint32* p_header = (uint32*) p_obj;
>     --p_header;
> Upper bits of *p_header contain the hashcode.
> This hashcode calculated on demand and only once when Object.getHashCode()
> is called the first time. Special value 0 indicates not yet calculated (0
> also returned for null objects). It makes sure that calculated hashcode
> won't be 0.
> Hashcode calculated based on the current object's address (p_obj), but
> since it's calculated only once moving GC is not a problem.
> This is how it looks from the code, also I remember this is described in ORP
> presentation slides.
> The header has other purposes as well not only hashcode.

Thanks for the info Sergey!
I guess we'll do something like that when we'll enter the optimization
fase (or sooner if someone sends a patch to implement it:-).


lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better