Fix bugs for interfaces. \n\nFor methods declared in interfaces, there always need...
authorjzhou <jzhou>
Fri, 4 Mar 2011 02:30:57 +0000 (02:30 +0000)
committerjzhou <jzhou>
Fri, 4 Mar 2011 02:30:57 +0000 (02:30 +0000)
commit2ee44b1800a2a89d578a8440433c5f37ae204787
tree7e0369b9e972ee4f2b21d904814cacb8daf48b02
parent3ad6a49a28d6768a6bbbd38c3fea80bc4ea59b16
Fix bugs for interfaces. \n\nFor methods declared in interfaces, there always need virtual dispatch.\n\n The other bug is that previously the method numbering strategy always start from 0 when numbering a class'es method.  When there are no interfaces, all classes form a tree with Object as the root and the numbering works fine.  But with interfaces, the inherit hierachy would no longer be a tree and there will have serious problems.  #0 would be always assigned to some method of Object and every interfaces.  If a Class implements any interfaces, it would have at least two methods with #0 and it would only be able to access one of it and lose the others.  Also we need to make sure that each method of a interface should have a distinguished number so that when a class implements multiple interfaces, it would not lose access of any of the methods defined in the interfaces.  So when numbering the methods in Virtual, we first numbering all the methods in the interfaces and give them a distinguished number. Then we numbering the classes and start from the following number.  As interfaces could have methods with the same name, a method in a class could match multiple entries in its super interfaces/classes.  We record all these entries in order to fill in the virtual table correctly
Robust/src/ClassLibrary/Integer.java
Robust/src/ClassLibrary/MGC/gnu/TreeMap.java
Robust/src/ClassLibrary/MGC/gnu/TreeSubMap.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Virtual.java