ruby-changes:54600
From: naruse <ko1@a...>
Date: Mon, 14 Jan 2019 15:38:38 +0900 (JST)
Subject: [ruby-changes:54600] naruse:r66815 (ruby_2_6): merge revision(s) 66595: [Backport #15471]
naruse 2019-01-14 15:38:34 +0900 (Mon, 14 Jan 2019) New Revision: 66815 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66815 Log: merge revision(s) 66595: [Backport #15471] fix missed script_compiled events. [Bug #15471] * ruby.c (process_options): script_compiled events are missed on command line -e or specified file. this commit fix it. [Bug #15471] This patch should be backport to Ruby 2.6 branch. * vm_core.h (rb_exec_event_hook_script_compiled): introduce utility function to invoke a script_compiled event. Modified directories: branches/ruby_2_6/ Modified files: branches/ruby_2_6/load.c branches/ruby_2_6/ruby.c branches/ruby_2_6/version.h branches/ruby_2_6/vm_core.h branches/ruby_2_6/vm_eval.c Index: ruby_2_6/ruby.c =================================================================== --- ruby_2_6/ruby.c (revision 66814) +++ ruby_2_6/ruby.c (revision 66815) @@ -1863,6 +1863,18 @@ process_options(int argc, char **argv, r https://github.com/ruby/ruby/blob/trunk/ruby_2_6/ruby.c#L1863 rb_set_safe_level(opt->safe_level); + { + rb_execution_context_t *ec = GET_EC(); + + if (opt->e_script) { + /* -e */ + rb_exec_event_hook_script_compiled(ec, iseq, opt->e_script); + } + else { + /* file */ + rb_exec_event_hook_script_compiled(ec, iseq, Qnil); + } + } return (VALUE)iseq; } Index: ruby_2_6/vm_core.h =================================================================== --- ruby_2_6/vm_core.h (revision 66814) +++ ruby_2_6/vm_core.h (revision 66815) @@ -1882,6 +1882,14 @@ rb_vm_global_hooks(const rb_execution_co https://github.com/ruby/ruby/blob/trunk/ruby_2_6/vm_core.h#L1882 #define EXEC_EVENT_HOOK_AND_POP_FRAME(ec_, flag_, self_, id_, called_id_, klass_, data_) \ EXEC_EVENT_HOOK_ORIG(ec_, rb_vm_global_hooks(ec_), flag_, self_, id_, called_id_, klass_, data_, 1) +static inline void +rb_exec_event_hook_script_compiled(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE eval_script) +{ + EXEC_EVENT_HOOK(ec, RUBY_EVENT_SCRIPT_COMPILED, ec->cfp->self, 0, 0, 0, + NIL_P(eval_script) ? (VALUE)iseq : + rb_ary_new_from_args(2, eval_script, (VALUE)iseq)); +} + RUBY_SYMBOL_EXPORT_BEGIN int rb_thread_check_trap_pending(void); Index: ruby_2_6/vm_eval.c =================================================================== --- ruby_2_6/vm_eval.c (revision 66814) +++ ruby_2_6/vm_eval.c (revision 66815) @@ -1293,8 +1293,8 @@ eval_make_iseq(VALUE src, VALUE fname, i https://github.com/ruby/ruby/blob/trunk/ruby_2_6/vm_eval.c#L1293 printf("%s\n", StringValuePtr(disasm)); } - EXEC_EVENT_HOOK(GET_EC(), RUBY_EVENT_SCRIPT_COMPILED, GET_EC()->cfp->self, 0, 0, 0, - rb_ary_new_from_args(2, src, (VALUE)iseq)); + rb_exec_event_hook_script_compiled(GET_EC(), iseq, src); + return iseq; } Index: ruby_2_6/load.c =================================================================== --- ruby_2_6/load.c (revision 66814) +++ ruby_2_6/load.c (revision 66815) @@ -608,9 +608,8 @@ rb_load_internal0(rb_execution_context_t https://github.com/ruby/ruby/blob/trunk/ruby_2_6/load.c#L608 fname, rb_realpath_internal(Qnil, fname, 1), NULL); rb_ast_dispose(ast); } - EXEC_EVENT_HOOK(ec, RUBY_EVENT_SCRIPT_COMPILED, - ec->cfp->self, 0, 0, 0, (VALUE)iseq); - rb_iseq_eval(iseq); + rb_exec_event_hook_script_compiled(ec, iseq, Qnil); + rb_iseq_eval(iseq); } EC_POP_TAG(); Index: ruby_2_6/version.h =================================================================== --- ruby_2_6/version.h (revision 66814) +++ ruby_2_6/version.h (revision 66815) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_6/version.h#L1 #define RUBY_VERSION "2.6.0" #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 8 +#define RUBY_PATCHLEVEL 9 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 1 Index: ruby_2_6 =================================================================== --- ruby_2_6 (revision 66814) +++ ruby_2_6 (revision 66815) Property changes on: ruby_2_6 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r66595 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/