summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2022-10-17 17:50:42 +0900
committerKoichi Sasada <ko1@atdot.net>2022-10-20 17:38:28 +0900
commite35c528d721d209ed8531b10b46c2ac725ea7bf5 (patch)
tree7a5fe3d73461b9e628f04226dedfffe8632a5438 /load.c
parent7563604fb868d87057733f52d780d841fc1ab6bb (diff)
push dummy frame for loading process
This patch pushes dummy frames when loading code for the profiling purpose. The following methods push a dummy frame: * `Kernel#require` * `Kernel#load` * `RubyVM::InstructionSequence.compile_file` * `RubyVM::InstructionSequence.load_from_binary` https://bugs.ruby-lang.org/issues/18559
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6572
Diffstat (limited to 'load.c')
-rw-r--r--load.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/load.c b/load.c
index 62b9b2d9bd..0e75c1ab83 100644
--- a/load.c
+++ b/load.c
@@ -681,6 +681,8 @@ load_iseq_eval(rb_execution_context_t *ec, VALUE fname)
const rb_iseq_t *iseq = rb_iseq_load_iseq(fname);
if (!iseq) {
+ rb_execution_context_t *ec = GET_EC();
+ VALUE v = rb_vm_push_frame_fname(ec, fname);
rb_ast_t *ast;
VALUE parser = rb_parser_new();
rb_parser_set_context(parser, NULL, FALSE);
@@ -688,6 +690,8 @@ load_iseq_eval(rb_execution_context_t *ec, VALUE fname)
iseq = rb_iseq_new_top(&ast->body, rb_fstring_lit("<top (required)>"),
fname, rb_realpath_internal(Qnil, fname, 1), NULL);
rb_ast_dispose(ast);
+ rb_vm_pop_frame(ec);
+ RB_GC_GUARD(v);
}
rb_exec_event_hook_script_compiled(ec, iseq, Qnil);
rb_iseq_eval(iseq);