ruby-changes:3450
From: ko1@a...
Date: 8 Jan 2008 13:06:16 +0900
Subject: [ruby-changes:3450] nobu - Ruby:r14943 (trunk): * compile.c (iseq_build_from_ary), iseq.c (iseq_load): fix for format change.
nobu 2008-01-08 13:05:59 +0900 (Tue, 08 Jan 2008) New Revision: 14943 Modified files: trunk/ChangeLog trunk/compile.c trunk/iseq.c Log: * compile.c (iseq_build_from_ary), iseq.c (iseq_load): fix for format change. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/compile.c?r1=14943&r2=14942&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14943&r2=14942&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/iseq.c?r1=14943&r2=14942&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 14942) +++ ChangeLog (revision 14943) @@ -1,3 +1,7 @@ +Tue Jan 8 13:05:57 2008 Nobuyoshi Nakada <nobu@r...> + + * compile.c (iseq_build_from_ary), iseq.c (iseq_load): fix for format change. + Tue Jan 8 07:56:11 2008 Tanaka Akira <akr@f...> * string.c (rb_str_buf_append): fix append itself. Index: iseq.c =================================================================== --- iseq.c (revision 14942) +++ iseq.c (revision 14943) @@ -323,48 +323,48 @@ #define CHECK_ARRAY(v) rb_convert_type(v, T_ARRAY, "Array", "to_ary") #define CHECK_STRING(v) rb_convert_type(v, T_STRING, "String", "to_str") #define CHECK_SYMBOL(v) rb_convert_type(v, T_SYMBOL, "Symbol", "to_sym") -#define CHECK_INTEGER(v) (NUM2LONG(v), v) +static inline VALUE CHECK_INTEGER(VALUE v) {NUM2LONG(v); return v;} VALUE iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt) { VALUE iseqval = iseq_alloc(rb_cISeq); VALUE magic, version1, version2, format_type, misc; - VALUE name, filename, line; + VALUE name, filename; VALUE type, body, locals, args, exception; VALUE iseq_type; struct st_table *type_map = 0; rb_iseq_t *iseq; rb_compile_option_t option; + int i = 0; /* [magic, major_version, minor_version, format_type, misc, - * name, filename, line, + * name, filename, * type, locals, args, exception_table, body] */ data = CHECK_ARRAY(data); - magic = CHECK_STRING(rb_ary_entry(data, 0)); - version1 = CHECK_INTEGER(rb_ary_entry(data, 1)); - version2 = CHECK_INTEGER(rb_ary_entry(data, 2)); - format_type = CHECK_INTEGER(rb_ary_entry(data, 3)); - misc = rb_ary_entry(data, 4); /* TODO */ + magic = CHECK_STRING(rb_ary_entry(data, i++)); + version1 = CHECK_INTEGER(rb_ary_entry(data, i++)); + version2 = CHECK_INTEGER(rb_ary_entry(data, i++)); + format_type = CHECK_INTEGER(rb_ary_entry(data, i++)); + misc = rb_ary_entry(data, i++); /* TODO */ - name = CHECK_STRING(rb_ary_entry(data, 5)); - filename = CHECK_STRING(rb_ary_entry(data, 6)); - line = CHECK_ARRAY(rb_ary_entry(data, 7)); + name = CHECK_STRING(rb_ary_entry(data, i++)); + filename = CHECK_STRING(rb_ary_entry(data, i++)); - type = CHECK_SYMBOL(rb_ary_entry(data, 8)); - locals = CHECK_ARRAY(rb_ary_entry(data, 9)); + type = CHECK_SYMBOL(rb_ary_entry(data, i++)); + locals = CHECK_ARRAY(rb_ary_entry(data, i++)); - args = rb_ary_entry(data, 10); + args = rb_ary_entry(data, i++); if (FIXNUM_P(args) || (args = CHECK_ARRAY(args))) { /* */ } - exception = CHECK_ARRAY(rb_ary_entry(data, 11)); - body = CHECK_ARRAY(rb_ary_entry(data, 12)); + exception = CHECK_ARRAY(rb_ary_entry(data, i++)); + body = CHECK_ARRAY(rb_ary_entry(data, i++)); GetISeqPtr(iseqval, iseq); iseq->self = iseqval; Index: compile.c =================================================================== --- compile.c (revision 14942) +++ compile.c (revision 14943) @@ -4831,7 +4831,7 @@ #define CHECK_ARRAY(v) rb_convert_type(v, T_ARRAY, "Array", "to_ary") #define CHECK_STRING(v) rb_convert_type(v, T_STRING, "String", "to_str") #define CHECK_SYMBOL(v) rb_convert_type(v, T_SYMBOL, "Symbol", "to_sym") -#define CHECK_INTEGER(v) (NUM2LONG(v), v) +static inline VALUE CHECK_INTEGER(VALUE v) {NUM2LONG(v); return v;} VALUE iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, @@ -4868,20 +4868,19 @@ else { int i = 0; VALUE argc = CHECK_INTEGER(rb_ary_entry(args, i++)); - VALUE arg_opts = CHECK_INTEGER(rb_ary_entry(args, i++)); VALUE arg_opt_labels = CHECK_ARRAY(rb_ary_entry(args, i++)); VALUE arg_post_len = CHECK_INTEGER(rb_ary_entry(args, i++)); VALUE arg_post_start = CHECK_INTEGER(rb_ary_entry(args, i++)); VALUE arg_rest = CHECK_INTEGER(rb_ary_entry(args, i++)); VALUE arg_block = CHECK_INTEGER(rb_ary_entry(args, i++)); + VALUE arg_simple = CHECK_INTEGER(rb_ary_entry(args, i++)); iseq->argc = FIX2INT(argc); - iseq->arg_opts = FIX2INT(arg_opts); iseq->arg_rest = FIX2INT(arg_rest); iseq->arg_post_len = FIX2INT(arg_post_len); iseq->arg_post_start = FIX2INT(arg_post_start); iseq->arg_block = FIX2INT(arg_block); - iseq->arg_opt_table = (VALUE *)ALLOC_N(VALUE, iseq->arg_opts); + iseq->arg_opt_table = (VALUE *)ALLOC_N(VALUE, RARRAY_LEN(arg_opt_labels)); if (iseq->arg_block != -1) { iseq->arg_size = iseq->arg_block + 1; @@ -4901,6 +4900,8 @@ (VALUE)register_label(iseq, labels_table, rb_ary_entry(arg_opt_labels, i)); } + + iseq->arg_simple = NUM2INT(arg_simple); } /* exception */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml