# Thursday, August 22, 2002
« No Title | Main | No Title »
No Title

Stuart commented:

You can also optimize the test away (in the other direction) if it's known at compile time that the object *is* a string. Or is that unnecessary since String provides its own GetHashCode implementation that will be invokespecialed already since it's a final class (or whatever the CLR equivalent of final is)?

When you compile the Java code "foo".hashCode() it will be compiled as an invokevirtual java/lang/String/hashCode()I. When IK.VM.NET tries to compile this, it looks up the hashCode() method on String and finds that it should redirect to the static StringHelper.hashCode() method. So that's automatic. It is possible to create bytecode that does an invokevirtual java/lang/Object/hashCode() on a string reference, but Java compilers won't do this, so this is hardly worth optimizing.

Thursday, August 22, 2002 12:49:57 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [1]
Thursday, August 22, 2002 1:43:16 AM (W. Europe Daylight Time, UTC+02:00)

Seems like building got a little more complicated (I don't seem to pick up your build options from your .sln file, and while before it was just a matter of turning on the unsafe option, it seems I need to do more than that now, like add some references, and I can't figure out which ones). I don't have enough time to do any serious investigation.

I'd love to play with ikvmc and netexp, though - any chance of including them in ikvmbin.zip?

Comments are closed.