O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

The light-weight-jit-compiler-project-for-c ruby

199 visualizações

Publicada em

A project for CRuby Light-Weight JIT compiler based on MIR (Medium Internal Representation). This is slides from my RubyKaigi2019 presentation.

Publicada em: Software
  • DOWNLOAD FULL. BOOKS INTO AVAILABLE FORMAT, ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Seja a primeira pessoa a gostar disto

The light-weight-jit-compiler-project-for-c ruby

  1. 1. A Light Weight JIT Compiler Project For CRuby Vladimir Makarov Red Hat Apr 19, 2019 Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 1 / 1
  2. 2. About Myself Red Hat, Toronto office, Canada Tools group (GCC, GLIBC, LLVM, Rust, GO, OpenMP, ...) a part of bigger platform engineering team (RHEL) >20 years of work on GCC >3 years of work on CRuby Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 2 / 1
  3. 3. GCC/LLVM As a JIT Compiler The most popular approach to implement a JIT Possible APIs: LLVM ORC or GCC LibGCCJIT Getting GCC/LLVM optimizations for free The fastest way to implement CRuby JIT Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 3 / 1
  4. 4. CRuby MJIT MJIT also uses GCC or LLVM Unique feature: C as an interface language Simpler implementation, maintenance and debugging The same compilation speed as in other API cases achieved by Precompiled header usage Memory FS Parallel compiling Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 4 / 1
  5. 5. GCC/LLVM based JIT disadvantages Big comparing to CRuby Slow compilation speed for some cases Difficult for optimizing on borders of code written on different programming languages Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 5 / 1
  6. 6. CRuby/GCC/LLVM SLOC GCC-8 CRuby-2.6 LLVM-8 + Clang + Libcxx + Compiler-RT 5.49 M Lines 1.66 M Lines 4.13 M Lines Scaled to the corresponding source sizes GCC and LLVM sources are ~3 times bigger Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 6 / 1
  7. 7. CRuby/GCC/LLVM Binary Size GCC-8 x86-64 cc1 CRuby-2.6 ruby LLVM-8 clang x86/x86-64 only25.2 MB 3.5 MB 63.4 MB Scaled to the corresponding binary sizes GCC and LLVM binaries are ~7-18 times bigger Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 7 / 1
  8. 8. GCC/LLVM Compilation Speed ~20ms for a small method compilation by GCC/LLVM (and MJIT) on modern Intel CPUs ~0.5s for latest Raspberry PI 3 B+ on ARM64 Linux SPEC2000 Est 176.gcc: 320 (PI 3 B+) vs 8520 (i7-9700K) Slow environments for GCC/LLVM based JITs MingW, CygWin, environments w/o memory FS Example of JIT compilation speed difference: Java implementation by Azul Systems 100ms for a typical Java method compiled with aggressive inlinining by Falcon, a tier 2 JIT compiler implemented with LLVM 1ms for the method compiled by a tier 1 JIT compiler Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 8 / 1
  9. 9. 321 (239 unique) GCC-8 backend passes in execution order all_lowering_passes 1. warn_unused_result 2. diagnose_omp_blocks 3. diagnose_tm_blocks 4. lower_omp 5. lower_cf 6. lower_tm 7. refactor_eh 8. lower_eh 9. build_cfg 10. warn_function_return 11. expand_omp 12. sprintf_length[1] 13. walloca[1] 14. build_cgraph_edges all_small_ipa_passes 15. ipa_free_lang_data 16. ipa_fun_and_var_visibility 17. ipa_chkp_versioning 18. ipa_chkp_early_produce_thunks build_ssa_passes 19. fixup_cfg[1] 20. build_ssa 21. warn_nonnull_compare 22. ubsan 23. early_warn_uninitialized 24. nothrow 25. rebuild_cgraph_edges[1] chkp_instrumentation_passes 26. fixup_cfg[2] 27. chkp 28. rebuild_cgraph_edges[2] local_optimization_passes 29. fixup_cfg[3] 30. rebuild_cgraph_edges[3] 31. local_fn_summary[1] 32. early_inline all_early_optimizations 33. remove_cgraph_callee_edges[1] 34. object_sizes[1] 35. ccp[1] 36. forwprop[1] 37. early_thread_jumps 38. sra_early 39. build_ealias 40. fre[1] 41. early_vrp 42. merge_phi[1] 43. dse[1] 44. cd_dce[1] 45. early_ipa_sra 46. tail_recursion[1] 47. convert_switch 48. cleanup_eh[1] 49. profile 50. local_pure_const[1] 51. split_functions 52. strip_predict_hints[1] 53. release_ssa_names 54. rebuild_cgraph_edges[4] 55. local_fn_summary[2] ipa_oacc 56. ipa_pta[1] ipa_oacc_kernels oacc_kernels 57. ch[1] 58. fre[2] 59. lim[1] 60. dominator[1] 61. dce[1] 62. parallelize_loops[1] 63. expand_omp_ssa[1] 64. rebuild_cgraph_edges[5] 65. target_clone 66. ipa_chkp_produce_thunks 67. ipa_auto_profile 68. ipa_tree_profile 69. feedback_split_functions 70. ipa_free_fn_summary[1] 71. ipa_increase_alignment 72. ipa_tm 73. ipa_lower_emutls all_regular_ipa_passes 74. ipa_whole_program_visibility 75. ipa_profile 76. ipa_icf 77. ipa_devirt 78. ipa_cp 79. ipa_cdtor_merge 80. ipa_hsa 81. ipa_fn_summary 82. ipa_inline 83. ipa_pure_const 84. ipa_free_fn_summary[2] 85. ipa_reference 86. ipa_single_use 87. pass_ipa_comdats all_late_ipa_passes 88. materialize_all_clones 89. ipa_pta[2] 90. omp_simd_clone 91. fixup_cfg[4] 92. lower_eh_dispatch 93. oacc_device_lower 94. omp_device_lower 95. omp_target_link all_optimizations 96. remove_cgraph_callee_edges[2] 97. strip_predict_hints[2] 98. ccp[2] 99. post_ipa_warn[1] 100. complete_unrolli 101. backprop 102. phiprop 103. forwprop[2] 104. object_sizes[2] 105. build_alias 106. return_slot 107. fre[3] 108. merge_phi[2] 109. thread_jumps[1] 110. vrp[1] 111. chkp_opt 112. dce[2] 113. stdarg 114. call_cdce 115. cselim 116. copy_prop[1] 117. tree_ifcombine 118. merge_phi[3] 119. phiopt[1] 120. tail_recursion[2] 121. ch[2] 122. lower_complex[1] 123. sra 124. thread_jumps[2] 125. dominator[2] 126. isolate_erroneous_paths 127. phi_only_cprop[1] 128. dse[2] 129. reassoc[1] 130. dce[3] 131. forwprop[3] 132. phiopt[2] 133. ccp[3] 134. cse_sincos 135. optimize_bswap 136. laddress 137. lim[2] 138. walloca[2] 139. pre 140. sink_code 141. sancov[1] 142. asan[1] 143. tsan[1] 144. dce[4] 145. fix_loops tree_loop 146. tree_loop_init 147. tree_unswitch 148. scev_cprop 149. loop_split 150. loop_jam 151. cd_dce[2] 152. iv_canon 153. loop_distribution 154. linterchange 155. copy_prop[2] graphite 156. graphite_transforms 157. lim[3] 158. copy_prop[3] 159. dce[5] 160. parallelize_loops[2] 161. expand_omp_ssa[2] 162. ch_vect 163. if_conversion 164. vectorize 165. dce[6] 166. predcom 167. complete_unroll 168. slp_vectorize[1] 169. loop_prefetch 170. iv_optimize 171. lim 172. tree_loop_done tree_no_loop 173. slp_vectorize[2] 174. simduid_cleanup[1] 175. lower_vector_ssa[1] 176. cse_reciprocals 177. sprintf_length[2] 178. reassoc[2] 179. strength_reduction 180. split_paths 181. tracer 182. thread_jumps[3] 183. dominator[3] 184. strlen 185. thread_jumps[4] 186. vrp[2] 187. warn_restrict 188. phi_only_cprop[2] 189. dse[3] 190. cd_dce[3] 191. forwprop[4] 192. phiopt[3] 193. fold_builtins[1] 194. optimize_widening_mul 195. store_merging 196. tail_calls 197. dce[7] 198. split_crit_edges[1] 199. late_warn_uninitialized[1] 200. uncprop[1] 201. local_pure_const[2] all_optimizations_g 202. remove_cgraph_callee_edges[3] 203. strip_predict_hints[3] 204. lower_complex[2] 205. lower_vector_ssa[2] 206. ccp[4] 207. post_ipa_warn[2] 208. object_sizes[3] 209. fold_builtins[2] 210. sprintf_length[3] 211. copy_prop[4] 212. dce[8] 213. sancov[2] 214. asan[2] 215. tsan[2] 216. split_crit_edges[2] 217. late_warn_uninitialized[2] 218. uncprop[2] 219. local_pure_const[3] tm_init 220. tm_mark 221. tm_memopt 222. tm_edges 223. simduid_cleanup[2] 224. vtable_verify 225. lower_vaarg 226. lower_vector 227. lower_complex_O0 228. sancov_O0 229. lower_switch 230. asan_O0 231. tsan_O0 232. sanopt 233. cleanup_eh[2] 234. lower_resx 235. nrv 236. cleanup_cfg_post_optimizing 237. warn_function_noreturn 238. gen_hsail 239. expand rest_of_compilation 240. instantiate_virtual_regs 241. into_cfg_layout_mode 242. jump[1] 243. lower_subreg[1] 244. df_initialize_opt 245. cse[1] 246. rtl_fwprop 247. rtl_cprop[1] 248. rtl_pre 249. rtl_hoist 250. rtl_cprop[2] 251. rtl_store_motion 252. cse_after_global_opts 253. rtl_ifcvt 254. reginfo_init loop2 255. rtl_loop_init 256. rtl_move_loop_invariants 257. rtl_unroll_loops 258. rtl_doloop 259. rtl_loop_done 260. web 261. rtl_cprop[3] 262. cse[2] 263. rtl_dse[1] 264. rtl_fwprop_addr 265. inc_dec 266. initialize_regs 267. ud_rtl_dce 268. combine 269. if_after_combine 270. partition_blocks 271. outof_cfg_layout_mode 272. split_all_insns 273. lower_subreg[2] 274. df_initialize_no_opt 275. stack_ptr_mod 276. mode_switching 277. match_asm_constraints 278. sms 279. live_range_shrinkage 280. sched[1] 281. early_remat 282. ira 283. reload postreload 284. postreload_cse 285. gcse 286. split_after_reload 287. ree 288. compare_elim_after_reload 289. branch_target_load_optimize[1] 290. thread_prologue_and_epilogue 291. rtl_dse[2] 292. stack_adjustments 293. jump[2] 294. duplicate_computed_gotos 295. sched_fusion 296. peephole 297. if_after_reload 298. regrename 299. cprop_hardreg 300. fast_rtl_dce 301. reorder_blocks 302. branch_target_load_optimize[2] 303. leaf_regs 304. split_before_sched2 305. sched[2] stack_regs 306. split_before_regstack 307. stack_regs_run late_compilation 308. compute_alignments 309. variable_tracking 310. free_cfg 311. machine_reorg 312. cleanup_barriers 313. delay_slots 314. split_for_shorten_branches 315. convert_to_eh_region_ranges 316. shorten_branches 317. set_nothrow_function_flags 318. dwarf2_frame 319. final 320. df_finish 321. clean_state Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 9 / 1
  10. 10. GCC/LLVM startup GCC -O0 GCC -O2 Clang -O0 Clang -02 0 2 4 6 8 10 12 CPUtime(ms) 7.95 8.38 7.21 7.70 8.71 10.70 7.29 9.11 Empty file vs 30 Line Preprocessed File Compilation empty file 30 lines file x86 64 GCC-8/LLVM-8, Intel i7-9700K, FC29 Most time is spent in compiler (and assembler) data initialization builtins descriptions, different optimization data, etc Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 10 / 1
  11. 11. Inlining C and Ruby code Inlining is the most important JIT optimization Many Ruby standard methods are written on C We need inlining the C code and machine code generated from Ruby code Example: x=2; 10.times {x*=2} x = 2 times x *= 2 Ruby C Ruby Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 11 / 1
  12. 12. Inlining C and Ruby code in MJIT Environment header CRuby building phase MJIT CRuby execution run CRuby Precompiled header C code .so file CC CC loading Generated Machine code Adding the C code to the precompiled header Slower startup, slower compilation Rewriting the C code on Ruby Slower generated code as a rule Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 12 / 1
  13. 13. Light-Weight JIT Compiler One possible solution is a light-weight JIT compiler in addition to existing MJIT one: The light-weight JIT compiler as a tier 1 JIT compiler Existing MJIT generating C as a tier 2 JIT compiler for more frequently running code Or only the light-weight JIT compiler for environments where the current MJIT compiler does not work Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 13 / 1
  14. 14. MIR for Light-Weight JIT compiler My spare-time project started last year: Universal light-weight JIT compiler based on MIR MIR is Medium Internal Representation MIR means peace and world in Russian MIR is strongly typed MIR can represent machine insns of different architectures Plans to try the light-weight JIT compiler first for CRuby or/and MRuby Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 14 / 1
  15. 15. Example: C Prime Sieve #define Size 819000 int sieve (int iter) { int i, k, prime, count, n; char flags[Size]; for (n = 0; n < iter; n++) { count = 0; for (i = 0; i < Size; i++) flags[i] = 1; for (i = 0; i < Size; i++) if (flags[i]) { prime = i + i + 3; for (k = i + prime; k < Size; k += prime) flags[k] = 0; count++; } } return count; } Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 15 / 1
  16. 16. Example: MIR Prime Sieve m_sieve: module export sieve sieve: func 819000, i32, i32:iter local i64:flags, i64:count, i64:prime, i64:n, i64:i, i64:k, i64:temp mov flags, fp; mov n, 0 loop: bge fin, n, iter mov count, 0; mov i, 0 loop2: bgt fin2, i, 819000 mov ui8:(flags, i), 1; add i, i, 1; jmp loop2 fin2: mov i, 0 loop3: bgt fin3, i, 819000 beq cont3, ui8:(flags,i), 0 add temp, i, i; add prime, temp, 3; add k, i, prime loop4: bgt fin4, k, 819000 mov ui8:(flags, k), 0; add k, k, prime; jmp loop4 fin4: add count, count, 1 cont3: add i, i, 1; jmp loop3 fin3: add n, n, 1; jmp loop fin: ret count endfunc endmodule Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 16 / 1
  17. 17. The Light-Weight JIT Compiler Goals Comparing to GCC -O2 70% of generated code speed 100 times faster compilation speed 100 times faster start-up 100 times smaller code size less 10K C LOC No external dependencies – only standard C (no YACC, LEX, etc) Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 17 / 1
  18. 18. How to achieve the performance goals? Use few most valuable optimizations Optimize only frequent cases Use algorithms with the best combination of simplicity (code size) and performance Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 18 / 1
  19. 19. How to achieve the performance goals? What are the most valuable GCC optimizations for x86-64? a decent RA code selection GCC-9.0, i7-9700K under FC29 SPECInt2000 Est. GCC -O2 GCC -O0 + simple RA + combiner -fno-inline 5458 4342 (80%) -finline 6141 4339 (71%) Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 19 / 1
  20. 20. The current state of MIR project MIRAPI C MIR binary MIR text C x86-64 MIR binary MIR text Interpreter Generator Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 20 / 1
  21. 21. Possible future directions of MIR project MIRAPI C LLVM IRWASM C++Rust MIR binary MIR text C x86-64 aarch64PPC64 MIPS64 MIR binary MIR text ... Interpreter Generator Java bytecode Java bytecode ... WASM CIL CIL Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 21 / 1
  22. 22. MIR Generator Simplify Build CFG MIR Global Common Sub-Expr Elimination Dead Code Elimination Inline Inline: Function call inlining Simplify: Lowering MIR, local value numbering Build CFG: Building BBs and CFG edges GCSE: Reusing already calculated values Dead Code Elimination: Removing unused insns Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 22 / 1
  23. 23. MIR Generator Simplify Machinize Build CFG Build Live Info Build Live Ranges Assign Registers MIR Global Common Sub-Expr Elimination Dead Code Elimination Sparse Conditional Constant Propagation Inline SCCP: constant propagation/folding and removing unreachable BBs Machinize: MIR for calls ABI, 2-op insns, etc Building Live Info: Calculating BB live in/out sets Build Live Ranges: Calculating live ranges for regs Assign: Priority-based RA Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 22 / 1
  24. 24. MIR Generator Simplify Machinize Build CFG Build Live Info Build Live Ranges Assign Registers Rewrite Combine Insns Dead Code Elimination Generate Machine Code MIR Machine Code Global Common Sub-Expr Elimination Dead Code Elimination Sparse Conditional Constant Propagation Inline Rewrite: Transform MIR according to RA Combine: Merging data-dependent insns into one The 2nd Dead Code Elimination Generate machine insns (machine-dependent code) Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 22 / 1
  25. 25. Some MIR Generator Features No Static Single Assignment Form In and Out SSA passes are expensive, especially for short MIR-generator pass pipeline SSA absence complicates conditional constant propagation and global common sub-expression elimination No Position Independent Code It speeds up the generated code a bit It simplifies the code generation Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 23 / 1
  26. 26. Possible ways to compile C to MIR LLVM IR to MIR or GCC Port Dependence to a particular external project Big efforts to implement Maintenance burden Own C compiler Practically the same efforts to implement Examples: tiny CC, 8cc, 9cc No dependency to any external project Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 24 / 1
  27. 27. C to MIR compiler No any tools, like YACC or LEX PEG (parsing expression grammar) parser Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 25 / 1
  28. 28. Current MJIT Environment header CRuby building phase MJIT CRuby execution run CRuby Precompiled header C code .so file CC CC loading Generated Machine code Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 26 / 1
  29. 29. MIR as a tier1 JIT compiler in CRuby Environment header CRuby building phase MJIT CRuby execution run CRuby Precompiled header C code .so file CC CC loading Generated Machine code Ruby methods written on C API MIR Binaries MIR Generator MIR-to-C C-to-MIR MIR API, MIR Generator, MIR-to-C Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 27 / 1
  30. 30. MIR as a tier1 JIT compiler in CRuby – 2nd Option Environment header CRuby building phase MJIT CRuby execution run CRuby C code .so file CC loading Generated Machine code Ruby methods written on C API MIR Binaries MIR Generator MIR-to-C C-to-MIR MIR API, MIR Generator, MIR-to-C Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 28 / 1
  31. 31. MIR as single JIT compiler in CRuby Environment header CRuby building phase MJIT CRuby execution run CRuby Generated Machine code Ruby methods written on C API MIR Binaries MIR Generator MIR-to-C C-to-MIR MIR API, MIR Generator, MIR-to-C Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 29 / 1
  32. 32. Current MIR Performance Results Intel i7-9700K under FC29 with GCC-8.2.1: MIR-gen MIR-interp gcc -O2 gcc -O0 compilation1 1.0 (0.075ms) 0.16 (0.012ms) 178 (13.35ms) 171 (12.8ms) execution1 1.0 (3.1s) 5.9 (18.3s) 0.94 (2.9s) 2.05 (6.34s) code size2 1.0 (175KB) 0.65 (114KB) 144 (25.2MB) 144 (25.2MB) startup3 1.0 (1.3us) 1.0 (1.3us) 9310 (12.1ms) 9580 (12.8ms) LOC4 1.0 (9.5K) 0.58 (5.5K) 155 (1480) 155 (1480K) Table: Sieve5 : MIR vs GCC 1 Best wall time of 10 runs 2 Stripped size of cc1 and minimal program running MIR code 3 Wall time to generate code for running empty C or MIR program 4 Size of minimal files to create and run MIR code or build x86-64 GCC compiler 5 30 lines of preprocessed C code, MIR is created through API Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 30 / 1
  33. 33. Current MIR SLOC distribution 9.0K C2MIR 3.2K Generator: Core 1.2K Generator: x86-64 Target 4.0K MIR API 1.2K ADT 1K Interpr. Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 31 / 1
  34. 34. MIR Project Competitors LibJIT started as a part of DotGNU Project 80K SLOC, GPL/LGPL License Only register allocation and primitive copy propagation RyuJIT, a part of runtime for .NET Core 360K SLOC, MIT License MIR-generator optimizations plus loop invariant motion minus SCCP SSA Other candidates: QBE: standalone+, small+ (10K LOC), SSA-, ASM generation-, MIT License LIBFirm: less standalone-, big- (140K LOC), SSA-, ASM generation-, LGPL2 CraneLift: less standalone-, big- (70K LOC of Rust-), SSA-, Apache License Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 32 / 1
  35. 35. MIR Project Plans MIR-based CRuby JIT compiler is beyond Ruby 3 time-frame Short term plans: Finish C to MIR compiler Prototype of MIR based JIT compiler in CRuby Porting MIR Generator to AARCH64 https://github.com/vnmakarov/mir Vladimir Makarov (Red Hat) A Light Weight JIT Compiler Project For CRuby Apr 19, 2019 33 / 1

×