@@ -3475,6 +3475,48 @@ vm_keep_script_lines_set(VALUE self, VALUE flags)
3475
3475
return flags ;
3476
3476
}
3477
3477
3478
+ /*
3479
+ * call-seq:
3480
+ * RubyVM.enable_inlining! -> true
3481
+ *
3482
+ * It turns on the experimenal inlining feature.
3483
+ * This API is used for testing purposes.
3484
+ */
3485
+ static VALUE
3486
+ vm_enable_inlining (VALUE self )
3487
+ {
3488
+ mjit_call_p = true;
3489
+ return RBOOL (true);
3490
+ }
3491
+
3492
+ /*
3493
+ * call-seq:
3494
+ * RubyVM.disable_inlining! -> false
3495
+ *
3496
+ * It turns off the experimenal inlining feature.
3497
+ * This API is used for testing purposes.
3498
+ */
3499
+ static VALUE
3500
+ vm_disable_inlining (VALUE self )
3501
+ {
3502
+ mjit_call_p = false;
3503
+ return RBOOL (false);
3504
+ }
3505
+
3506
+ /*
3507
+ * call-seq:
3508
+ * RubyVM.inline_threshold = int
3509
+ *
3510
+ * It sets the number of method call as the inlining threshold.
3511
+ * This API is used for testing purposes.
3512
+ */
3513
+ static VALUE
3514
+ vm_inline_threshold_set (VALUE self , VALUE n )
3515
+ {
3516
+ inline_threshold = NUM2INT (n );
3517
+ return n ;
3518
+ }
3519
+
3478
3520
void
3479
3521
Init_VM (void )
3480
3522
{
@@ -3499,6 +3541,9 @@ Init_VM(void)
3499
3541
rb_define_singleton_method (rb_cRubyVM , "stat" , vm_stat , -1 );
3500
3542
rb_define_singleton_method (rb_cRubyVM , "keep_script_lines" , vm_keep_script_lines , 0 );
3501
3543
rb_define_singleton_method (rb_cRubyVM , "keep_script_lines=" , vm_keep_script_lines_set , 1 );
3544
+ rb_define_singleton_method (rb_cRubyVM , "enable_inlining!" , vm_enable_inlining , 0 );
3545
+ rb_define_singleton_method (rb_cRubyVM , "disable_inlining!" , vm_disable_inlining , 0 );
3546
+ rb_define_singleton_method (rb_cRubyVM , "inline_threshold=" , vm_inline_threshold_set , 1 );
3502
3547
3503
3548
#if USE_DEBUG_COUNTER
3504
3549
rb_define_singleton_method (rb_cRubyVM , "reset_debug_counters" , rb_debug_counter_reset , 0 );
0 commit comments