Efficient dispatch of multi object polymorphic call sites in contextual role oriented programming languages
Adaptive software becomes more and more important as computing is increasingly context dependent. Runtime adaptability can be achieved by dynamically selecting and applying context specific code. Role oriented programming has been proposed as a paradigm to enable runtime adaptive software by design. Roles change the objects' behavior at runtime, thus adapting the software to a given context. The cost of adaptivity is however a high runtime overhead stemming from executing compositions of behavior modifying code. It has been shown that the overhead can be reduced by optimizing dispatch plans at runtime when contexts do not change, but no method exists to reduce the overhead in cases with high context variability. This paper presents a novel approach to implement polymorphic role dispatch, taking advantage of run time information to effectively guard abstractions and enable reuse even in the presence of variable contexts. The concept of polymorphic inline caches is extended to role invocations. We evaluate the implementation with a benchmark for role oriented programming languages achieving a geometric mean speedup of 4.0x (3.8x up to 4.5x) with static contexts, and close to no overhead in the case of varying contexts over the current implementation of contextual roles in Object Teams.
MPLR