summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-14 06:38:34 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-14 06:38:34 +0000
commit6e7f39829d6ce1cc80964d4cab85e1d33f1e1595 (patch)
treed941943476fabdf5f6d5b6433b47bd3130f37481
parent8e2c6c1689a8425e36d1f503f651b94afa2a1128 (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@66815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--load.c5
-rw-r--r--ruby.c12
-rw-r--r--version.h2
-rw-r--r--vm_core.h8
-rw-r--r--vm_eval.c4
5 files changed, 25 insertions, 6 deletions
diff --git a/load.c b/load.c
index 83c5828b87..544357daba 100644
--- a/load.c
+++ b/load.c
@@ -608,9 +608,8 @@ rb_load_internal0(rb_execution_context_t *ec, VALUE fname, int wrap)
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();
diff --git a/ruby.c b/ruby.c
index 93298cbc31..83707f8749 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1863,6 +1863,18 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
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;
}
diff --git a/version.h b/version.h
index bf0f10613a..37da8066c6 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#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
diff --git a/vm_core.h b/vm_core.h
index b40ef4c2cd..fcef0809af 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1882,6 +1882,14 @@ rb_vm_global_hooks(const rb_execution_context_t *ec)
#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);
diff --git a/vm_eval.c b/vm_eval.c
index a8764e2fa4..0e7047af65 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1293,8 +1293,8 @@ eval_make_iseq(VALUE src, VALUE fname, int line, const rb_binding_t *bind,
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;
}