Commit 008d6b76
008d6b768b29Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 4 files · ~4 modified
Description
Compile define_method(:name) { body } as static def
When define_method is called with a symbol and a static block, Spinel treats it as equivalent to def at compile time. The block body and parameters are registered as a top-level function.
No source rewriting needed — the original yjit-bench code works directly with define_method.
83/83 tests pass.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 008d6b768b29
- Parent
- f6b35d4407fb
examples/bm_send_bmethod.rbmodifiedView file
@@ -1,13 +1,8 @@
11
# send_bmethod benchmark (from yjit-bench)2-
# define_method replaced with def (equivalent for AOT)3-
4-
def zero5-
06-
end2+
# define_method with static block → compiled as def73
8-
def one(arg)9-
arg10-
end4+
define_method(:zero) { 0 }5+
define_method(:one) { |arg| arg }116
127
total = 0138
n = 0src/codegen.cmodifiedView file
Loading diff…
src/expr.cmodifiedView file
Loading diff…
src/stmt.cmodifiedView file
Loading diff…