Updated: 3/13/2003; 2:20:18 PM.
IKVM.NET Weblog
The development of a Java VM for .NET
        

Monday, August 19, 2002
This weblog has moved to http://weblog.ikvm.net/

I changed the XML remapping language to support Object.hashCode() & Object.toString() twiddling (see this previous posting for more info). It is now possible to specify which CIL code sequence should be substituted for a call to a method. Here is how Object.hashCode() looks:

<method type="instance" name="hashCode" sig="()I" access="public">
 
<override name="GetHashCode" />
  
<invokespecial>
   
<call class="System.Object name="GetHashCode" />
 
</invokespecial>
 
<invokevirtual>
   
<dup />
   
<isinst class="System.String" />
   
<brfalse name="skip" />
   
<call class="StringHelper" name="hashCode" />
   
<br name="end" />
   
<label name="skip" />
   
<callvirt class="System.Object name="GetHashCode" />
   
<label name="end" />
 
</invokevirtual>
</method>

Every virtual call (the invokevirtual bytecode) is converted into a test to see if the call is being done on a string, if so it calls StringHelper.hashCode(), if not, it calls System.Object.GetHashCode(). This isn't yet how it should be, because when it is known at compile time that the reference that hashCode() is called on isn't a string, then this test shouldn't be emitted. I still have to figure out a way to support this optimization.

Updated the binaries and source snaphots.


1:53:35 PM    Comments

© Copyright 2003 Jeroen Frijters.
 
August 2002
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Jul   Sep