[前][次][番号順一覧][スレッド一覧][生データ]

yarv-diff:151

From: ko1 atdot.net
Date: 12 Dec 2005 16:41:39 -0000
Subject: [yarv-diff:151] r310 - trunk

Author: aamine
Date: 2005-12-13 01:41:38 +0900 (Tue, 13 Dec 2005)
New Revision: 310

Modified:
   trunk/ChangeLog
   trunk/disasm.c
   trunk/error.c
   trunk/eval.c
   trunk/eval_thread.c
   trunk/gc.c
   trunk/intern.h
   trunk/marshal.c
   trunk/object.c
   trunk/process.c
   trunk/thread_pthread.h
   trunk/variable.c
   trunk/vm.c
   trunk/vm.h
   trunk/vm_dump.c
   trunk/yarv.h
Log:
* yarv.h: add prototypes.
* intern.h: ditto.
* eval.c: ditto.
* debug.c: ditto.
* thread_pthread.h: fix printf type mismatch for LP64 system (Linux/AMD64).
* variable.c: ditto.
* object.c: ditto.
* gc.c: ditto.
* process.c: ditto.
* error.c: ditto.
* vm.c: ditto.
* vm.h: ditto.
* vm_dump.c: ditto.
* disasm.c: ditto.
* marshal.c: ditto.
* eval_thread.c: ditto.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/ChangeLog	2005-12-12 16:41:38 UTC (rev 310)
@@ -4,6 +4,42 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2005-12-13(Mon) 01:38:17 +0900  Minero Aoki  <aamine loveruby.net>
+
+	* yarv.h: add prototypes.
+
+	* intern.h: ditto.
+
+	* eval.c: ditto.
+
+	* debug.c: ditto.
+
+	* thread_pthread.h: fix printf type mismatch for LP64 system
+	  (Linux/AMD64).
+
+	* variable.c: ditto.
+
+	* object.c: ditto.
+
+	* gc.c: ditto.
+
+	* process.c: ditto.
+
+	* error.c: ditto.
+
+	* vm.c: ditto.
+
+	* vm.h: ditto.
+
+	* vm_dump.c: ditto.
+
+	* disasm.c: ditto.
+
+	* marshal.c: ditto.
+
+	* eval_thread.c: ditto.
+
+
 2005-12-11(Sun) 22:00:34 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* insns.def : call "inherited" method when a class is inherited

Modified: trunk/disasm.c
===================================================================
--- trunk/disasm.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/disasm.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -22,7 +22,7 @@
       return iiary[i].line_no;
     }
   }
-  rb_bug("find_line_no: can't find %d", pos);
+  rb_bug("find_line_no: can't find %lu", pos);
   return 0;
 }
 
@@ -40,7 +40,7 @@
       }
     }
   }
-  rb_bug("find_prev_line_no: can't find - %d", pos);
+  rb_bug("find_prev_line_no: can't find - %lu", pos);
   return 0;
 }
 
@@ -53,12 +53,12 @@
 
   switch(type){
   case 'L': /* LONG */
-    snprintf(buff, sizeof(buff), "%d", (int)pos + len + op);
+    snprintf(buff, sizeof(buff), "%ld", pos + len + op);
     ret = rb_str_new2(buff);
     break;
 
   case 'U': /* ULONG */
-    snprintf(buff, sizeof(buff), "%u", op);
+    snprintf(buff, sizeof(buff), "%lu", op);
     ret = rb_str_new2(buff);
     break;
 
@@ -255,7 +255,7 @@
         int argc = iseqdat->argc;
         int opts = iseqdat->arg_opts;
         if(i >= argc && i < argc + opts - 1){
-          snprintf(opti, sizeof(opti), "Opt=%d",
+          snprintf(opti, sizeof(opti), "Opt=%ld",
                    iseqdat->arg_opt_tbl[i - argc]);
         }
       }

Modified: trunk/error.c
===================================================================
--- trunk/error.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/error.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -23,7 +23,7 @@
 #endif
 
 extern const char ruby_version[], ruby_release_date[], ruby_platform[];
-extern ruby_in_eval;
+extern int ruby_in_eval;
 
 int ruby_nerrs;
 
@@ -237,7 +237,7 @@
 	    }
 	    type++;
 	}
-	rb_bug("unknown type 0x%x (%p given)", t, TYPE(x));
+	rb_bug("unknown type 0x%x (0x%x given)", t, TYPE(x));
     }
 }
 

