Ticket #309 (closed enhancement: fixed)
Revise implicit team activation
| Reported by: | stephan | Owned by: | stephan |
|---|---|---|---|
| Priority: | major | Milestone: | OTDT_1.4.0_M1 |
| Component: | language | Version: | 1.3.1 |
| Keywords: | Cc: |
Description
The language definition states that "when the control flow is passed to a team or one of its roles, the team is implicitly activated for the current thread (OTJLD §5.3)."
This approach entails two difficulties:
- It is not easily possible to determine those exact method calls where the control flow actually enters the team, because such analysis would require both the caller and the callee to be available at the same point.
- Weaving implicit team activation into all methods that could mark entering the team causes performance penalties both during weaving and during execution.
As an example for difficulties arising from the first item, consider this program fragment:
public class MyBase { public void bm1() { /*...*/; bm2(); /*...*/ } public void bm2() { /*...*/ } } public team class MyTeam { public class MyRole playedBy MyBase { rm1 -> bm1; rm2 <- replace bm2; callin void rm2() { MyTeam.this.deactivate(); rm1(); MyTeam.this.activate(); } } }
The intention here was to intercept base method bm2() and during the execution of rm2() invoke another base method (bm1()). Because bm1() calls bm2() attempt is made to inhibit the recursion back into the callin method by temporarily deactivating the team. However, this program does not work as intended, because the callout method rm1() is actually a public method (inherits public-ness from its base method bm1()), and as a public role method it implicitly activates the team -- thus the statement MyTeam.this.deactivate() is effectless and infinit recursion is entered.
As a solution to both issues I propose to change implicit activation as follows:
- Implicit activation should become configurable, e.g., using a new annotation @ImplicitActivation. This annotation can be attached to individual methods or a class. In the latter case it applies to all contained methods that can be called from outside the team (judging by the visibility rules for methods of a team or a role).
- By changing the default behavior to no implicit activation, the bulk of all OT/J programs could be sped up significantly.
The proposal implies a change in the language semantics, i.e., existing programs may show different behavior after the change. However, it appears that implicit activation is a feature that very few programs actually make use of.
This ticket is targeted for next yearly release, so clients have time to consider the implication of the change, and perhaps even vote against the change.
all news
RSS feed