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

yarv-diff:155

From: ko1 atdot.net
Date: 17 Dec 2005 01:47:56 -0000
Subject: [yarv-diff:155] r314 - trunk

Author: aamine
Date: 2005-12-17 10:47:55 +0900 (Sat, 17 Dec 2005)
New Revision: 314

Modified:
   trunk/ChangeLog
   trunk/parse.y
   trunk/vm_macro.def
Log:
* vm_macro.def: fix printf type mismatch for LP64 system (again).
* parse.y: introduce descriptive macro for special values of lvtbl->dvars.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2005-12-17 00:40:29 UTC (rev 313)
+++ trunk/ChangeLog	2005-12-17 01:47:55 UTC (rev 314)
@@ -4,9 +4,17 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2005-12-17(Sat) 10:46:08 +0900  Minero Aoki  <aamine loveruby.net>
+
+	* vm_macro.def: fix printf type mismatch for LP64 system (again).
+
+	* parse.y: introduce descriptive macro for special values of
+	  lvtbl->dvars.
+
+
 2005-12-17(Sat) 09:39:27 +0900  Minero Aoki  <aamine loveruby.net>
 
-	* vm_macro.def (macro_eval_invoke_func): fix printf type mismatch
+	* vm_macro.def (macro_eval_invoke_method): fix printf type mismatch
 	  for LP64 system.
 
 

Modified: trunk/parse.y
===================================================================
--- trunk/parse.y	2005-12-17 00:40:29 UTC (rev 313)
+++ trunk/parse.y	2005-12-17 01:47:55 UTC (rev 314)
@@ -123,10 +123,15 @@
     int nofree;
 };
 
