4 ms·
The parent post is correct. LLVM's optimizations are low-level optimizations tuned for C and C++. By contrast, the optimizations you want to do for dynamic lang
by pcwalton 10y ago
The parent post is correct. LLVM's optimizations are low-level optimizations tuned for C and C++. By contrast, the optimizations you want to do for dynamic languages (and high-level languages in general) are high-level optimizations that are better done on language-specific IRs. Moreover, dynamic languages need dynamic optimizations such as polymorphic inline caching, speculation and bailouts with on stack replacement, etc.
Optimization pipelines are invariably language-specific. If you were to somehow make LuaJIT into a C/C++ compiler without doing any work on its optimizer, you would get similarly poor results.
- gliptic 10y agoTrue. Although, LuaJIT does pretty well on C-style code using its FFI library. But that's something it's designed for, so not really surprising.
- ihnorton 10y ago> If you were to somehow make LuaJIT into a C/C++ compiler Clang -> Sulong -> Java bytecode -> Luje [1]? May need more turtles :) Technically, one reason -of several- this probably wouldn't work without significant effort is that Sulong relies on Graal's FFI intrinsics. But those should be convertible to LuaJIT FFI calls (in theory). [1] https://cowlark.com/luje/ https://cowlark.com/luje/