Modified: trunk/eval.c
===================================================================
--- trunk/eval.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/eval.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -28,8 +28,8 @@
 VALUE rb_f_block_given_p(void);
 static VALUE umethod_bind(VALUE, VALUE);
 
-ID rb_frame_callee();
-static VALUE rb_frame_self();
+ID rb_frame_callee(void);
+static VALUE rb_frame_self(void);
 
 NODE* ruby_current_node;
 
@@ -117,6 +117,7 @@
 #endif
 
 NORETURN(void rb_thread_start_1 _((void)));
+void Init_yarv(void);
 
 void
 ruby_init()
@@ -1608,7 +1609,7 @@
 
     if (!klass) {
 	rb_raise(rb_eNotImpError, "method `%s' called on terminated object (%p)",
-		 rb_id2name(mid), recv);
+		 rb_id2name(mid), (void*)recv);
     }
     /* is it in the method cache? */
     ent = cache + EXPR1(klass, mid);
@@ -1841,33 +1842,33 @@
 }
 
 ID
-rb_frame_this_func()
+rb_frame_this_func(void)
 {
   return frame_func_id(GET_THREAD()->cfp);
 }
 
 ID
-rb_frame_callee()
+rb_frame_callee(void)
 {
   return frame_func_id(GET_THREAD()->cfp+1);
 }
 
 void
-rb_frame_pop()
+rb_frame_pop(void)
 {
   yarv_thread_t *th = GET_THREAD();
   th->cfp = YARV_PREVIOUS_CONTROL_FRAME(th->cfp);
 }
 
 static VALUE
-rb_frame_self()
+rb_frame_self(void)
 {
   UNSUPPORTED(rb_frame_self);
   return Qnil;
 }
 
 const char *
-rb_sourcefile(){
+rb_sourcefile(void){
   yarv_iseq_t *iseq = GET_THREAD()->cfp->iseq;
   if(iseq &&
      !CMETHOD_INFO_P(iseq)){
@@ -1877,7 +1878,7 @@
 }
 
 int
-rb_sourceline(){
+rb_sourceline(void){
   yarv_thread_t *th = GET_THREAD();
   yarv_iseq_t *iseq = th->cfp->iseq;
   

Modified: trunk/eval_thread.c
===================================================================
--- trunk/eval_thread.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/eval_thread.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -652,7 +652,7 @@
     char msg[21+SIZEOF_LONG*2];
     VALUE e;
 
-    sprintf(msg, "Thread(%p): deadlock", curr_thread->thread);
+    sprintf(msg, "Thread(%p): deadlock", (void*)curr_thread->thread);
     e = rb_exc_new2(rb_eFatal, msg);
     if (curr_thread == main_thread) {
 	rb_exc_raise(e);
@@ -1983,7 +1983,7 @@
     const char *status = thread_status_name(th->status);
     VALUE str;
 
-    str = rb_sprintf("#<%s:%p %s>", cname, thread, status);
+    str = rb_sprintf("#<%s:%p %s>", cname, (void*)thread, status);
     OBJ_INFECT(str, thread);
 
     return str;

Modified: trunk/gc.c
===================================================================
--- trunk/gc.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/gc.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -1212,7 +1212,7 @@
 
       default:
 	rb_bug("gc_sweep(): unknown data type 0x%lx(%p)", 
-	       RANY(obj)->as.basic.flags & T_MASK, obj);
+	       RANY(obj)->as.basic.flags & T_MASK, (void*)obj);
     }
 }
 

Modified: trunk/intern.h
===================================================================
--- trunk/intern.h	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/intern.h	2005-12-12 16:41:38 UTC (rev 310)
@@ -577,4 +577,11 @@
 void ruby_show_version(void);
 void ruby_show_copyright(void);
 
+ID rb_frame_callee(void);
+VALUE rb_str_succ(VALUE);
+VALUE rb_time_succ(VALUE);
+void Init_stack(VALUE*);
+void rb_frame_pop(void);
+void rb_thread_start_1(void);
+
 #endif /* RUBY_INTERN_H */

Modified: trunk/marshal.c
===================================================================
--- trunk/marshal.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/marshal.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -765,7 +765,7 @@
 static void
 long_toobig(int size)
 {
-    rb_raise(rb_eTypeError, "long too big for this architecture (size %d, given %d)",
+    rb_raise(rb_eTypeError, "long too big for this architecture (size %ld, given %d)",
 	     sizeof(long), size);
 }
 

Modified: trunk/object.c
===================================================================
--- trunk/object.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/object.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -289,7 +289,7 @@
     char *cname = rb_obj_classname(obj);
     VALUE str;
 
-    str = rb_sprintf("#<%s:%p>", cname, obj);
+    str = rb_sprintf("#<%s:%p>", cname, (void*)obj);
     if (OBJ_TAINTED(obj)) OBJ_TAINT(str);
 
     return str;
@@ -366,7 +366,7 @@
 	char *c;
 
 	c = rb_obj_classname(obj);
-	str = rb_sprintf("-<%s:%p", c, obj);
+	str = rb_sprintf("-<%s:%p", c, (void*)obj);
 	return rb_exec_recursive(inspect_obj, obj, str);
     }
     return rb_funcall(obj, rb_intern("to_s"), 0, 0);

Modified: trunk/process.c
===================================================================
--- trunk/process.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/process.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -2629,7 +2629,7 @@
 
     ngroups = RARRAY(ary)->len;
     if (ngroups > maxgroups)
-	rb_raise(rb_eArgError, "too many groups, %d max", maxgroups);
+	rb_raise(rb_eArgError, "too many groups, %ld max", (long)maxgroups);
 
     groups = ALLOCA_N(rb_gid_t, ngroups);
 

Modified: trunk/thread_pthread.h
===================================================================
--- trunk/thread_pthread.h	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/thread_pthread.h	2005-12-12 16:41:38 UTC (rev 310)
@@ -70,7 +70,7 @@
     make_timer_thread();
   }
   
-  thread_debug("create: %p, stack size: %d\n", th, stack_size);
+  thread_debug("create: %p, stack size: %ld\n", th, stack_size);
 
   pthread_attr_init(&attr);
   pthread_attr_setstacksize(&attr, stack_size);
@@ -102,6 +102,7 @@
 #endif
     GET_VM()->interrupt_flag = 1;
   }
