SELF-PROFILING MECHANISMS FOR REAL-TIME CODE COMPILERS

Authors

  • M. Berdnyk
  • I. Starodubskyi

DOI:

https://doi.org/10.34185/1562-9945-5-161-2025-08

Keywords:

adaptive compilation, runtime optimization, self-profiling, LLVM, JIT compilation, performance

Abstract

This paper explores the concept of self-profiling compilers as a means of adaptive real-time code optimization. The approach relies on collecting dynamic performance metrics during program execution and analyzing the collected data to choose the most effective compilation strategies. We propose a compiler architecture capable of automatically detecting performance-critical code regions (hotspots), adjusting the configuration of optimization passes, and recompiling code with updated metrics. A prototype was implemented based on LLVM with an embedded runtime agent responsible for code instrumentation, metric collection, and interaction with a dynamic Pass Manager. A series of experiments were conducted across various hardware platforms, including desktop CPUs and ARM-based architectures. The results demonstrated significant performance gains without noticeable increases in compilation time or resource usage. These findings confirm the feasibility of integrating self-profiling into next-generation compilers targeting high-performance computing, edge systems, and mobile devices. The paper presents the concept of self-profiling as a tool for real-time code optimization. A prototype based on LLVM with embedded runtime analysis has been implemented. The results demonstrate the advantages of the proposed approach.

References

Muchnick, S. S. (1997). Advanced Compiler Design and Implementation. Morgan Kauf-mann.

Cooper, K. D., & Torczon, L. (2011). Engineering a Compiler (2nd ed.). Morgan Kauf-mann.

Aycock, J. (2003). A Brief History of Just-In-Time Compilation. Springer.

Tratt, L. (2021). Modern Compiler Implementation in a Post-LLVM World. Springer.

Parr, T. J. (2010). The Definitive ANTLR 4 Reference: Building Domain-Specific Lan-guages. Pragmatic Bookshelf.

Lattner, C., & Adve, V. (2004). LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. University of Illinois.

Jones, R., Hosking, A., & Moss, E. (2011). The Garbage Collection Handbook: The Art of Automatic Memory Management. Chapman & Hall/CRC.

Nystrom, R. (2021). Crafting Interpreters. Genever Benning.

Aho, A. V., Lam, M. S., Sethi, R., & Ullman, J. D. (2006). Compilers: Principles, Tech-niques, and Tools (2nd ed.). Addison-Wesley.

Appel, A. W. (1998). Modern Compiler Implementation in C. Cambridge University Press.

Downloads

Published

2025-12-05