Preview

Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS)

Advanced search

Fast Calls and In-Place Expansion: A Hybrid Strategy for VM Intrinsics

https://doi.org/10.15514/ISPRAS-2025-37(6)-7

Abstract

This research proposes a hybrid approach for implementing performance-oriented compiler intrinsics. Compiler intrinsics are special functions that provide low-level functionality and performance improvements in high-level languages. Current implementations typically use either in-place expansion or call-based methods. In-place expansion can create excessive code size and increase compile time but it can produce more efficient code in terms of execution time. Call-based approaches can lose at performance due to call instruction overhead but win at compilation time and code size. We survey intrinsics implementation in several modern virtual machine compilers: HotSpot Java Virtual Machine, and Android RunTime. We implement our hybrid approach in the LLVM-based compiler of Ark VM. Ark VM is an experimental bytecode virtual machine with garbage collection and dynamic and static compilation. We evaluate our approach against in-place expansion and call approaches using a large set of benchmarks. Results show the hybrid approach provides considerable performance improvements. For string-related benchmarks, the hybrid approach is 6.8% faster compared to the no-inlining baseline. Pure in-place expansion achieves only 0.7% execution time improvement of the hybrid implementation. We explore two versions of our hybrid approach. The "untouched" version lets LLVM control inlining decisions. The "heuristic" approach was developed after we observed LLVM's tendency to inline code too aggressively. This research helps compiler developers balance execution speed with reasonable code size and compile time when implementing intrinsics.

About the Authors

Denis Vladislavovich ZAVEDEEV
Ivannikov Institute for System Programming of the Russian Academy of Sciences
Russian Federation

Postgraduate student at Ivannikov Institute for System Programming of the Russian Academy of Sciences. Research interests: compilers, language virtual machines.



Roman Aleksandrovich ZHUYKOV
Ivannikov Institute for System Programming of the Russian Academy of Sciences
Russian Federation

Senior researcher in Compiler Technology department at ISP RAS. Research interests: static and dynamic program optimization, compiler technologies.



Leonid Vladlenovich SKVORTSOV
Ivannikov Institute for System Programming of the Russian Academy of Sciences
Russian Federation

Researcher in Compiler Technology department. Research interests: compiler technologies, optimizations.



Mikhail Vyacheslavovich PANTILIMONOV
Ivannikov Institute for System Programming of the Russian Academy of Sciences
Russian Federation

Researcher at Compiler Technology department of ISP RAS. Research interests: static analysis, compiler technologies, DBMS.



References

1. Dehghani A. HotSpot Intrinsics. https://alidg.me/blog/2020/12/10/hotspot-intrinsics (accessed May 14, 2025).

2. Damásio T., Pacheco V., Goes F., Pereira F., and Rocha R. Inlining for Code Size Reduction. In Proceedings of the 25th Brazilian Symposium on Programming Languages (SBLP '21), Association for Computing Machinery, New York, NY, USA, 2021. doi: 10.1145/3475061.3475081

3. The LLVM Project. https://llvm.org/ (accessed May 20, 2025).

4. ArkCompiler Runtime Core: Static Core. https://gitee.com/openharmony/arkcompiler_runtime_core/tree/master/static_core (accessed May 14, 2025).

5. Oracle. Java Virtual Machine Technology Overview. https://docs.oracle.com/en/java/javase/21/vm/java-virtual-machine-technology-overview.html (accessed May 20, 2025).

6. Android Open Source Project. Android runtime and Dalvik. https://source.android.com/docs/core/runtime (accessed May 20, 2025).

7. HotSpot Runtime Overview: Interpreter. https://openjdk.org/groups/hotspot/docs/RuntimeOverview.html#Interpreter|outline (accessed May 14, 2025).

8. ARM Software. Procedure Call Standard for the Arm® 64-bit Architecture (AArch64): The Base Procedure Call Standard. https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#the-base-procedure-call-standard (accessed May 14, 2025).

9. Android RunTime (ART) ARM64 sin Entrypoint Initialization. https://cs.android.com/android/platform/superproject/main/+/main:art/runtime/arch/arm64/entrypoints_init_arm64.cc;l=187;drc=0e8091312485670e84ee17daf25256e5836112b0 (accessed May 14, 2025).

10. HotSpot Stub Generator for x86_64 sin Function. https://github.com/openjdk/jdk/blob/jdk-21%2B35/src/hotspot/cpu/x86/stubGenerator_x86_64_sin.cpp (accessed May 14, 2025).

11. Android RunTime (ART) Compiler. HArrayLength instruction https://cs.android.com/android/platform/superproject/main/+/main:art/compiler/optimizing/nodes.h;l=6463;drc=621d1350d431ed0cc3d4a5a43a079adc1d86a31f (accessed May 14, 2025).

12. HotSpot C2 MacroAssembler for x86: Arrays Equals. https://github.com/openjdk/jdk/blob/60a4594b9f9acd82ef3ff22fc6a2df238dd981b9/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L4377 (accessed May 14, 2025).

13. Android RunTime (ART) ARM64 Intrinsics. StringEquals encoding. https://cs.android.com/android/platform/superproject/main/+/main:art/compiler/optimizing/intrinsics_arm64.cc;l=2288;drc=9c2a0a8bfc5369a110956ac26cf9cf145a6a4bb7 (accessed May 14, 2025).

14. Löff J., Schiavio F., Rosà A., Basso M., and Binder W. Vectorized Intrinsics Can Be Replaced with Pure Java Code without Impairing Steady-State Performance. In Proceedings of the 15th ACM/SPEC International Conference on Performance Engineering (ICPE '24), Association for Computing Machinery, New York, NY, USA, 2024, pp. 14–24. doi: 10.1145/3629526.3645051

15. ArkCompiler Runtime Core: VM Benchmarks. https://gitee.com/openharmony/arkcompiler_runtime_core/tree/OpenHarmony_feature_20241108/static_core/tests/vm-benchmarks (accessed May 14, 2025).


Review

For citations:


ZAVEDEEV D.V., ZHUYKOV R.A., SKVORTSOV L.V., PANTILIMONOV M.V. Fast Calls and In-Place Expansion: A Hybrid Strategy for VM Intrinsics. Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS). 2025;37(6):121-134. https://doi.org/10.15514/ISPRAS-2025-37(6)-7



Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.


ISSN 2079-8156 (Print)
ISSN 2220-6426 (Online)