ABSTRACT
The RISC-V Instruction Set Architecture (ISA) is an open-source, modular and extensible ISA. The ability to add new instructions into a dedicated core opens up perspectives to accelerate VM components or provide dedicated hardware IPs to applications running on top. However, the RISC-V ISA design is clashing on several aspects with other ISAs and therefore software historically built around them. Among them, the lack of condition codes and instruction expansion through simple instruction combination. In this paper we present the challenges of porting Cogit, the Pharo’s JIT compiler tightly linked to the x86 ISA, on RISC-V. We present concrete examples of them and the rationale behind their inclusion in the RISC-V ISA. We show how those mismatches are solved through design choices of the compilation process or through tools helping development: a VM simulation framework to keep the development in a high-level environment for the most part, an ISA-agnostic test harness covering main VM functionalities and a machine code debugger to explore and execute generated machine code. We also present a way to prototype custom instructions and execute them in the Pharo environment.
- Andrew P Black, Oscar Nierstrasz, Stéphane Ducasse, and Damien Pollet. 2010. Pharo by example. Lulu. com.Google Scholar
- M Anton Ertl and David Gregg. 2003. The structure and performance of efficient interpreters. Journal of Instruction-Level Parallelism 5 (2003), 1–25.Google Scholar
- GCC. 2022. GCC li pseudoinstruction cost functions implementation. https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/riscv/riscv.c;h=a545dbf66f734855090568ce1a253b373345eec0;hb=HEAD#l395Google Scholar
- Garth Gillespie. 2018. LuaJIT SSA IR 2.0. http://wiki.luajit.org/SSA-IR-2.0#introduction_example-ir-dumpGoogle Scholar
- Urs Hölzle, Craig Chambers, and David Ungar. 1991. Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In ECOOP’91 European Conference on Object-Oriented Programming, Pierre America (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 21–38. https://doi.org/10.1007/BFb0057013Google ScholarCross Ref
- Dan Ingalls, Ted Kaehler, John Maloney, Scott Wallace, and Alan Kay. 1997. Back to the Future: The Story of Squeak, a Practical Smalltalk Written in Itself. SIGPLAN Not. 32, 10, 318–326. https://doi.org/10.1145/263700.263754Google ScholarDigital Library
- Haeyoung Kim, Jinjae Lee, Derry Pratama, Asep Muhamad Awaludin, Howon Kim, and Donghyun Kwon. 2020. RIMI: instruction-level memory isolation for embedded systems on RISC-V. In Proceedings of the 39th International Conference on Computer-Aided Design. 1–9. https://doi.org/10.1145/3400302.3415727Google ScholarDigital Library
- LLVM. 2022. LLVM li pseudoinstruction recursive function implementation. https://github.com/llvm/llvm-project/blob/4c3d916c4bd2a392101c74dd270bd1e6a4fec15b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cppGoogle Scholar
- Eliot Miranda. 2011. The Cog Smalltalk virtual machine. In VMIL’11: Proceedings of the 5th workshop on Virtual machines and intermediate languages for emerging modularization mechanisms.Google Scholar
- David Patterson and Andrew Waterman. 2015. The RISC-V Reader: An Open Architecture Atlas. Technical Report. Strawberry Canyon.Google Scholar
- Guillermo Polito, Pablo Tesone, Stéphane Ducasse, Luc Fabresse, Théo Rogliano, Pierre Misse-Chanabier, and Carolina Hernandez Phillips. 2021. Cross-ISA testing of the Pharo VM: lessons learned while porting to ARMv8. In Proceedings of the 18th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes. 16–25. https://doi.org/10.1145/3475738.3480715Google ScholarDigital Library
- Ben L. Titzer. 2015. TurboFan JIT Design. https://docs.google.com/presentation/d/1sOEF4MlF7LeO7uq-uThJSulJlTh–wgLeaVibsbb3tcGoogle Scholar
- Adam Zabrocki, Martin Maas, and Stephano Cetola. 2021. Working Draft of the RISC-V J Extension Specification. https://github.com/riscv/riscv-j-extensionGoogle Scholar
Index Terms
- Porting a JIT Compiler to RISC-V: Challenges and Opportunities
Recommendations
Devise Rust Compiler Optimizations on RISC-V Architectures with SIMD Instructions
ICPP Workshops '19: Workshop Proceedings of the 48th International Conference on Parallel ProcessingRecently, Rust has become a popular system programming language and been widely used in microkernel OS designs, cryptocurrency designs, deep learning applications, and web browsers. Rust is designed for highly safe and concurrent systems and provides ...
Performance Evaluation of Various RISC Processor Systems: A Case Study on ARM, MIPS and RISC-V
Cloud Computing – CLOUD 2021AbstractRISC-V is a new instruction set architecture (ISA) that has emerged in recent years. Compared with previous computer instruction architectures, RISC-V has outstanding features such as simple instructions, modular instruction set and supporting ...
Gigue: A JIT Code Binary Generator for Hardware Testing
VMIL 2023: Proceedings of the 15th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate LanguagesJust-in-time compilers are the main virtual machine components responsible for performance. They recompile frequently used source code to machine code directly, avoiding the slower interpretation path. Hardware acceleration and performant security ...
Comments