10000 use local_size from the dumped iseq · github/ruby@5d4a25c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d4a25c

Browse files
committed
use local_size from the dumped iseq
1 parent 50847d6 commit 5d4a25c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5928,7 +5928,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
59285928
static inline VALUE CHECK_INTEGER(VALUE v) {(void)NUM2LONG(v); return v;}
59295929

59305930
VALUE
5931-
rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
5931+
rb_iseq_build_from_ary(rb_iseq_t *iseq, int local_size, VALUE locals, VALUE args,
59325932
VALUE exception, VALUE body)
59335933
{
59345934
int i;
@@ -5937,7 +5937,7 @@ rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
59375937
DECL_ANCHOR(anchor);
59385938
INIT_ANCHOR(anchor);
59395939

5940-
iseq->local_table_size = RARRAY_LENINT(locals);
5940+
iseq->local_table_size = local_size;
59415941
iseq->local_table = tbl = (ID *)ALLOC_N(ID, iseq->local_table_size);
59425942
iseq->local_size = iseq->local_table_size + 1;
59435943

iseq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
488488
rb_iseq_t *iseq;
489489
rb_compile_option_t option;
490490
int i = 0;
491+
int local_size;
491492

492493
/* [magic, major_version, minor_version, format_type, misc,
493494
* label, path, first_lineno,
@@ -511,6 +512,7 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
511512

512513
type = CHECK_SYMBOL(rb_ary_entry(data, i++));
513514
locals = CHECK_ARRAY(rb_ary_entry(data, i++));
515+
local_size = NUM2INT(rb_hash_aref(misc, ID2SYM(rb_intern("local_size"))));
514516

515517
args = rb_ary_entry(data, i++);
516518
if (FIXNUM_P(args) || (args = CHECK_ARRAY(args))) {
@@ -561,7 +563,7 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
561563
prepare_iseq_build(iseq, name, path, absolute_path, first_lineno,
562564
parent, (enum iseq_type)iseq_type, 0, &option);
563565

564-
rb_iseq_build_from_ary(iseq, locals, args, exception, body);
566+
rb_iseq_build_from_ary(iseq, local_size, locals, args, exception, body);
565567

566568
cleanup_iseq_build(iseq);
567569
return iseqval;

iseq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUBY_SYMBOL_EXPORT_BEGIN
1717
/* compile.c */
1818
VALUE rb_iseq_compile_node(VALUE self, NODE *node);
1919
int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
20-
VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
20+
VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, int local_size, VALUE locals, VALUE args,
2121
VALUE exception, VALUE body);
2222

2323
/* iseq.c */

0 commit comments

Comments
 (0)
0