Check out the new USENIX Web site. next up previous
Next: Scenario C Revisited: Binary Up: Example Revisited: Programmer & Previous: Scenario A Revisited: Adding


Scenario B Revisited: Removing a Method

In Scenario B, we removed the method eat from class Programmer. Although this is an incompatible change, the program is still supposed to run as long as the removed method is not invoked. In class Manager, if we execute a method invocation Jerry.eat, the program will execute as usual. However, if we execute Tom.eat, an exception should be raised.

In our solution (Figure 8), after class Programmer is loaded, there would be no information about method eat in the global allocation table. However in Manager, which expected a method eat from class Programmer, there is an offset table entry which expects an offset for method eat. In this case we put 0 in the offset table entry. In the actual vtable of any class, the entry at offset 0 is always set to point to some specific code that would raise proper exceptions when invoking the Tom.eat method at run time. However, things will be as usual if Jerry.eat is executed, because eat does occur in the global allocation table entry of JavaProgrammer.

Figure 8: Scenario B revisited: removing a method.


next up previous
Next: Scenario C Revisited: Binary Up: Example Revisited: Programmer & Previous: Scenario A Revisited: Adding
Dachuan Yu 2002-05-23