Abstract
The context-aware composition approach (CAC) has shown to improve the performance of object-oriented applications on modern multi-core hardware by selecting between different (sequential and parallel) component variants in different (call and hardware) contexts. However, introducing CAC in legacy applications can be time-consuming and requires quite some effort for changing and adapting the existing code. We observe that CAC-concerns, like offline component variant profiling and runtime selection of the champion variant, can be separated from the legacy application code. We suggest separating and reusing these CAC concerns when introducing CAC to different legacy applications.
For automating this process, we propose an approach based on Aspect-Oriented Programming (AOP) and Reflective Programming. It shows that manual adaptation to CAC requires more programming than the AOP-based approach; almost three times in our experiments. Moreover, the AOP-based approach speeds up the execution time of the legacy code, in our experiments by factors of up to 2.3 and 3.4 on multi-core machines with two and eight cores, respectively. The AOP based approach only introduces a small runtime overhead compared to the manually optimized CAC approach. For different problems, this overhead is about 2-9% of the manual adaptation approach.
These results suggest that AOP-based adaptation can effectively adapt legacy applications to CAC which makes them running efficiently even on multi-core machines.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-oriented programming. Journal of Obj. Tech. 7(3), 125–151 (2008)
Costanza, P., Hirschfeld, R.: Language constructs for context-oriented programming: an overview of contextl. In: Proc. of the 2005 Symp. on Dynamic Lang. DLS 2005, pp. 1–10. ACM, New York (2005)
David, P.-C., Ledoux, T.: WildCAT: a generic framework for context-aware applications. In: Proc. of the 3rd Int. Workshop on Middleware for Pervasive and Ad-hoc Computing. MPAC 2005, pp. 1–7. ACM, NY (2005)
McKinley, P.K., Sadjadi, S.M., Kasten, E.P., Cheng, B.H.C.: Composing adaptive software. Computer 37, 56–64 (2004)
Tanter, É., Gybels, K., Denker, M., Bergel, A.: Context-Aware Aspects. In: Löwe, W., Südholt, M. (eds.) SC 2006. LNCS, vol. 4089, pp. 227–242. Springer, Heidelberg (2006)
Gamma, E., Helm, R., Johnson, R.E., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)
Danylenko, A., Kessler, C., Löwe, W.: Comparing Machine Learning Approaches for Context-Aware Composition. In: Apel, S., Jackson, E. (eds.) SC 2011. LNCS, vol. 6708, pp. 18–33. Springer, Heidelberg (2011)
Kiczales, G., Lamping, J., Mendhekar, A., Maeda, C., Lopes, C.V., Loingtier, J.-M., Irwin, J.: Aspect-Oriented Programming. In: Aksit, M., Auletta, V. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 220–242. Springer, Heidelberg (1997)
Kandé, M.M., Kienzle, J., Strohmeier, A.: From AOP to UML—A bottom-up approach. In: Workshop on Aspect-Oriented Modeling with UML (March 2002)
Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms. The MIT Press, New York (2001)
Schilit, B., Adams, N., Want, R.: Context-aware computing applications. In: Proc. of the 1994 First Workshop on Mobile Comp. Systems and Applications, pp. 85–90. IEEE Computer Society, Washington, DC (1994)
Lyons, K., Want, R., Munday, D., He, J., Sud, S., Rosario, B., Pering, T.: Context-aware composition. In: HotMobile (2009)
Delicato, F.C., Santos, I.L.A., Pires, P.F., Oliveira, A.L.S., Batista, T., Pìrmez, L.: Using aspects and dynamic composition to provide context-aware adaptation for mobile applications. In: Proc. of the 2009 ACM Symp. on Applied Computing. SAC 2009, pp. 456–460. ACM, New York (2009)
Baresi, L., Bianchini, D., Antonellis, V.D., Fugini, M.G., Pernici, B., Plebani, P.: Context-aware composition of e-services. In: Proc. of VLDB Workshop on Technologies for E-Services, pp. 7–8 (2003)
von Löwis, M., Denker, M., Nierstrasz, O.: Context-oriented programming: beyond layers. In: Proc. of the 2007 Int. Conf. on Dynamic Lang.: in Conjunction with the 15th Int. Smalltalk Joint Conf. 2007, pp. 143–156. ACM, New York (2007)
Andersson, J., Ericsson, M., Kessler, C.W., Löwe, W.: Profile-Guided Composition. In: Pautasso, C., Tanter, É. (eds.) SC 2008. LNCS, vol. 4954, pp. 157–164. Springer, Heidelberg (2008)
Kessler, C., Löwe, W.: A framework for performance-aware composition of explicitly parallel components. In: PARCO, pp. 227–234 (2007)
Kessler, C., Löwe, W.: Optimized composition of performance-aware parallel components. Concurrency and Computation: Practice and Experience (2011)
Whaley, C., Petitet, A., Dongarra, J.J.: Automated empirical optimization of software and the atlas project. Parallel Computing 27, 2001 (2000)
Frigo, M., Johnson, S.G.: The design and implementation of FFTW3. Proceedings of the IEEE 93(2), 216–231 (2005)
Moura, J.M.F., Johnson, J., Johnson, R.W., Padua, D., Prasanna, V.K., Püschel, M., Singer, B., Veloso, M., Xiong, J.: Generating platform-adapted DSP libraries using SPIRAL. In: High Performance Embedded Computing, HPEC (2001)
Moura, J.M.F., Johnson, J., Johnson, R.W., Padua, D., Prasanna, V.K., Püschel, M., Veloso, M.: SPIRAL: Automatic implementation of signal processing algorithms. In: High Performance Embedded Computing, HPEC (2000)
Bala, V., Duesterwald, E., Banerjia, S.: Dynamo: a transparent dynamic optimization system. SIGPLAN Not. 35(5), 1–12 (2000)
Gal, A., Eich, B., Shaver, M., Anderson, D., Mandelin, D., Haghighat, M.R., Kaplan, B., Hoare, G., Zbarsky, B., Orendorff, J., Ruderman, J., Smith, E.W., Reitmaier, R., Bebenita, M., Chang, M., Franz, M.: Trace-based just-in-time type specialization for dynamic languages. SIGPLAN Not. 44, 465–478 (2009)
Bebenita, M., Brandner, F., Fähndrich, M., Logozzo, F., Schulte, W., Tillmann, N., Venter, H.: Spur: a trace-based jit compiler for cil. In: OOPSLA, pp. 708–725 (2010)
Zaleski, M., Brown, A.D., Stoodley, K.: Yeti: a gradually extensible trace interpreter. In: Proc. of the 3rd Int. Conference on Virtual Execution Environments. VEE 2007, pp. 83–93. ACM, New York (2007)
Gal, A., Probst, C.W., Franz, M.: HotpathVM: an effective jit compiler for resource-constrained devices. In: Proc. of the 2nd Int. Conf. on Virtual Execution Environments. VEE 2006, pp. 144–153. ACM, New York (2006)
Brewer, E.A.: High-level optimization via automated statistical modeling. In: PPoPP 1995 (1995)
Ansel, J., Chan, C.P., Wong, Y.L., Olszewski, M., Zhao, Q., Edelman, A., Amarasinghe, S.P.: PetaBricks: a language and compiler for algorithmic choice. In: Proc. ACM SIGPLAN Conf. on Progr. Language Design and Implem., pp. 38–49. ACM (2009)
Wernsing, J.R., Stitt, G.: Elastic computing: a framework for transparent, portable, and adaptive multi-core heterogeneous computing. In: Proc. ACM Conf. on Lang., Compilers, and Tools for Embedded Systems (LCTES 2010), pp. 115–124. ACM (2010)
Li, X., Garzarán, M.J., Padua, D.: A dynamically tuned sorting library. In: Proc. CGO 2004, pp. 111–124 (2004)
Yu, H., Rauchwerger, L.: An adaptive algorithm selection framework for reduction parallelization. IEEE Trans. Par. Distr. Syst. 17, 1084–1096 (2006)
Thomas, N., Tanase, G., Tkachyshyn, O., Perdue, J., Amato, N.M., Rauchwerger, L.: A framework for adaptive algorithm selection in STAPL. In: Proc. ACM SIGPLAN Symp. on Princ. and Pract. of Parallel Programming, pp. 277–288. ACM (June 2005)
Olszewski, M., Voss, M.: An install-time system for the automatic generation of optimized parallel sorting algorithms. In: Proc. PDPTA 2004, vol. 1 (June 2004)
Li, L., Liu, D., Bouguettaya, A.: Semantic based aspect-oriented programming for context-aware web service composition. Inf. Syst. 36, 551–564 (2011)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Danylenko, A., Löwe, W. (2012). Adaptation of Legacy Codes to Context-Aware Composition Using Aspect-Oriented Programming. In: Gschwind, T., De Paoli, F., Gruhn, V., Book, M. (eds) Software Composition. SC 2012. Lecture Notes in Computer Science, vol 7306. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-30564-1_5
Download citation
DOI: https://doi.org/10.1007/978-3-642-30564-1_5
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-30563-4
Online ISBN: 978-3-642-30564-1
eBook Packages: Computer ScienceComputer Science (R0)