Difference between revisions of "Plugins"
(New page: Here are some basic ideas on how to build plugins for Eiffel systems. Given the following code: <e>a: STRING create a.make (4) a.something_polymorphic (x, y) </e> This code is by defaul...) |
|||
(One intermediate revision by the same user not shown) | |||
Line 13: | Line 13: | ||
<c>a = RTLN (25); | <c>a = RTLN (25); | ||
F1_24 (a, 4); | F1_24 (a, 4); | ||
− | (R1_25 (a))(a, x, y); | + | (R1_25 (a - min_xx))(a, x, y); |
</c> | </c> | ||
Line 19: | Line 19: | ||
<c>a = RTLN (23455); | <c>a = RTLN (23455); | ||
F234_394 (a, 4); | F234_394 (a, 4); | ||
− | (R234_234 (a))(a, x, y); | + | (R234_234 (a - min_yy))(a, x, y); |
</c> | </c> | ||
+ | |||
+ | 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). | ||
+ | |||
+ | #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. | ||
+ | #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. |
Latest revision as of 01:18, 28 June 2011
Here are some basic ideas on how to build plugins for Eiffel systems.
Given the following code:
a: STRING 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).
- 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.
- 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.