[Vm-dev] Is it important to fill identity-hash for Floats?

Bert Freudenberg bert at freudenbergs.de
Mon Jul 29 22:23:43 UTC 2013

On 2013-07-29, at 23:59, Igor Stasenko <siguctua at gmail.com> wrote:

> just a thought..
> imo using identity hash field for instances of Float while probable,
> but in fact really impractical.
> in that sense, what you think about removing filling the identity hash field
> and leave it always == 0.. saving some instructions to make float
> allocation a bit faster?
> i am talking about
> genAllocFloatValue: dpreg into: resultReg scratchReg: scratch1
> scratchReg: scratch2

IMHO, turning Floats into the only objects in the system that cause severe collisions in IdentitySets / Dictionaries should not be done lightly. It's a step away from "every object is equal" which I think is an important principle.

The VM should only "cheat without getting caught", as Dan put it. And there are options for that. 

For example, the better our JIT gets, the less intermediate floats need to be allocated because you can avoid boxing/unboxing them altogether, so that's an even larger win.

And if we switched to immediate floats (e.g. in the 64 bit image format) the allocation issue would go away completely.

I'm still curious: Assuming you tried it already, what kind of speedup do you get?

- Bert -

More information about the Vm-dev mailing list