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

ruby-changes:38020

From: nobu <ko1@a...>
Date: Sat, 28 Mar 2015 08:51:30 +0900 (JST)
Subject: [ruby-changes:38020] nobu:r50101 (trunk): internal.h: rb_imemo_new_debug

nobu	2015-03-28 08:51:09 +0900 (Sat, 28 Mar 2015)

  New Revision: 50101

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

  Log:
    internal.h: rb_imemo_new_debug
    
    * internal.h (rb_imemo_new_debug): pretend rb_imemo_new.
    
    * gc.c (rb_imemo_new_debug): share with rb_imemo_new.

  Modified files:
    trunk/gc.c
    trunk/internal.h
Index: gc.c
===================================================================
--- gc.c	(revision 50100)
+++ gc.c	(revision 50101)
@@ -1787,6 +1787,8 @@ rb_node_newnode(enum node_type type, VAL https://github.com/ruby/ruby/blob/trunk/gc.c#L1787
     return n;
 }
 
+#undef rb_imemo_new
+
 VALUE
 rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
 {
@@ -1798,8 +1800,7 @@ rb_imemo_new(enum imemo_type type, VALUE https://github.com/ruby/ruby/blob/trunk/gc.c#L1800
 VALUE
 rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line)
 {
-    VALUE flags = T_IMEMO | (type << FL_USHIFT) | FL_WB_PROTECTED;
-    VALUE memo = newobj_of(v0, flags, v1, v2, v3);
+    VALUE memo = rb_imemo_new(type, v1, v2, v3, v0);
     fprintf(stderr, "memo %p (type: %d) @ %s:%d\n", memo, imemo_type(memo), file, line);
     return memo;
 }
Index: internal.h
===================================================================
--- internal.h	(revision 50100)
+++ internal.h	(revision 50101)
@@ -585,11 +585,7 @@ struct vm_ifunc { https://github.com/ruby/ruby/blob/trunk/internal.h#L585
     ID id;
 };
 
-#if IMEMO_DEBUG
-#define IFUNC_NEW(a, b) ((struct vm_ifunc *)rb_imemo_new_debug(imemo_ifunc, (VALUE)(a), (VALUE)(b), 0, 0, __FILE__, __LINE__))
-#else
 #define IFUNC_NEW(a, b) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), 0, 0))
-#endif
 
 /* MEMO */
 
@@ -611,11 +607,7 @@ struct MEMO { https://github.com/ruby/ruby/blob/trunk/internal.h#L607
 
 #define MEMO_CAST(m) ((struct MEMO *)m)
 
-#if IMEMO_DEBUG
-#define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new_debug(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0, __FILE__, __LINE__))
-#else
 #define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
-#endif
 
 #define type_roomof(x, y) ((sizeof(x) + sizeof(y) - 1) / sizeof(y))
 #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
@@ -1299,9 +1291,10 @@ void rb_gc_mark_values(long n, const VAL https://github.com/ruby/ruby/blob/trunk/internal.h#L1291
 
 #if IMEMO_DEBUG
 VALUE rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line);
-#endif
-
+#define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
+#else
 VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
+#endif
 
 RUBY_SYMBOL_EXPORT_END
 

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

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