Submit your papersSubmit Now
For Enquiries: [email protected]
IIARD LogoIIARD

Subprogram Call Implementation and Runtime Stack Management: A Comparative Analysis of C, Java, Python, and Haskell

Adewole A.P., Adegboro, Wuraola Similoluwa, Chinoziem-Best Charles Chuka, Olorunfunmilayo Rachael Adesola, Aniekwe Uju Cynthia

Abstract

Programming languages differ significantly in how subprogram calls and runtime stack management are implemented, which reflects underlying variations in execution models, design philosophies, and performance objectives. This study systematically compares subprogram call implementation across four widely used languages: C, Java, Python, and Haskell — examining activation record structures, memory allocation strategies, scoping mechanisms, and closure support. The findings reveal that C uses a hardware-centric stack model that emphasises memory predictability and efficiency but does not permit closures or nested subprograms. Through the Java Virtual Machine, Java abstracts this approach, adding partial closure support and type safety at the expense of extra overhead. By allocating heapbased frame objects, Python completely deviates from the stack model, allowing for full closure and nested subprogram support at the expense of increased memory overhead and slower execution speeds. The most drastic change is found in Haskell, which uses heapallocated thunks and graph reduction to provide lazy evaluation. This allows for sophisticated functional programming patterns at the cost of a non-intuitive execution model that diverges fundamentally from traditional call-and-return semantics. These findings offer practical guidance for developers selecting languages for performance-critical or feature-rich applications, and for language designers making foundational decisions about runtime memory management strategies.

References

Aho, A. V., Lam, M. S., Sethi, R., & Ullman, J. D. (2006). Compilers: Principles, Techniques, and Tools (2nd ed.). Pearson. Bolz, C. F., & Tratt, L. (2022). The Impact of Meta-Tracing on Virtual Machine Design and Optimization. Journal of Systems Architecture. Bryant, R. E., & O'Hallaron, D. R. (2016). Computer systems: A programmer's perspective (3rd ed.). Pearson. Hutton, G. (2016). Programming in Haskell (2nd ed.). Cambridge University Press. Klabnik, S., & Nichols, C. (2023). Asynchronous Programming with Rust and Futures. O’Reilly Media. Lindholm, T., Yellin, F., Bracha, G., & Buckley, A. (2014). The Java virtual machine specification: Java SE 8 edition. Oracle/Addison-Wesley. https://docs.oracle.com/javase/specs/jvms/se8/html/ Ling, C., & Wang, Y. (2026). From dynamic to lexical: A comparative exploration of scoping rules in SAS and R. arXiv preprint arXiv:2601.09808. https://arxiv.org/abs/2601.09808 Marlow, S. (Ed.). (2010). Haskell 2010 language report. Haskell.org. https://www.haskell.org/onlinereport/haskell2010/ Mitchell, J., & Taha, W. (2016). Foundations of Programming Languages. Academic Press. Nanz, S., & Furia, C. A. (2015). A Comparative Study of Programming Languages. IEEE Transactions on Software Engineering. Peyton Jones, S. (2003). The Haskell 98 language and libraries: The revised report. Journal of Functional Programming, 13(1), 1–255. Python Software Foundation. (2024). The Python language reference (Version 3.12). https://docs.python.org/3/reference/ Scott, M. L. (2015). Programming Language Pragmatics (4th ed.). Morgan Kaufmann. Sebesta, R. W. (2012). Concepts of programming languages (10th ed.). Pearson. Silberschatz, A., Galvin, P. B., & Gagne, G. (2018). Operating System Concepts (10th ed.). Wiley.

More Articles from INTERNATIONAL JOURNAL OF COMPUTER SCIENCE AND MATHEMATICAL THEORY

Advances in Algorithmic Contract Scoring for Pre-Negotiation Yield Optimization and Risk Retention

Author: Ngozi Samuel Uzougbo, Michael Ominyi, Cyril Chimelie Anichukwueze, Blessing, Chika Jones

DevTest flow: Designing a Scalable Continuous Testing Pipeline for High-Velocity Software Delivery

Author: Lawal Ahmed Oladimeji, Achori Busayo, Akeju BusayoZainab, Saka Samson, Damilare, Mbah Demian Chidi, Runsewe Similoluwa Mayowa, Oladiti Luqman, Abiodun