Skip to content

Commit

Permalink
merge revision(s) 64736,65567: [Backport #15270]
Browse files Browse the repository at this point in the history
	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
  • Loading branch information
nagachika committed Dec 5, 2018
1 parent f35b27b commit aba207b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions compile.c
Expand Up @@ -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}};
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions iseq.c
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}

/*
Expand All @@ -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));
}

/*
Expand All @@ -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);
}

/*
Expand Down
10 changes: 5 additions & 5 deletions iseq.h
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions version.h
@@ -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"

Expand Down

0 comments on commit aba207b

Please sign in to comment.