Here are some basic ideas on how to build plugins for Eiffel systems.

Given the following code:

create a.make (4)
a.something_polymorphic (x, y)

This code is by default generated as follow in two different systems.

  • System A:
a = RTLN (25);
F1_24 (a, 4);
(R1_25 (a - min_xx))(a, x, y);
  • System B:
a = RTLN (23455);
F234_394 (a, 4);
(R234_234 (a - min_yy))(a, x, y);

So if we want the code of A, the plugin, to be executed properly in the context of B, we need to patch the code of A. Currently this means replacing the ID for the creation (i.e. 25), the address for the static call (i.e. F1_24) and the table content to reflect the new polymorphic call (i.e. R1_25).

  1. For static calls, they have to be replaced by an indirect call through a variable which is initially set to F1_24. But upon loading this variable can be changed into F234_394 if the call is still static, or otherwise to a stub that will call the right routine via our polymorphic table.
  2. Changing the content of the polymorphic table should be pretty easy, the only thing is that one cannot easily do the optimization of the minimum entry in the code generated for the plugin.