merge revision(s) 64736,65567: [Backport #15270]

iseq.c: prefix rb_ to non-static iseq functions

	I assume we always prefix rb_ to non-static functions to avoid conflict.
	These functions are not exported and safe to be renamed.

	iseq.h: ditto
	compile.c: ditto

	Fix TracePoint for nested iseq loaded from binary [Bug#14702]

	When loading iseq from binary while a TracePoint is on, we need to
	recompile instructions to their "trace_" variant. Before this commit
	we only recompiled instructions in the top level iseq, which meant
	that TracePoint was malfunctioning for code inside module/class/method
	definitions.

	* compile.c: Move rb_iseq_init_trace to rb_ibf_load_iseq_complete.
	  It is called on all iseqs during loading.

	* test_iseq.rb: Test that tracepoints fire within children iseq when
	  using load_from_binary.

	This patch is from: Alan Wu <XrXr@users.noreply.github.com>


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@66225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2018-12-05 14:35:07 +00:00
parent f35b27b5ab
commit aba207b762
4 changed files with 21 additions and 21 deletions

View file

@ -9351,7 +9351,7 @@ ibf_dump_setup(struct ibf_dump *dump, VALUE dumper_obj)
}
VALUE
iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt)
rb_iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt)
{
struct ibf_dump *dump;
struct ibf_header header = {{0}};
@ -9410,7 +9410,7 @@ ibf_iseq_list(const struct ibf_load *load)
}
void
ibf_load_iseq_complete(rb_iseq_t *iseq)
rb_ibf_load_iseq_complete(rb_iseq_t *iseq)
{
struct ibf_load *load = RTYPEDDATA_DATA(iseq->aux.loader.obj);
rb_iseq_t *prev_src_iseq = load->iseq;
@ -9425,7 +9425,7 @@ ibf_load_iseq_complete(rb_iseq_t *iseq)
const rb_iseq_t *
rb_iseq_complete(const rb_iseq_t *iseq)
{
ibf_load_iseq_complete((rb_iseq_t *)iseq);
rb_ibf_load_iseq_complete((rb_iseq_t *)iseq);
return iseq;
}
#endif
@ -9452,7 +9452,7 @@ ibf_load_iseq(const struct ibf_load *load, const rb_iseq_t *index_iseq)
rb_ary_store(load->iseq_list, iseq_index, (VALUE)iseq);
#if !USE_LAZY_LOAD
ibf_load_iseq_complete(iseq);
rb_ibf_load_iseq_complete(iseq);
#endif /* !USE_LAZY_LOAD */
if (load->iseq) {
@ -9527,7 +9527,7 @@ static const rb_data_type_t ibf_load_type = {
};
const rb_iseq_t *
iseq_ibf_load(VALUE str)
rb_iseq_ibf_load(VALUE str)
{
struct ibf_load *load;
rb_iseq_t *iseq;
@ -9536,14 +9536,14 @@ iseq_ibf_load(VALUE str)
ibf_load_setup(load, loader_obj, str);
iseq = ibf_load_iseq(load, 0);
iseq_init_trace(iseq);
rb_iseq_init_trace(iseq);
RB_GC_GUARD(loader_obj);
return iseq;
}
VALUE
iseq_ibf_load_extra_data(VALUE str)
rb_iseq_ibf_load_extra_data(VALUE str)
{
struct ibf_load *load;
VALUE loader_obj = TypedData_Make_Struct(0, struct ibf_load, &ibf_load_type, load);

12
iseq.c
View file

@ -350,7 +350,7 @@ static void validate_get_insn_info(rb_iseq_t *iseq);
#endif
void
iseq_init_trace(rb_iseq_t *iseq)
rb_iseq_init_trace(rb_iseq_t *iseq)
{
iseq->aux.trace_events = 0;
if (ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS) {
@ -377,7 +377,7 @@ finish_iseq_build(rb_iseq_t *iseq)
rb_exc_raise(err);
}
iseq_init_trace(iseq);
rb_iseq_init_trace(iseq);
return Qtrue;
}
@ -1000,7 +1000,7 @@ iseqw_check(VALUE iseqw)
rb_iseq_t *iseq = DATA_PTR(iseqw);
if (!iseq->body) {
ibf_load_iseq_complete(iseq);
rb_ibf_load_iseq_complete(iseq);
}
if (!iseq->body->location.label) {
@ -2652,7 +2652,7 @@ iseqw_to_binary(int argc, VALUE *argv, VALUE self)
{
VALUE opt;
rb_scan_args(argc, argv, "01", &opt);
return iseq_ibf_dump(iseqw_check(self), opt);
return rb_iseq_ibf_dump(iseqw_check(self), opt);
}
/*
@ -2671,7 +2671,7 @@ iseqw_to_binary(int argc, VALUE *argv, VALUE self)
static VALUE
iseqw_s_load_from_binary(VALUE self, VALUE str)
{
return iseqw_new(iseq_ibf_load(str));
return iseqw_new(rb_iseq_ibf_load(str));
}
/*
@ -2683,7 +2683,7 @@ iseqw_s_load_from_binary(VALUE self, VALUE str)
static VALUE
iseqw_s_load_from_binary_extra_data(VALUE self, VALUE str)
{
return iseq_ibf_load_extra_data(str);
return rb_iseq_ibf_load_extra_data(str);
}
/*

10
iseq.h
View file

@ -156,11 +156,11 @@ iseq_imemo_alloc(void)
return (rb_iseq_t *)rb_imemo_new(imemo_iseq, 0, 0, 0, 0);
}
VALUE iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt);
void ibf_load_iseq_complete(rb_iseq_t *iseq);
const rb_iseq_t *iseq_ibf_load(VALUE str);
VALUE iseq_ibf_load_extra_data(VALUE str);
void iseq_init_trace(rb_iseq_t *iseq);
VALUE rb_iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt);
void rb_ibf_load_iseq_complete(rb_iseq_t *iseq);
const rb_iseq_t *rb_iseq_ibf_load(VALUE str);
VALUE rb_iseq_ibf_load_extra_data(VALUE str);
void rb_iseq_init_trace(rb_iseq_t *iseq);
RUBY_SYMBOL_EXPORT_BEGIN

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.5.4"
#define RUBY_RELEASE_DATE "2018-12-02"
#define RUBY_PATCHLEVEL 118
#define RUBY_RELEASE_DATE "2018-12-05"
#define RUBY_PATCHLEVEL 119
#define RUBY_RELEASE_YEAR 2018
#define RUBY_RELEASE_MONTH 12
#define RUBY_RELEASE_DAY 2
#define RUBY_RELEASE_DAY 5
#include "ruby/version.h"