diff options
author | Koichi Sasada <ko1@atdot.net> | 2022-10-17 17:50:42 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2022-10-20 17:38:28 +0900 |
commit | e35c528d721d209ed8531b10b46c2ac725ea7bf5 (patch) | |
tree | 7a5fe3d73461b9e628f04226dedfffe8632a5438 /iseq.c | |
parent | 7563604fb868d87057733f52d780d841fc1ab6bb (diff) | |
download | ruby-e35c528d721d209ed8531b10b46c2ac725ea7bf5.tar.gz |
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
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1435,6 +1435,9 @@ iseqw_s_compile_file(int argc, VALUE *argv, VALUE self) f = rb_file_open_str(file, "r"); + rb_execution_context_t *ec = GET_EC(); + VALUE v = rb_vm_push_frame_fname(ec, file); + parser = rb_parser_new(); rb_parser_set_context(parser, NULL, FALSE); ast = (rb_ast_t *)rb_parser_load_file(parser, file); @@ -1453,6 +1456,9 @@ iseqw_s_compile_file(int argc, VALUE *argv, VALUE self) rb_realpath_internal(Qnil, file, 1), 1, NULL, 0, ISEQ_TYPE_TOP, &option)); rb_ast_dispose(ast); + + rb_vm_pop_frame(ec); + RB_GC_GUARD(v); return ret; } |