[前][次][番号順一覧][スレッド一覧]

ruby-changes:13269

From: nobu <ko1@a...>
Date: Tue, 22 Sep 2009 05:58:46 +0900 (JST)
Subject: [ruby-changes:13269] Ruby:r25030 (trunk): * compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,

nobu	2009-09-22 05:58:26 +0900 (Tue, 22 Sep 2009)

  New Revision: 25030

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25030

  Log:
    * compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
      thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
      vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
      tool/instruction.rb: fixed types.

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/cont.c
    trunk/gc.c
    trunk/insns.def
    trunk/iseq.c
    trunk/iseq.h
    trunk/process.c
    trunk/template/insns_info.inc.tmpl
    trunk/thread.c
    trunk/tool/instruction.rb
    trunk/vm.c
    trunk/vm_core.h
    trunk/vm_dump.c
    trunk/vm_eval.c
    trunk/vm_insnhelper.c
    trunk/vm_method.c

Index: insns.def
===================================================================
--- insns.def	(revision 25029)
+++ insns.def	(revision 25030)
@@ -583,7 +583,7 @@
 (...)
 (VALUE val) // inc += 1 - num;
 {
-    int i;
+    rb_num_t i;
     val = rb_hash_new();
 
     for (i = num; i > 0; i -= 2) {
@@ -982,8 +982,8 @@
     const rb_method_entry_t *me;
     VALUE recv, klass;
     rb_block_t *blockptr = 0;
-    rb_num_t num = caller_setup_args(th, GET_CFP(), op_flag, (int)op_argc,
-				     (rb_iseq_t *)blockiseq, &blockptr);
+    int num = caller_setup_args(th, GET_CFP(), op_flag, (int)op_argc,
+				(rb_iseq_t *)blockiseq, &blockptr);
     rb_num_t flag = op_flag;
     ID id = op_id;
 
@@ -1008,8 +1008,8 @@
 (VALUE val) // inc += - (int)(op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));
 {
     rb_block_t *blockptr = !(op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? GET_BLOCK_PTR() : 0;
-    rb_num_t num = caller_setup_args(th, GET_CFP(), op_flag,
-				     (int)op_argc, blockiseq, &blockptr);
+    int num = caller_setup_args(th, GET_CFP(), op_flag,
+				(int)op_argc, blockiseq, &blockptr);
     VALUE recv, klass;
     ID id;
     VALUE flag = VM_CALL_SUPER_BIT | VM_CALL_FCALL_BIT;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25029)
+++ ChangeLog	(revision 25030)
@@ -1,3 +1,10 @@
+Tue Sep 22 05:58:25 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
+	  thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
+	  vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
+	  tool/instruction.rb: fixed types.
+
 Tue Sep 22 05:04:08 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/bigdecimal/lib/bigdecimal/{ludcmp,math}.rb: depend on
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 25029)
+++ vm_core.h	(revision 25030)
@@ -125,7 +125,7 @@
 } rb_compile_option_t;
 
 struct iseq_inline_cache_entry {
-    long  ic_vmstat;
+    VALUE ic_vmstat;
     VALUE ic_class;
     union {
 	VALUE value;
@@ -471,7 +471,7 @@
 VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, const rb_compile_option_t*);
 VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line);
 VALUE rb_iseq_disasm(VALUE self);
-VALUE rb_iseq_disasm_insn(VALUE str, VALUE *iseqval, int pos, rb_iseq_t *iseq, VALUE child);
+int rb_iseq_disasm_insn(VALUE str, VALUE *iseqval, size_t pos, rb_iseq_t *iseq, VALUE child);
 const char *ruby_node_name(int node);
 int rb_iseq_first_lineno(rb_iseq_t *iseq);
 
@@ -616,7 +616,7 @@
 int ruby_thread_has_gvl_p(void);
 VALUE rb_make_backtrace(void);
 typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
-VALUE rb_backtrace_each(rb_backtrace_iter_func *iter, void *arg);
+int rb_backtrace_each(rb_backtrace_iter_func *iter, void *arg);
 rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
 
 NOINLINE(void rb_gc_save_machine_context(rb_thread_t *));
Index: iseq.c
===================================================================
--- iseq.c	(revision 25029)
+++ iseq.c	(revision 25030)
@@ -710,8 +710,8 @@
 
 static VALUE
 insn_operand_intern(rb_iseq_t *iseq,
-		    int insn, int op_no, VALUE op,
-		    int len, int pos, VALUE *pnop, VALUE child)
+		    VALUE insn, int op_no, VALUE op,
+		    int len, size_t pos, VALUE *pnop, VALUE child)
 {
     const char *types = insn_op_types(insn);
     char type = types[op_no];
@@ -729,7 +729,7 @@
       case TS_LINDEX:
 	{
 	    rb_iseq_t *ip = iseq->local_iseq;
-	    int lidx = ip->local_size - op;
+	    int lidx = ip->local_size - (int)op;
 	    const char *name = rb_id2name(ip->local_table[lidx]);
 
 	    if (name) {
@@ -743,7 +743,7 @@
       case TS_DINDEX:{
 	if (insn == BIN(getdynamic) || insn == BIN(setdynamic)) {
 	    rb_iseq_t *ip = iseq;
-	    int level = *pnop, i;
+	    VALUE level = *pnop, i;
 	    const char *name;
 	    for (i = 0; i < level; i++) {
 		ip = ip->parent_iseq;
@@ -814,11 +814,11 @@
  * Disassemble a instruction
  * Iseq -> Iseq inspect object
  */
-VALUE
-rb_iseq_disasm_insn(VALUE ret, VALUE *iseq, int pos,
+int
+rb_iseq_disasm_insn(VALUE ret, VALUE *iseq, size_t pos,
 		    rb_iseq_t *iseqdat, VALUE child)
 {
-    int insn = iseq[pos];
+    VALUE insn = iseq[pos];
     int len = insn_len(insn);
     int j;
     const char *types = insn_op_types(insn);
@@ -827,10 +827,10 @@
 
     insn_name_buff = insn_name(insn);
     if (1) {
-	rb_str_catf(str, "%04d %-16s ", pos, insn_name_buff);
+	rb_str_catf(str, "%04"PRIdSIZE" %-16s ", pos, insn_name_buff);
     }
     else {
-	rb_str_catf(str, "%04d %-16.*s ", pos,
+	rb_str_catf(str, "%04"PRIdSIZE" %-16.*s ", pos,
 		    (int)strcspn(insn_name_buff, "_"), insn_name_buff);
     }
 
@@ -907,6 +907,7 @@
     int i;
     long l;
     ID *tbl;
+    size_t n;
     enum {header_minlen = 72};
 
     rb_secure(1);
@@ -986,8 +987,8 @@
     }
 
     /* show each line */
-    for (i = 0; (size_t)i < size;) {
-	i += rb_iseq_disasm_insn(str, iseq, i, iseqdat, child);
+    for (n = 0; n < size;) {
+	n += rb_iseq_disasm_insn(str, iseq, n, iseqdat, child);
     }
 
     for (i = 0; i < RARRAY_LEN(child); i++) {
@@ -1032,12 +1033,12 @@
   sym_##name = ID2SYM(rb_intern(#name))
 
 static VALUE
-register_label(struct st_table *table, int idx)
+register_label(struct st_table *table, unsigned long idx)
 {
     VALUE sym;
     char buff[8 + (sizeof(idx) * CHAR_BIT * 32 / 100)];
 
-    snprintf(buff, sizeof(buff), "label_%u", idx);
+    snprintf(buff, sizeof(buff), "label_%lu", idx);
     sym = ID2SYM(rb_intern(buff));
     st_insert(table, idx, sym);
     return sym;
@@ -1071,7 +1072,8 @@
 static VALUE
 iseq_data_to_ary(rb_iseq_t *iseq)
 {
-    int i, pos, line = 0;
+    long i, pos;
+    int line = 0;
     VALUE *seq;
 
     VALUE val = rb_ary_new();
@@ -1183,7 +1185,7 @@
 	for (j=0; j<len-1; j++, seq++) {
 	    switch (insn_op_type(insn, j)) {
 	      case TS_OFFSET: {
-		unsigned int idx = nseq - iseq->iseq + *seq;
+		unsigned long idx = nseq - iseq->iseq + *seq;
 		rb_ary_push(ary, register_label(labels_table, idx));
 		break;
 	      }
@@ -1229,7 +1231,7 @@
 
 		    for (i=0; i<RARRAY_LEN(val); i+=2) {
 			VALUE pos = FIX2INT(rb_ary_entry(val, i+1));
-			unsigned int idx = nseq - iseq->iseq + pos;
+			unsigned long idx = nseq - iseq->iseq + pos;
 
 			rb_ary_store(val, i+1,
 				     register_label(labels_table, idx));
Index: iseq.h
===================================================================
--- iseq.h	(revision 25029)
+++ iseq.h	(revision 25030)
@@ -32,12 +32,12 @@
 #define ISEQ_TYPE_MAIN   INT2FIX(8)
 #define ISEQ_TYPE_DEFINED_GUARD INT2FIX(9)
 
-#define CATCH_TYPE_RESCUE INT2FIX(1)
-#define CATCH_TYPE_ENSURE INT2FIX(2)
-#define CATCH_TYPE_RETRY  INT2FIX(3)
-#define CATCH_TYPE_BREAK  INT2FIX(4)
-#define CATCH_TYPE_REDO   INT2FIX(5)
-#define CATCH_TYPE_NEXT   INT2FIX(6)
+#define CATCH_TYPE_RESCUE ((int)INT2FIX(1))
+#define CATCH_TYPE_ENSURE ((int)INT2FIX(2))
+#define CATCH_TYPE_RETRY  ((int)INT2FIX(3))
+#define CATCH_TYPE_BREAK  ((int)INT2FIX(4))
+#define CATCH_TYPE_REDO   ((int)INT2FIX(5))
+#define CATCH_TYPE_NEXT   ((int)INT2FIX(6))
 
 struct iseq_insn_info_entry {
     unsigned short position;
@@ -74,10 +74,10 @@
     struct iseq_label_data *end_label;
     struct iseq_label_data *redo_label;
     VALUE current_block;
-    VALUE loopval_popped;	/* used by NODE_BREAK */
     VALUE ensure_node;
     VALUE for_iseq;
     struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
+    int loopval_popped;	/* used by NODE_BREAK */
     int cached_const;
     struct iseq_compile_data_storage *storage_head;
     struct iseq_compile_data_storage *storage_current;
Index: compile.c
===================================================================
--- compile.c	(revision 25029)
+++ compile.c	(revision 25030)
@@ -50,7 +50,7 @@
 typedef struct iseq_insn_data {
     LINK_ELEMENT link;
     enum ruby_vminsn_type insn_id;
-    long line_no;
+    int line_no;
     int operand_size;
     int sc_state;
     VALUE *operands;
@@ -59,7 +59,7 @@
 typedef struct iseq_adjust_data {
     LINK_ELEMENT link;
     LABEL *label;
-    long line_no;
+    int line_no;
 } ADJUST;
 
 struct ensure_range {
@@ -327,9 +327,9 @@
 
 static void ADD_ELEM(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor, LINK_ELEMENT *elem);
 
-static INSN *new_insn_body(rb_iseq_t *iseq, long line_no, int insn_id, int argc, ...);
+static INSN *new_insn_body(rb_iseq_t *iseq, int line_no, int insn_id, int argc, ...);
 static LABEL *new_label_body(rb_iseq_t *iseq, long line);
-static ADJUST *new_adjust_body(rb_iseq_t *iseq, LABEL *label, long line);
+static ADJUST *new_adjust_body(rb_iseq_t *iseq, LABEL *label, int line);
 
 static int iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *anchor, NODE * n, int);
 static int iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *anchor);
@@ -849,7 +849,7 @@
 }
 
 static ADJUST *
-new_adjust_body(rb_iseq_t *iseq, LABEL *label, long line)
+new_adjust_body(rb_iseq_t *iseq, LABEL *label, int line)
 {
     ADJUST *adjust = compile_data_alloc_adjust(iseq);
     adjust->link.type = ISEQ_ELEMENT_ADJUST;
@@ -860,7 +860,7 @@
 }
 
 static INSN *
-new_insn_core(rb_iseq_t *iseq, long line_no,
+new_insn_core(rb_iseq_t *iseq, int line_no,
 	      int insn_id, int argc, VALUE *argv)
 {
     INSN *iobj = compile_data_alloc_insn(iseq);
@@ -876,7 +876,7 @@
 }
 
 static INSN *
-new_insn_body(rb_iseq_t *iseq, long line_no, int insn_id, int argc, ...)
+new_insn_body(rb_iseq_t *iseq, int line_no, int insn_id, int argc, ...)
 {
     VALUE *operands = 0;
     va_list argv;
@@ -1283,7 +1283,7 @@
 	    {
 		lobj = (LABEL *)list;
 		lobj->position = pos;
-		lobj->set = Qtrue;
+		lobj->set = TRUE;
 		break;
 	    }
 	  case ISEQ_ELEMENT_NONE:
@@ -1365,7 +1365,7 @@
 			{
 			    /* label(destination position) */
 			    lobj = (LABEL *)operands[j];
-			    if (lobj->set != Qtrue) {
+			    if (!lobj->set) {
 				rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
 						 "unknown label");
 			    }
@@ -1391,7 +1391,7 @@
 				VALUE lv  = rb_ary_entry(lits, i+1);
 				lobj = (LABEL *)(lv & ~1);
 
-				if (lobj->set != Qtrue) {
+				if (!lobj->set) {
 				    rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
 						     "unknown label");
 				}
@@ -2655,13 +2655,13 @@
       case NODE_VCALL:
       case NODE_FCALL:
       case NODE_ATTRASGN:{
-	int self = Qtrue;
+	int self = TRUE;
 
 	switch (type) {
 	  case NODE_ATTRASGN:
 	    if (node->nd_recv == (NODE *)1) break;
 	  case NODE_CALL:
-	    self = Qfalse;
+	    self = FALSE;
 	    break;
 	  default:
 	    /* through */;
@@ -3167,7 +3167,7 @@
 	LABEL *prev_start_label = iseq->compile_data->start_label;
 	LABEL *prev_end_label = iseq->compile_data->end_label;
 	LABEL *prev_redo_label = iseq->compile_data->redo_label;
-	VALUE prev_loopval_popped = iseq->compile_data->loopval_popped;
+	int prev_loopval_popped = iseq->compile_data->loopval_popped;
 
 	struct iseq_compile_data_ensure_node_stack enl;
 
@@ -4700,7 +4700,7 @@
       }
       case NODE_DOT2:
       case NODE_DOT3:{
-	int flag = type == NODE_DOT2 ? INT2FIX(0) : INT2FIX(1);
+	VALUE flag = type == NODE_DOT2 ? INT2FIX(0) : INT2FIX(1);
 	COMPILE(ret, "min", (NODE *) node->nd_beg);
 	COMPILE(ret, "max", (NODE *) node->nd_end);
 	if (poped) {
@@ -4924,7 +4924,7 @@
       }
       default:
 	rb_bug("iseq_compile_each: unknown node: %s", ruby_node_name(type));
-	return Qnil;
+	return COMPILE_NG;
     }
 
     debug_node_end();
@@ -5175,8 +5175,8 @@
 {
     /* TODO: body should be freezed */
     VALUE *ptr = RARRAY_PTR(body);
-    int len = RARRAY_LEN(body);
-    int i, j;
+    long i, len = RARRAY_LEN(body);
+    int j;
     int line_no = 0;
     /*
      * index -> LABEL *label
@@ -5199,7 +5199,7 @@
 	}
 	else if (TYPE(obj) == T_ARRAY) {
 	    VALUE *argv = 0;
-	    int argc = (int)RARRAY_LEN(obj) - 1;
+	    int argc = RARRAY_LENINT(obj) - 1;
 	    VALUE insn_id;
 	    VALUE insn;
 
@@ -5286,7 +5286,7 @@
 	    }
 	    ADD_ELEM(anchor,
 		     (LINK_ELEMENT*)new_insn_core(iseq, line_no,
-						  insn_id, argc, argv));
+						  (enum ruby_vminsn_type)insn_id, argc, argv));
 	}
 	else {
 	    rb_raise(rb_eTypeError, "unexpected object for instruction");
@@ -5314,7 +5314,7 @@
 
     INIT_ANCHOR(anchor);
 
-    iseq->local_table_size = RARRAY_LEN(locals);
+    iseq->local_table_size = RARRAY_LENINT(locals);
     iseq->local_table = tbl = (ID *)ALLOC_N(ID *, iseq->local_table_size);
     iseq->local_size = iseq->local_table_size + 1;
 
@@ -5343,7 +5343,7 @@
 	iseq->arg_post_len = FIX2INT(arg_post_len);
 	iseq->arg_post_start = FIX2INT(arg_post_start);
 	iseq->arg_block = FIX2INT(arg_block);
-	iseq->arg_opts = RARRAY_LEN(arg_opt_labels);
+	iseq->arg_opts = RARRAY_LENINT(arg_opt_labels);
 	iseq->arg_opt_table = (VALUE *)ALLOC_N(VALUE, iseq->arg_opts);
 
 	if (iseq->arg_block != -1) {
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 25029)
+++ vm_eval.c	(revision 25030)
@@ -1265,9 +1265,11 @@
 }
 
 static VALUE
-catch_i(VALUE tag, VALUE data) {
+catch_i(VALUE tag, VALUE data)
+{
     return rb_yield_0(1, &tag);
 }
+
 /*
  *  call-seq:
  *     catch([arg]) {|tag| block }  => obj
@@ -1403,7 +1405,7 @@
 {
     fprintf((FILE *)arg, "\tfrom %s:%d:in `%s'\n",
 	    RSTRING_PTR(file), line, RSTRING_PTR(method));
-    return Qfalse;
+    return FALSE;
 }
 
 void
@@ -1437,7 +1439,7 @@
     return vm_backtrace(th, 0);
 }
 
-VALUE
+int
 rb_backtrace_each(rb_backtrace_iter_func *iter, void *arg)
 {
     return vm_backtrace_each(GET_THREAD(), -1, iter, arg);
Index: thread.c
===================================================================
--- thread.c	(revision 25029)
+++ thread.c	(revision 25030)
@@ -2528,7 +2528,7 @@
 rb_thread_fd_writable(int fd)
 {
     rb_thread_wait_fd_rw(fd, 0);
-    return Qtrue;
+    return TRUE;
 }
 
 int
@@ -3537,7 +3537,7 @@
     recursive_push(p->list, p->objid, p->pairid);
     PUSH_TAG();
     if ((state = EXEC_TAG()) == 0) {
-	result = (*p->func) (p->obj, p->arg, Qfalse);
+	result = (*p->func)(p->obj, p->arg, FALSE);
     }
     POP_TAG();
     recursive_pop(p->list, p->objid, p->pairid);
@@ -3570,7 +3570,7 @@
 	if (outer && !outermost) {
 	    rb_throw_obj(p.list, p.list);
 	}
-	return (*func) (obj, arg, Qtrue);
+	return (*func)(obj, arg, TRUE);
     }
     else {
 	VALUE result = Qundef;
@@ -3584,7 +3584,7 @@
 	    result = rb_catch_obj(p.list, exec_recursive_i, (VALUE)&p);
 	    recursive_pop(p.list, ID2SYM(recursive_key), 0);
 	    if (result == p.list) {
-		result = (*func) (obj, arg, Qtrue);
+		result = (*func)(obj, arg, TRUE);
 	    }
 	}
 	else {
@@ -4004,7 +4004,7 @@
     args.self = self;
     args.id = id;
     args.klass = klass;
-    ruby_suppress_tracing(call_trace_proc, (VALUE)&args, Qfalse);
+    ruby_suppress_tracing(call_trace_proc, (VALUE)&args, FALSE);
 }
 
 VALUE
@@ -4170,7 +4170,7 @@
 {
     rb_thread_t *th = ruby_thread_from_native();
 
-    return th ? Qtrue : Qfalse;
+    return th != 0;
 }
 
 static int
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 25029)
+++ vm_method.c	(revision 25030)
@@ -455,7 +455,7 @@
 }
 
 static void
-rb_export_method(VALUE klass, ID name, ID noex)
+rb_export_method(VALUE klass, ID name, rb_method_flag_t noex)
 {
     rb_method_entry_t *me;
 
@@ -491,14 +491,14 @@
 
     if (me != 0) {
 	if (ex && (me->flag & NOEX_PRIVATE)) {
-	    return Qfalse;
+	    return FALSE;
 	}
 	if (!me->def || me->def->type == VM_METHOD_TYPE_NOTIMPLEMENTED) {
-	    return Qfalse;
+	    return FALSE;
 	}
-	return Qtrue;
+	return TRUE;
     }
-    return Qfalse;
+    return FALSE;
 }
 
 void
@@ -879,7 +879,7 @@
 }
 
 static void
-set_method_visibility(VALUE self, int argc, VALUE *argv, ID ex)
+set_method_visibility(VALUE self, int argc, VALUE *argv, rb_method_flag_t ex)
 {
     int i;
     secure_visibility(self);
@@ -1135,7 +1135,7 @@
 int
 rb_respond_to(VALUE obj, ID id)
 {
-    return rb_obj_respond_to(obj, id, Qfalse);
+    return rb_obj_respond_to(obj, id, FALSE);
 }
 
 /*
Index: gc.c
===================================================================
--- gc.c	(revision 25029)
+++ gc.c	(revision 25030)
@@ -396,7 +396,7 @@
 	}
     }
     if (heaps) {
-	int i;
+	size_t i;
 	for (i = 0; i < heaps_used; ++i) {
 	    free(heaps[i].membase);
 	}
Index: process.c
===================================================================
--- process.c	(revision 25029)
+++ process.c	(revision 25030)
@@ -1769,7 +1769,7 @@
 #define CHILD_ERRMSG_BUFLEN 80
     char errmsg[CHILD_ERRMSG_BUFLEN] = { '\0' };
 
-    rb_exec_arg_init(argc, argv, Qtrue, &earg);
+    rb_exec_arg_init(argc, argv, TRUE, &earg);
     if (NIL_P(rb_ary_entry(earg.options, EXEC_OPTION_CLOSE_OTHERS)))
         rb_exec_arg_addopt(&earg, ID2SYM(rb_intern("close_others")), Qfalse);
     rb_exec_arg_fixup(&earg);
@@ -1924,7 +1924,7 @@
     struct fd_pair {
         int oldfd;
         int newfd;
-        int older_index;
+        long older_index;
         int num_newer;
     } *pairs = 0;
 
@@ -1969,7 +1969,7 @@
 
     /* non-cyclic redirection: O(n) */
     for (i = 0; i < n; i++) {
-        int j = i;
+        long j = i;
         while (j != -1 && pairs[j].oldfd != -1 && pairs[j].num_newer == 0) {
             if (save_redirect_fd(pairs[j].newfd, save, errmsg, errmsg_buflen) < 0)
                 goto fail;
@@ -1987,7 +1987,7 @@
 
     /* cyclic redirection: O(n) */
     for (i = 0; i < n; i++) {
-        int j;
+        long j;
         if (pairs[i].oldfd == -1)
             continue;
         if (pairs[i].oldfd == pairs[i].newfd) { /* self cycle */
@@ -2812,7 +2812,7 @@
 #endif
     RETSIGTYPE (*ifunc)(int) = 0;
     int status;
-    int i, hooked = Qfalse;
+    int i, hooked = FALSE;
 
     if (!overriding) {
 #ifdef SIGHUP
@@ -2822,8 +2822,8 @@
 	qfunc = signal(SIGQUIT, SIG_IGN);
 #endif
 	ifunc = signal(SIGINT, SIG_IGN);
-	overriding = Qtrue;
-	hooked = Qtrue;
+	overriding = TRUE;
+	hooked = TRUE;
     }
 
     do {
@@ -2838,7 +2838,7 @@
 	signal(SIGQUIT, qfunc);
 #endif
 	signal(SIGINT, ifunc);
-	overriding = Qfalse;
+	overriding = FALSE;
     }
 }
 
@@ -2856,7 +2856,7 @@
     struct rb_exec_arg sarg;
 #endif
 
-    prog = rb_exec_arg_init(argc, argv, Qtrue, &earg);
+    prog = rb_exec_arg_init(argc, argv, TRUE, &earg);
     if (NIL_P(rb_ary_entry(earg.options, EXEC_OPTION_CLOSE_OTHERS))) {
         VALUE v = default_close_others ? Qtrue : Qfalse;
         rb_exec_arg_addopt(&earg, ID2SYM(rb_intern("close_others")), v);
@@ -2899,13 +2899,13 @@
 rb_pid_t
 rb_spawn_err(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
 {
-    return rb_spawn_internal(argc, argv, Qtrue, errmsg, errmsg_buflen);
+    return rb_spawn_internal(argc, argv, TRUE, errmsg, errmsg_buflen);
 }
 
 rb_pid_t
 rb_spawn(int argc, VALUE *argv)
 {
-    return rb_spawn_internal(argc, argv, Qtrue, NULL, 0);
+    return rb_spawn_internal(argc, argv, TRUE, NULL, 0);
 }
 
 /*
@@ -2954,7 +2954,7 @@
 
     chfunc = signal(SIGCHLD, SIG_DFL);
 #endif
-    pid = rb_spawn_internal(argc, argv, Qfalse, NULL, 0);
+    pid = rb_spawn_internal(argc, argv, FALSE, NULL, 0);
 #if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
     if (pid > 0) {
 	rb_syswait(pid);
@@ -4348,7 +4348,7 @@
 #endif
 
 
-static size_t maxgroups = 32;
+static int maxgroups = 32;
 
 
 #ifdef HAVE_GETGROUPS
@@ -4367,13 +4367,13 @@
 proc_getgroups(VALUE obj)
 {
     VALUE ary;
-    size_t i, ngroups;
+    int i, ngroups;
     rb_gid_t *groups;
 
     groups = ALLOCA_N(rb_gid_t, maxgroups);
 
     ngroups = getgroups(maxgroups, groups);
-    if (ngroups == (size_t)-1)
+    if (ngroups == -1)
 	rb_sys_fail(0);
 
     ary = rb_ary_new();
@@ -4438,7 +4438,7 @@
 	}
     }
 
-    if (setgroups(ngroups, groups) == -1)
+    if (setgroups((int)ngroups, groups) == -1) /* ngroups <= maxgroups */
 	rb_sys_fail(0);
 
     return proc_getgroups(obj);
@@ -4507,7 +4507,7 @@
 static VALUE
 proc_setmaxgroups(VALUE obj, VALUE val)
 {
-    size_t  ngroups = FIX2INT(val);
+    int ngroups = FIX2UINT(val);
 
     if (ngroups > 4096)
 	ngroups = 4096;
Index: cont.c
===================================================================
--- cont.c	(revision 25029)
+++ cont.c	(revision 25030)
@@ -41,7 +41,7 @@
 #endif
     rb_thread_t saved_thread;
     rb_jmpbuf_t jmpbuf;
-    int machine_stack_size;
+    size_t machine_stack_size;
 } rb_context_t;
 
 enum fiber_status {
Index: vm.c
===================================================================
--- vm.c	(revision 25029)
+++ vm.c	(revision 25030)
@@ -729,7 +729,7 @@
     cfp -= 2;
     while (lev-- >= 0) {
 	if (++limit_cfp >= cfp) {
-	    return Qfalse;
+	    return FALSE;
 	}
     }
     limit_cfp = RUBY_VM_NEXT_CONTROL_FRAME(limit_cfp);
@@ -750,7 +750,7 @@
 	}
 	cfp = RUBY_VM_NEXT_CONTROL_FRAME(cfp);
     }
-    return Qtrue;
+    return TRUE;
 }
 
 static int
Index: vm_dump.c
===================================================================
--- vm_dump.c	(revision 25029)
+++ vm_dump.c	(revision 25030)
@@ -20,11 +20,12 @@
 static void
 control_frame_dump(rb_thread_t *th, rb_control_frame_t *cfp)
 {
-    int pc = -1, bp = -1, line = 0;
+    ptrdiff_t pc = -1, bp = -1;
     ptrdiff_t lfp = cfp->lfp - th->stack;
     ptrdiff_t dfp = cfp->dfp - th->stack;
     char lfp_in_heap = ' ', dfp_in_heap = ' ';
     char posbuf[MAX_POSBUF+1];
+    int line = 0;
     int nopos = 0;
 
     const char *magic, *iseq_name = "-", *selfstr = "-", *biseq_name = "-";
@@ -124,9 +125,9 @@
 	fprintf(stderr, "p:---- ");
     }
     else {
-	fprintf(stderr, "p:%04d ", pc);
+	fprintf(stderr, "p:%04"PRIdPTRDIFF" ", pc);
     }
-    fprintf(stderr, "s:%04"PRIdPTRDIFF" b:%04d ", (cfp->sp - th->stack), bp);
+    fprintf(stderr, "s:%04"PRIdPTRDIFF" b:%04"PRIdPTRDIFF" ", (cfp->sp - th->stack), bp);
     fprintf(stderr, lfp_in_heap == ' ' ? "l:%06"PRIdPTRDIFF" " : "l:%06"PRIxPTRDIFF" ", lfp % 10000);
     fprintf(stderr, dfp_in_heap == ' ' ? "d:%06"PRIdPTRDIFF" " : "d:%06"PRIxPTRDIFF" ", dfp % 10000);
     fprintf(stderr, "%-6s", magic);
@@ -329,10 +330,10 @@
 rb_vmdebug_debug_print_register(rb_thread_t *th)
 {
     rb_control_frame_t *cfp = th->cfp;
-    int pc = -1;
-    int lfp = cfp->lfp - th->stack;
-    int dfp = cfp->dfp - th->stack;
-    int cfpi;
+    ptrdiff_t pc = -1;
+    ptrdiff_t lfp = cfp->lfp - th->stack;
+    ptrdiff_t dfp = cfp->dfp - th->stack;
+    ptrdiff_t cfpi;
 
     if (RUBY_VM_NORMAL_ISEQ_P(cfp->iseq)) {
 	pc = cfp->pc - cfp->iseq->iseq_encoded;
@@ -344,7 +345,7 @@
 	dfp = -1;
 
     cfpi = ((rb_control_frame_t *)(th->stack + th->stack_size)) - cfp;
-    fprintf(stderr, "  [PC] %04d, [SP] %04"PRIdPTRDIFF", [LFP] %04d, [DFP] %04d, [CFP] %04d\n",
+    fprintf(stderr, "  [PC] %04"PRIdPTRDIFF", [SP] %04"PRIdPTRDIFF", [LFP] %04"PRIdPTRDIFF", [DFP] %04"PRIdPTRDIFF", [CFP] %04"PRIdPTRDIFF"\n",
 	    pc, (cfp->sp - th->stack), lfp, dfp, cfpi);
 }
 
@@ -363,10 +364,12 @@
 
     if (iseq != 0 && VM_FRAME_TYPE(cfp) != VM_FRAME_MAGIC_FINISH) {
 	VALUE *seq = iseq->iseq;
-	int pc = cfp->pc - iseq->iseq_encoded;
+	ptrdiff_t pc = cfp->pc - iseq->iseq_encoded;
 
 	printf("%3"PRIdPTRDIFF" ", VM_CFP_CNT(th, cfp));
-	rb_iseq_disasm_insn(0, seq, pc, iseq, 0);
+	if (pc >= 0) {
+	    rb_iseq_disasm_insn(0, seq, (size_t)pc, iseq, 0);
+	}
     }
 
 #if VMDEBUG > 3
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 25029)
+++ vm_insnhelper.c	(revision 25030)
@@ -778,7 +778,7 @@
     int argc = orig_argc;
     const int m = iseq->argc;
     VALUE ary, arg0;
-    rb_num_t opt_pc = 0;
+    int opt_pc = 0;
 
     th->mark_stack_len = argc;
 
@@ -1024,7 +1024,7 @@
 	    }
 	}
 	else {
-	    val = rb_reg_nth_match(type >> 1, backref);
+	    val = rb_reg_nth_match((int)(type >> 1), backref);
 	}
     }
     return val;
@@ -1212,7 +1212,7 @@
 
 	    if (iv_index_tbl) {
 		if (st_lookup(iv_index_tbl, id, &index)) {
-		    if (index < len) {
+		    if ((long)index < len) {
 			val = ptr[index];
 		    }
 		    ic->ic_class = klass;
@@ -1519,7 +1519,7 @@
     rb_num_t space_size = num + is_splat;
     VALUE *base = cfp->sp, *ptr;
     volatile VALUE tmp_ary;
-    long len;
+    rb_num_t len;
 
     if (TYPE(ary) != T_ARRAY) {
 	ary = rb_ary_to_ary(ary);
@@ -1529,11 +1529,11 @@
 
     tmp_ary = ary;
     ptr = RARRAY_PTR(ary);
-    len = RARRAY_LEN(ary);
+    len = (rb_num_t)RARRAY_LEN(ary);
 
     if (flag & 0x02) {
 	/* post: ..., nil ,ary[-1], ..., ary[0..-num] # top */
-	long i = 0, j;
+	rb_num_t i = 0, j;
 
 	if (len < num) {
 	    for (i=0; i<num-len; i++) {
@@ -1550,7 +1550,7 @@
     }
     else {
 	/* normal: ary[num..-1], ary[num-2], ary[num-3], ..., ary[0] # top */
-	int i;
+	rb_num_t i;
 	VALUE *bptr = &base[space_size - 1];
 
 	for (i=0; i<num; i++) {
Index: tool/instruction.rb
===================================================================
--- tool/instruction.rb	(revision 25029)
+++ tool/instruction.rb	(revision 25030)
@@ -63,12 +63,12 @@
          rets.any?{|t, v| v == '...'})
         # user definision
         raise "no sp increase definition" if @sp_inc.nil?
-        ret = "rb_num_t inc = 0;\n"
+        ret = "int inc = 0;\n"
 
         @opes.each_with_index{|(t, v), i|
           if t == 'rb_num_t' && ((re = /\b#{v}\b/n) =~ @sp_inc ||
                                  @defopes.any?{|t, val| re =~ val})
-            ret << "        #{t} #{v} = FIX2INT(opes[#{i}]);\n"
+            ret << "        int #{v} = FIX2INT(opes[#{i}]);\n"
           end
         }
         @defopes.each_with_index{|((t, var), val), i|
Index: template/insns_info.inc.tmpl
===================================================================
--- template/insns_info.inc.tmpl	(revision 25029)
+++ template/insns_info.inc.tmpl	(revision 25030)
@@ -49,29 +49,29 @@
 /* some utilities */
 
 static int
-insn_len(int insn)
+insn_len(VALUE insn)
 {
-  return insn_len_info[insn];
+  return insn_len_info[(int)insn];
 }
 
 static const char *
-insn_name(int insn)
+insn_name(VALUE insn)
 {
-  return insn_name_info[insn];
+  return insn_name_info[(int)insn];
 }
 
 static const char *
-insn_op_types(int insn)
+insn_op_types(VALUE insn)
 {
-  return insn_operand_info[insn];
+  return insn_operand_info[(int)insn];
 }
 
 static int
-insn_op_type(int insn, int pos)
+insn_op_type(VALUE insn, long pos)
 {
   int len = insn_len(insn) - 1;
   if(pos < len){
-    return insn_operand_info[insn][pos];
+    return insn_operand_info[(int)insn][pos];
   }
   else{
     return 0;
@@ -80,9 +80,9 @@
 
 #ifdef USE_INSN_RET_NUM
 static int
-insn_ret_num(int insn)
+insn_ret_num(VALUE insn)
 {
-  return insn_stack_push_num_info[insn];
+  return insn_stack_push_num_info[(int)insn];
 }
 #endif
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]