+  return NULL;
 }
 
 static void

Modified: trunk/variable.c
===================================================================
--- trunk/variable.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/variable.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -195,7 +195,7 @@
 		s = rb_class2name(RBASIC(klass)->klass);
 	    }
 	}
-	path = rb_sprintf("#<%s:%p>", s, klass);
+	path = rb_sprintf("#<%s:%p>", s, (void*)klass);
 	rb_ivar_set(klass, tmp_classpath, path);
 
 	return path;

Modified: trunk/vm.c
===================================================================
--- trunk/vm.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/vm.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -242,10 +242,10 @@
 check_env(yarv_env_t *env){
   printf("---\n");
   printf("envptr: %p\n", &env->block.dfp[0]);
-  printf("orphan: %p\n", env->block.dfp[1]);
-  printf("inheap: %p\n", env->block.dfp[2]);
-  printf("envval: %10p ", env->block.dfp[3]); dp(env->block.dfp[3]);
-  printf("penvv : %10p ", env->block.dfp[4]); dp(env->block.dfp[4]);
+  printf("orphan: %p\n", (void*)env->block.dfp[1]);
+  printf("inheap: %p\n", (void*)env->block.dfp[2]);
+  printf("envval: %10p ", (void*)env->block.dfp[3]); dp(env->block.dfp[3]);
+  printf("penvv : %10p ", (void*)env->block.dfp[4]); dp(env->block.dfp[4]);
   printf("lfp:    %10p\n", env->block.lfp);
   printf("dfp:    %10p\n", env->block.dfp);
   if(env->block.dfp[4]){
@@ -706,8 +706,8 @@
     str = rb_str_new2(buf);
   }
   else if(0 && cfp->magic == FRAME_MAGIC_IFUNC){
-    snprintf(buf, BUFSIZE, "::in `<ifunc>'", // ""%s:%d:in `<ifunc>'",
-             file, line_no);
+    snprintf(buf, BUFSIZE, "::in `<ifunc>'"); /*, ""%s:%d:in `<ifunc>'",
+        file, line_no);*/
     str = rb_str_new2(buf);
   }
   

Modified: trunk/vm.h
===================================================================
--- trunk/vm.h	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/vm.h	2005-12-12 16:41:38 UTC (rev 310)
@@ -172,7 +172,7 @@
   {
 
 #define END_INSNS_DISPATCH()    \
-      rb_bug("unknown insn: %d", GET_CURRENT_INSN());   \
+      rb_bug("unknown insn: %ld", GET_CURRENT_INSN());   \
   }   /* end of while loop */   \
 
 #define NEXT_INSN() TC_DISPATCH(__NEXT_INSN__)
@@ -197,7 +197,7 @@
 #define END_INSNS_DISPATCH()    \
 default:                        \
   SDR(); \
-      rb_bug("unknown insn: %d", GET_CURRENT_INSN());   \
+      rb_bug("unknown insn: %ld", GET_CURRENT_INSN());   \
     } /* end of switch */       \
   }   /* end of while loop */   \
 

