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

ruby-changes:32009

From: nobu <ko1@a...>
Date: Mon, 9 Dec 2013 12:26:18 +0900 (JST)
Subject: [ruby-changes:32009] nobu:r44088 (trunk): object_tracing.c: fix allocation from NEWOBJ hook

nobu	2013-12-09 12:26:07 +0900 (Mon, 09 Dec 2013)

  New Revision: 44088

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

  Log:
    object_tracing.c: fix allocation from NEWOBJ hook
    
    * ext/objspace/object_tracing.c (newobj_i): use cached class path
      only to get rid object allocation during NEWOBJ hook.
      [ruby-core:58853] [Bug #9212]

  Modified files:
    trunk/ChangeLog
    trunk/ext/objspace/object_tracing.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44087)
+++ ChangeLog	(revision 44088)
@@ -1,4 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Mon Dec  9 12:25:32 2013  Nobuyoshi Nakada  <nobu@r...>
+Mon Dec  9 12:26:05 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/objspace/object_tracing.c (newobj_i): use cached class path
+	  only to get rid object allocation during NEWOBJ hook.
+	  [ruby-core:58853] [Bug #9212]
 
 	* variable.c (rb_class_path_cached): returns cached class path
 	  only, without searching and allocating new class path string.
Index: ext/objspace/object_tracing.c
===================================================================
--- ext/objspace/object_tracing.c	(revision 44087)
+++ ext/objspace/object_tracing.c	(revision 44088)
@@ -81,7 +81,7 @@ newobj_i(VALUE tpval, void *data) https://github.com/ruby/ruby/blob/trunk/ext/objspace/object_tracing.c#L81
     VALUE klass = rb_tracearg_defined_class(tparg);
     struct allocation_info *info;
     const char *path_cstr = RTEST(path) ? make_unique_str(arg->str_table, RSTRING_PTR(path), RSTRING_LEN(path)) : 0;
-    VALUE class_path = (RTEST(klass) && !OBJ_FROZEN(klass)) ? rb_class_path(klass) : Qnil;
+    VALUE class_path = (RTEST(klass) && !OBJ_FROZEN(klass)) ? rb_class_path_cached(klass) : Qnil;
     const char *class_path_cstr = RTEST(class_path) ? make_unique_str(arg->str_table, RSTRING_PTR(class_path), RSTRING_LEN(class_path)) : 0;
 
     if (st_lookup(arg->object_table, (st_data_t)obj, (st_data_t *)&info)) {

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

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