ruby-changes:58117
From: Yusuke <ko1@a...>
Date: Fri, 4 Oct 2019 21:35:16 +0900 (JST)
Subject: [ruby-changes:58117] c8a18e25c1 (master): iseq.c (rb_iseq_compile_on_base): Removed
https://git.ruby-lang.org/ruby.git/commit/?id=c8a18e25c1 From c8a18e25c1cc9a44231b97e12f30a98cf9d979bb Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Fri, 4 Oct 2019 21:30:32 +0900 Subject: iseq.c (rb_iseq_compile_on_base): Removed ko1 cannot remember why he introduced the function. And it is not used. After it is removed, the argument "base_block" of rb_iseq_compile_with_option is always zero. diff --git a/iseq.c b/iseq.c index fcf38fc..281d5e4 100644 --- a/iseq.c +++ b/iseq.c @@ -966,12 +966,10 @@ rb_iseq_load(VALUE data, VALUE parent, VALUE opt) https://github.com/ruby/ruby/blob/trunk/iseq.c#L966 } rb_iseq_t * -rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, const struct rb_block *base_block, VALUE opt) +rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, VALUE opt) { rb_iseq_t *iseq = NULL; - const rb_iseq_t *const parent = base_block ? vm_block_iseq(base_block) : NULL; rb_compile_option_t option; - const enum iseq_type type = parent ? ISEQ_TYPE_EVAL : ISEQ_TYPE_TOP; #if !defined(__GNUC__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 8) # define INITIALIZED volatile /* suppress warnings by gcc 4.8 */ #else @@ -994,11 +992,8 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, c https://github.com/ruby/ruby/blob/trunk/iseq.c#L992 } { const VALUE parser = rb_parser_new(); - const rb_iseq_t *outer_scope = parent; - if (!outer_scope) { - VALUE name = rb_fstring_lit("<compiled>"); - outer_scope = rb_iseq_new(NULL, name, name, Qnil, 0, ISEQ_TYPE_TOP); - } + VALUE name = rb_fstring_lit("<compiled>"); + const rb_iseq_t *outer_scope = rb_iseq_new(NULL, name, name, Qnil, 0, ISEQ_TYPE_TOP); VALUE outer_scope_v = (VALUE)outer_scope; rb_parser_set_context(parser, outer_scope, FALSE); RB_GC_GUARD(outer_scope_v); @@ -1010,11 +1005,9 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, c https://github.com/ruby/ruby/blob/trunk/iseq.c#L1005 rb_exc_raise(GET_EC()->errinfo); } else { - INITIALIZED VALUE label = parent ? - parent->body->location.label : - rb_fstring_lit("<compiled>"); + INITIALIZED VALUE label = rb_fstring_lit("<compiled>"); iseq = rb_iseq_new_with_opt(&ast->body, label, file, realpath, line, - parent, type, &option); + 0, ISEQ_TYPE_TOP, &option); rb_ast_dispose(ast); } @@ -1024,13 +1017,7 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, c https://github.com/ruby/ruby/blob/trunk/iseq.c#L1017 rb_iseq_t * rb_iseq_compile(VALUE src, VALUE file, VALUE line) { - return rb_iseq_compile_with_option(src, file, Qnil, line, 0, Qnil); -} - -rb_iseq_t * -rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, const struct rb_block *base_block) -{ - return rb_iseq_compile_with_option(src, file, Qnil, line, base_block, Qnil); + return rb_iseq_compile_with_option(src, file, Qnil, line, Qnil); } VALUE @@ -1214,7 +1201,7 @@ iseqw_s_compile(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/iseq.c#L1201 Check_Type(path, T_STRING); Check_Type(file, T_STRING); - return iseqw_new(rb_iseq_compile_with_option(src, file, path, line, 0, opt)); + return iseqw_new(rb_iseq_compile_with_option(src, file, path, line, opt)); } /* diff --git a/vm_core.h b/vm_core.h index 8eb1555..7ff943a 100644 --- a/vm_core.h +++ b/vm_core.h @@ -1021,8 +1021,7 @@ rb_iseq_t *rb_iseq_new_with_callback(const struct rb_iseq_new_with_callback_call https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1021 /* src -> iseq */ rb_iseq_t *rb_iseq_compile(VALUE src, VALUE file, VALUE line); -rb_iseq_t *rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, const struct rb_block *base_block); -rb_iseq_t *rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, const struct rb_block *base_block, VALUE opt); +rb_iseq_t *rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, VALUE opt); VALUE rb_iseq_disasm(const rb_iseq_t *iseq); int rb_iseq_disasm_insn(VALUE str, const VALUE *iseqval, size_t pos, const rb_iseq_t *iseq, VALUE child); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/