Modified: trunk/vm_dump.c
===================================================================
--- trunk/vm_dump.c	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/vm_dump.c	2005-12-12 16:41:38 UTC (rev 310)
@@ -57,8 +57,8 @@
     }
   }
   
-  printf("c:%04d ", (yarv_control_frame_t *)(th->stack + th->stack_size) - cfp);
-  printf("p:%04d s:%04d b:%04d ", pc,
+  printf("c:%04ld ", (yarv_control_frame_t *)(th->stack + th->stack_size) - cfp);
+  printf("p:%04d s:%04ld b:%04d ", pc,
          cfp->sp - th->stack, bp);
   printf("l:%04d d:%04d ", lfp, dfp);
   printf("%-6s ", magic);
@@ -78,11 +78,11 @@
 
   printf("-- stack frame ------------\n");
   for(p=st=th->stack; p<sp; p++){
-    printf("%p (%04d): %08x", p, p-st, *p);
+    printf("%p (%04ld): %08lx", p, p-st, *p);
 
     t = (VALUE *)*p;
     if(th->stack <= t && t < sp){
-      printf(" (= %d)", (VALUE*)GC_GUARDED_PTR_REF(t) - th->stack);
+      printf(" (= %ld)", (VALUE*)GC_GUARDED_PTR_REF(t) - th->stack);
     }
     
     if(p == lfp) printf(" <- lfp");
@@ -108,7 +108,7 @@
   while(env){
     printf("--\n");
     for(i=0; i<env->env_size; i++){
-      printf("%04d: %08x (%p)", -env->local_size + i, env->env[i], &env->env[i]);
+      printf("%04d: %08lx (%p)", -env->local_size + i, env->env[i], &env->env[i]);
       if(&env->env[i] == lfp) printf(" <- lfp");
       if(&env->env[i] == dfp) printf(" <- dfp");
       printf("\n");
@@ -211,7 +211,7 @@
     ptr = cfp->bp;
     for(; ptr < sp; ptr++, i++){
       rstr = rb_inspect(*ptr);
-      printf("  stack %2d: %8s (%d)\n", i, StringValueCStr(rstr), ptr - th->stack);
+      printf("  stack %2d: %8s (%ld)\n", i, StringValueCStr(rstr), ptr - th->stack);
     }
   }
   else if(cfp->magic == FRAME_MAGIC_FINISH){
@@ -223,7 +223,7 @@
     }
   }
   else{
-    rb_bug("unsupport frame type: %08x", cfp->magic);
+    rb_bug("unsupport frame type: %08lx", cfp->magic);
   }
 }
 
@@ -245,7 +245,7 @@
   if(dfp < 0 || dfp > th->stack_size) dfp = -1;
   
   cfpi = ((yarv_control_frame_t *)(th->stack + th->stack_size)) - cfp;
-  printf("  [PC] %04d, [SP] %04d, [LFP] %04d, [DFP] %04d, [CFP] %04d\n",
+  printf("  [PC] %04d, [SP] %04ld, [LFP] %04d, [DFP] %04d, [CFP] %04d\n",
          pc, cfp->sp - th->stack, lfp, dfp, cfpi);
 }
 

Modified: trunk/yarv.h
===================================================================
--- trunk/yarv.h	2005-12-12 15:34:17 UTC (rev 309)
+++ trunk/yarv.h	2005-12-12 16:41:38 UTC (rev 310)
@@ -95,6 +95,12 @@
 VALUE th_make_env_object(yarv_thread_t *th, yarv_control_frame_t *cfp);
 VALUE yarvcore_eval(VALUE self, VALUE str, VALUE file, VALUE line);
 
-int yarv_block_given_p();
+int yarv_block_given_p(void);
 
+VALUE yarv_load(char*);
+VALUE yarv_obj_is_proc(VALUE);
+int th_get_sourceline(yarv_control_frame_t *);
+VALUE th_backtrace(yarv_thread_t *, int);
+void yarv_bug(void);
+
 #endif


-- 
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]