+#define DVARS_INHERIT ((void*)1)
+#define DVARS_TOPSCOPE NULL
+#define DVARS_SPECIAL_P(tbl) (!POINTER_P(tbl))
+#define POINTER_P(val) ((unsigned long)(val) & ~3UL)
+
 static int
 vtable_size(struct vtable *tbl)
 {
-  if((VALUE)tbl & ~3){
+  if(POINTER_P(tbl)) {
     return tbl->pos;
   }
   else{
@@ -152,8 +157,8 @@
 vtable_free(struct vtable * tbl)
 {
   if(VTBL_DEBUG)printf("vtable_free: %p\n", tbl);
-  if((VALUE)tbl & ~3){
-    if(tbl->tbl){
+  if(POINTER_P(tbl)){
+    if (tbl->tbl) {
       xfree(tbl->tbl);
     }
     if(tbl){
@@ -165,7 +170,7 @@
 static void
 vtable_add(struct vtable * tbl, ID id)
 {
-  if(!((VALUE)tbl & ~3)){
+  if(!POINTER_P(tbl)){
     rb_bug("vtable_add: vtable is not allocated (%p)", tbl);
   }
   if(VTBL_DEBUG)printf("vtable_add: %p, %s\n", tbl, rb_id2name(id));
@@ -181,7 +186,7 @@
 vtable_included(struct vtable * tbl, ID id)
 {
   int i;
-  if((VALUE)tbl & ~3){
+  if(POINTER_P(tbl)){
     for(i=0; i<tbl->pos; i++){
       
       if(tbl->tbl[i] == id){
@@ -8016,7 +8021,7 @@
     local->prev = lvtbl;
     local->tbl = 0;
     local->dnames = 0;
-    local->dvars = (void *)inherit_dvars;
+    local->dvars = inherit_dvars ? DVARS_INHERIT : DVARS_TOPSCOPE;
     lvtbl = local;
 }
 
@@ -8119,7 +8124,7 @@
 static void
 top_local_setup_gen(struct parser_params *parser)
 {
-  if(((VALUE)lvtbl->dvars & ~3)){
+  if(POINTER_P(lvtbl->dvars)){
     /* eval */
     rb_scope_setup_top_local_tbl(dyna_tbl());
   }
@@ -8135,7 +8140,7 @@
     ID id;
 {
     int i;
-    if(!((VALUE)lvtbl->dvars & ~3)){
+    if(!POINTER_P(lvtbl->dvars)){
         lvtbl->dvars = vtable_alloc(lvtbl->dvars);
     }
     vtable_add(lvtbl->dvars, id);
@@ -8181,7 +8186,7 @@
 static int
 dyna_in_block_gen(struct parser_params *parser)
 {
-    return lvtbl->dvars != 0;
+    return lvtbl->dvars != DVARS_TOPSCOPE;
 }
 
 static NODE *
@@ -8201,13 +8206,13 @@
 dvar_defined_gen(struct parser_params *parser, ID id)
 {
     struct vtable *dvars = lvtbl->dvars;
-    while((VALUE)dvars & ~3){
+    while(POINTER_P(dvars)){
       if(vtable_included(dvars, id)){
           return 1;
       }
       dvars = dvars->prev;
     }
-    if((VALUE)dvars == 1){
+    if(dvars == DVARS_INHERIT){
         return rb_dvar_defined(id);
     }
     return 0;

Modified: trunk/vm_macro.def
===================================================================
--- trunk/vm_macro.def	2005-12-17 00:40:29 UTC (rev 313)
+++ trunk/vm_macro.def	2005-12-17 01:47:55 UTC (rev 314)
@@ -80,8 +80,8 @@
   /* set arguments */
   if(niseq->arg_simple){
     if(niseq->argc != num){
-      rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
-               num, niseq->argc);
+      rb_raise(rb_eArgError, "wrong number of arguments (%lu for %d)",
+               (ulong)num, niseq->argc);
     }
   }
   else{
@@ -92,14 +92,16 @@
       if(num < iseq_argc ||
          (niseq->arg_rest == 0 && num > iseq_argc + opts)){
         if(0){
-          printf("num: %d, iseq_argc: %d, opts: %d\n", num, iseq_argc, opts);
+          printf("num: %lu, iseq_argc: %d, opts: %d\n",
+                 (ulong)num, iseq_argc, opts);
         }
-        rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
-                 num, iseq_argc);
+        rb_raise(rb_eArgError, "wrong number of arguments (%lu for %d)",
+                 (ulong)num, iseq_argc);
       }
 
       if(0){
-        printf("num: %d, opts: %d, iseq_argc: %d\n", num, opts, iseq_argc);
+        printf("num: %lu, opts: %d, iseq_argc: %d\n",
+               (ulong)num, opts, iseq_argc);
       }
       if(num - iseq_argc < opts){
         opt_pc = niseq->arg_opt_tbl[num - iseq_argc];
@@ -125,11 +127,11 @@
       int rest = niseq->arg_rest - 1;
       int pack_size = num - rest;
       if(0){
-        printf("num: %d, rest: %d, ps: %d\n", num, niseq->arg_rest, pack_size);
+        printf("num: %lu, rest: %d, ps: %d\n", (ulong)num, niseq->arg_rest, pack_size);
       }
       if(pack_size < 0){
-        rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
-                 num, rest - niseq->arg_opts);
+        rb_raise(rb_eArgError, "wrong number of arguments (%lu for %d)",
+                 (ulong)num, rest - niseq->arg_opts);
       }
 
       /*
@@ -149,8 +151,8 @@
       if(!((niseq->arg_rest && num == niseq->arg_rest) ||
            (niseq->arg_opts && num == niseq->argc + niseq->arg_opts - 1) ||
            num == niseq->argc)){
-        rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
-                 num, niseq->argc);
+        rb_raise(rb_eArgError, "wrong number of arguments (%lu for %d)",
+                 (ulong)num, niseq->argc);
       }
 
       if(blockptr){
@@ -226,8 +228,8 @@
   }
   else{
     if(proc->block.iseq->argc != num){
-      rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
-               num, proc->block.iseq->argc);
+      rb_raise(rb_eArgError, "wrong number of arguments (%lu for %d)",
+               (ulong)num, proc->block.iseq->argc);
     }
     th_set_env(th, proc->block.iseq,
                FRAME_MAGIC_PROC, recv, (VALUE)proc->block.dfp,


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

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