Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112019-05-03T04:50:06ZRuby Issue Tracking System
Redmine Ruby master - Bug #15819 (Closed): cannot read document of File::NULL with "ri File::NULL"https://bugs.ruby-lang.org/issues/158192019-05-03T04:50:06Ztad (Tadashi Saito)Ruby master - Feature #12484 (Closed): Optimizing Rationalhttps://bugs.ruby-lang.org/issues/124842016-06-12T14:00:20Ztad (Tadashi Saito)
<a name="Abstract"></a>
<h2 >Abstract<a href="#Abstract" class="wiki-anchor">¶</a></h2>
<p>I optimized built-in library Rational. It is more than 3.7 times faster now in some cases.</p>
<a name="Background"></a>
<h2 >Background<a href="#Background" class="wiki-anchor">¶</a></h2>
<p>Rational is increasing its importance year by year. Ruby 1.9.2 uses Rational as internal representation of Time. Ruby 2.1 introduced Rational literal ("r" suffix).</p>
<p>But it's performance is not good enough because its implementation uses Ruby-level method calling with <code>rb_funcall()</code>, in spite of it's implemented in C since Ruby 1.9.1.</p>
<a name="Proposal"></a>
<h2 >Proposal<a href="#Proposal" class="wiki-anchor">¶</a></h2>
<p>I tried to improve its performance with decreasing <code>rb_funcall()</code>. They have been replaced with more direct representation as C.</p>
<a name="Implementation"></a>
<h2 >Implementation<a href="#Implementation" class="wiki-anchor">¶</a></h2>
<p>2 patches attached. 0001 is exporting some numeric.c functions (Is this OK?) that needed to 0002. 0002 is the main.</p>
<p>This is an example of typical modification:</p>
<pre><code class="diff syntaxhl" data-language="diff"><span class="gd">- return f_mul(f_to_f(self), other);
</span><span class="gi">+ return DBL2NUM(RFLOAT_VALUE(nurat_to_f(self)) * RFLOAT_VALUE(other));
</span></code></pre>
<p>In this code, <code>f_mul()</code> and <code>f_to_f()</code> calls <code>rb_funcall()</code>. I replaced those with <code>*</code> (native multiply) and <code>nurat_to_f()</code> (the body of Rational#to_f).</p>
<a name="Evaluation"></a>
<h2 >Evaluation<a href="#Evaluation" class="wiki-anchor">¶</a></h2>
<p>Performance and testing evaluation is done with r55389 of trunk.</p>
<p>Performance is improved in most of methods. Attached ratios.png shows times of improvement (bigger is better).<br>
The benchmark is done with attached benchmark.rb script. result-trunk.tsv and result-optimized.tsv are raw scores.</p>
<p>Notably, <code>Rational + Bignum</code> became 3.7 times or more faster.</p>
<p>These patches also pass <code>make test</code>, <code>make test-all</code> and <code>make test-rubyspec</code>.<br>
<a href="https://drone.io/github.com/tadd/ruby/70" class="external">https://drone.io/github.com/tadd/ruby/70</a></p>
<a name="Discussion"></a>
<h2 >Discussion<a href="#Discussion" class="wiki-anchor">¶</a></h2>
<p>I have some concerns about compatibilities but I believe it's not a real problem.</p>
<p>Current implementation uses Ruby-level method calling as written above. If some user redefined Integer method in Ruby level, it effects to Rational calculation.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">Integer</span>
<span class="k">alias</span> <span class="n">mul</span> <span class="o">*</span>
<span class="k">def</span> <span class="nf">*</span><span class="p">(</span><span class="n">o</span><span class="p">)</span>
<span class="nb">p</span> <span class="s2">"I'm *"</span>
<span class="n">mul</span><span class="p">(</span><span class="n">o</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">r</span> <span class="o">=</span> <span class="no">Rational</span><span class="p">(</span><span class="mi">1</span><span class="o"><<</span><span class="mi">64</span><span class="p">)</span>
<span class="n">r</span> <span class="o">*</span> <span class="n">r</span>
</code></pre>
<p>Current implementation prints "I'm *" but nothing printed with my patch. This is compatibility breakage in a strict sense, but I don't think it is used as valuable behavior from library users.</p>
<p>Other concern is my prerequisites. I assumed that Rational have a pair of <code>::Integer</code> (internally bignum or fixnum) only because I couldn't define subclass of Integer to work with Rational.<br>
If user can pass a subclass of Integer to the constructor of Rational, it may cause some weird behavior.</p>
<p>If I should care about above or other things, please let me know.</p>
<a name="Summary"></a>
<h2 >Summary<a href="#Summary" class="wiki-anchor">¶</a></h2>
<p>Most of Rational methods are optimized and those speed are up with more direct C representation.<br>
I believe there is no real compatibility problem with my implementation.</p>
<p>Note that my codes are supported by a grant of Ruby Association. I thank to Ruby Association and grant committee members.<br>
<a href="http://ruby.or.jp/en/news/20160406.html" class="external">http://ruby.or.jp/en/news/20160406.html</a></p> Ruby master - Bug #11870 (Closed): Eradication of typical misspellingshttps://bugs.ruby-lang.org/issues/118702015-12-24T03:32:04Ztad (Tadashi Saito)
<p>(Note: this patch is low priority and I do not complained if this isn't applied to 2.3 release.)</p>
<p>Thanks to the Wikipedia page <a href="https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines" class="external">https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines</a> ,<br>
I've found many misspellings in both of documents and codes.</p>
<p>I've attached a patch for trunk to correct them.</p> Ruby master - Misc #8962 (Closed): [DOC] add step to enable Generational GC merits in README.EXT*https://bugs.ruby-lang.org/issues/89622013-09-28T17:06:15Ztad (Tadashi Saito)
<p>=begin</p>
<p>Is there any chance to reap the benefit of new Generational GC merits for<br>
C-extension library authors?</p>
<p>== Background</p>
<p>First of all: RGenGC is great. Ko1 showed that it could make significant<br>
performance improvement at RubyKaigi2013. (especially P82)<br>
((<RubyKaigi2013-ko1.pdf|URL:<a href="http://www.atdot.net/~ko1/activities/RubyKaigi2013-ko1.pdf%3E" class="external">http://www.atdot.net/~ko1/activities/RubyKaigi2013-ko1.pdf></a>))</p>
<p>I guess the improvement is triggered by marking most (or all?) of built-in<br>
classes as WB-protected struct to work with Generational GC.</p>
<p>== Motivation</p>
<p>As an extension library author, I want to try to get the performance merit.<br>
But there is no document or guide to enable it.</p>
<p>The PDF says "Inserting WBs step by step, and increase performance gradually",<br>
and I believe it is the greatest point of RGenGC, but there is no guide to<br>
proceed with the steps for now. It's sad.</p>
<p>== Subject</p>
<p>Could you write about it as a document, ko1 or anyone?<br>
I guess it's good to be written at ((%README.EXT*%)).<br>
(The case of ((%iseq.c%)) may be used as an example.)</p>
<p>I'm glad to see the documents are written before Ruby 2.1 release.</p>
<p>== Restriction</p>
<p>Sorry for the absence of my knowledge. Because I'm not good at<br>
RGenGC, I could't write the document by myself but could only request.</p>
<p>PS<br>
I guess this issue depends on <a class="issue tracker-1 status-6 priority-4 priority-default closed" title="Bug: TypedDataについてのドキュメントがない (Rejected)" href="https://bugs.ruby-lang.org/issues/3064">#3064</a> (sorry, in Japanse), the request of<br>
documenting (({RTypedData})), because there is no interface to specify<br>
(({FL_WB_PROTECTED})) flag with traditional (({RData})).</p>
<p>=end</p> Ruby master - Bug #6237 (Rejected): ruby my_controller.rbでSEGVhttps://bugs.ruby-lang.org/issues/62372012-04-01T01:45:32Ztad (Tadashi Saito)
<p>以下のようにすると [BUG] となって落ちます。</p>
<p>~/rails3test/test32/app/controllers$ ~/rubies/trunk/bin/ruby-trunk my_controller.rb<br>
my_controller.rb:1: [BUG] Segmentation fault<br>
ruby 2.0.0dev (2012-03-31 trunk 30224) [i686-linux]</p>
<p>-- Control frame information -----------------------------------------------<br>
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :kill<br>
c:0003 p:0019 s:0006 b:0006 l:0008bc d:0002c4 EVAL my_controller.rb:1<br>
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH<br>
c:0001 p:0000 s:0002 b:0002 l:0008bc d:0008bc TOP</p>
<p>-- Ruby level backtrace information ----------------------------------------<br>
my_controller.rb:1:in <code><main>' my_controller.rb:1:in </code>kill'</p>
<p>-- C level backtrace information -------------------------------------------<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(+0x190e73) [0xb77dce73] ../vm_dump.c:812<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(+0x58e47) [0xb76a4e47] vfscanf.c:1858<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(rb_bug+0x49) [0xb76a4f39] vfscanf.c:2674<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(+0x116efc) [0xb7762efc] ../signal.c:600<br>
[0xb786f40c]<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(+0x17b3b0) [0xb77c73b0] ../vm_insnhelper.c:367<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(+0x18f68d) [0xb77db68d] ../vm_insnhelper.c:454<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(+0x17e721) [0xb77ca721] ../insns.def:1018<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(+0x1849a1) [0xb77d09a1] ../vm.c:1223<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(rb_iseq_eval_main+0x1f7) [0xb77d0da7] ../vm.c:1463<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(+0x5adba) [0xb76a6dba] printf-parsemb.c:298<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(ruby_exec_node+0x25) [0xb76a6df5] fxprintf.c:32<br>
/home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0(ruby_run_node+0x35) [0xb76a87d5] iofsetpos.c:40<br>
/home/tadashi/rubies/trunk/bin/ruby-trunk() [0x80487b8] ../main.c:38<br>
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0xb7484ca6] libc-start.c:228<br>
/home/tadashi/rubies/trunk/bin/ruby-trunk() [0x80486b1]</p>
<p>-- Other runtime information -----------------------------------------------</p>
<ul>
<li>
<p>Loaded script: my_controller.rb</p>
</li>
<li>
<p>Loaded features:</p>
<p>0 enumerator.so<br>
1 /home/tadashi/rubies/trunk/lib/ruby/2.0.0/rubygems/defaults.rb<br>
2 /home/tadashi/rubies/trunk/lib/ruby/2.0.0/i686-linux/rbconfig.rb<br>
3 /home/tadashi/rubies/trunk/lib/ruby/2.0.0/rubygems/deprecate.rb<br>
4 /home/tadashi/rubies/trunk/lib/ruby/2.0.0/rubygems/exceptions.rb<br>
5 /home/tadashi/rubies/trunk/lib/ruby/2.0.0/rubygems/custom_require.rb<br>
6 /home/tadashi/rubies/trunk/lib/ruby/2.0.0/rubygems.rb</p>
</li>
<li>
<p>Process memory map:</p>
</li>
</ul>
<p>08048000-08049000 r-xp 00000000 08:02 3434253 /home/tadashi/rubies/trunk/bin/ruby-trunk<br>
08049000-0804a000 rw-p 00000000 08:02 3434253 /home/tadashi/rubies/trunk/bin/ruby-trunk<br>
09ecb000-0a045000 rw-p 00000000 00:00 0 [heap]<br>
b72ac000-b72c6000 r-xp 00000000 08:02 3801704 /usr/local/lib/libgcc_s.so.1<br>
b72c6000-b72c7000 rw-p 00019000 08:02 3801704 /usr/local/lib/libgcc_s.so.1<br>
b72df000-b72e0000 ---p 00000000 00:00 0<br>
b72e0000-b7364000 rw-p 00000000 00:00 0<br>
b7364000-b746c000 r--p 00000000 08:02 1441795 /usr/lib/locale/locale-archive<br>
b746c000-b746e000 rw-p 00000000 00:00 0<br>
b746e000-b75ae000 r-xp 00000000 08:02 3157585 /lib/i686/cmov/libc-2.11.3.so<br>
b75ae000-b75af000 ---p 00140000 08:02 3157585 /lib/i686/cmov/libc-2.11.3.so<br>
b75af000-b75b1000 r--p 00140000 08:02 3157585 /lib/i686/cmov/libc-2.11.3.so<br>
b75b1000-b75b2000 rw-p 00142000 08:02 3157585 /lib/i686/cmov/libc-2.11.3.so<br>
b75b2000-b75b5000 rw-p 00000000 00:00 0<br>
b75b5000-b75d9000 r-xp 00000000 08:02 3157447 /lib/i686/cmov/libm-2.11.3.so<br>
b75d9000-b75da000 r--p 00023000 08:02 3157447 /lib/i686/cmov/libm-2.11.3.so<br>
b75da000-b75db000 rw-p 00024000 08:02 3157447 /lib/i686/cmov/libm-2.11.3.so<br>
b75db000-b75e4000 r-xp 00000000 08:02 3157453 /lib/i686/cmov/libcrypt-2.11.3.so<br>
b75e4000-b75e5000 r--p 00008000 08:02 3157453 /lib/i686/cmov/libcrypt-2.11.3.so<br>
b75e5000-b75e6000 rw-p 00009000 08:02 3157453 /lib/i686/cmov/libcrypt-2.11.3.so<br>
b75e6000-b760d000 rw-p 00000000 00:00 0<br>
b760d000-b760f000 r-xp 00000000 08:02 3157445 /lib/i686/cmov/libdl-2.11.3.so<br>
b760f000-b7610000 r--p 00001000 08:02 3157445 /lib/i686/cmov/libdl-2.11.3.so<br>
b7610000-b7611000 rw-p 00002000 08:02 3157445 /lib/i686/cmov/libdl-2.11.3.so<br>
b7611000-b7618000 r-xp 00000000 08:02 3157584 /lib/i686/cmov/librt-2.11.3.so<br>
b7618000-b7619000 r--p 00006000 08:02 3157584 /lib/i686/cmov/librt-2.11.3.so<br>
b7619000-b761a000 rw-p 00007000 08:02 3157584 /lib/i686/cmov/librt-2.11.3.so<br>
b761a000-b761b000 rw-p 00000000 00:00 0<br>
b761b000-b7630000 r-xp 00000000 08:02 3157463 /lib/i686/cmov/libpthread-2.11.3.so<br>
b7630000-b7631000 r--p 00014000 08:02 3157463 /lib/i686/cmov/libpthread-2.11.3.so<br>
b7631000-b7632000 rw-p 00015000 08:02 3157463 /lib/i686/cmov/libpthread-2.11.3.so<br>
b7632000-b7634000 rw-p 00000000 00:00 0<br>
b764b000-b764c000 rw-p 00000000 00:00 0<br>
b764c000-b7859000 r-xp 00000000 08:02 3435786 /home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0.0<br>
b7859000-b785e000 rw-p 0020d000 08:02 3435786 /home/tadashi/rubies/trunk/lib/libruby-trunk.so.2.0.0<br>
b785e000-b786f000 rw-p 00000000 00:00 0<br>
b786f000-b7870000 r-xp 00000000 00:00 0 [vdso]<br>
b7870000-b788b000 r-xp 00000000 08:02 3157429 /lib/ld-2.11.3.so<br>
b788b000-b788c000 r--p 0001b000 08:02 3157429 /lib/ld-2.11.3.so<br>
b788c000-b788d000 rw-p 0001c000 08:02 3157429 /lib/ld-2.11.3.so<br>
bfa21000-bfa36000 rw-p 00000000 00:00 0 [stack]</p>
<p>[NOTE]<br>
You may have encountered a bug in the Ruby interpreter or extension libraries.<br>
Bug reports are welcome.<br>
For details: <a href="http://www.ruby-lang.org/bugreport.html" class="external">http://www.ruby-lang.org/bugreport.html</a></p>
<p>アボートしました</p>
<p>SEGVを防ぐパッチを添付します。サイズが大きくなっているのは、根本的な対処が必要となったためです。</p>
<p>あとそういえば、ついでに当該の.rbファイルも添付しておきます。</p>
<p>よろしくお願いします。</p> Ruby master - Feature #3069 (Rejected): [TypedData] 関連APIの名前が不揃いhttps://bugs.ruby-lang.org/issues/30692010-04-01T01:54:34Ztad (Tadashi Saito)
<p>=begin<br>
斎藤と申します。</p>
<a name="たぶんこれが最後です"></a>
<h1 >たぶんこれが最後です。<a href="#たぶんこれが最後です" class="wiki-anchor">¶</a></h1>
<p>1.9.2で新設される、RTypedData関連の関数・マクロ群の名前が<br>
不揃いで、ちょっと分かりにくいと感じていて、お願いに来ました。</p>
<p>まず、 struct RTypedData があるわけですが、Rubyの慣習でいけば、<br>
小文字に直した時は typed_data になるか、アンダースコアがなくて<br>
typeddataになるなどが期待されると思います。これはどちらにせよ、<br>
統一されるべきでしょう。加えて、語順が変わることは自然でない<br>
とも感じます。</p>
<p>ところが<br>
rb_typeddata_is_kind_of()<br>
では間にアンダースコアが入ってないと思いきや<br>
RUBY_TYPED_DEFAULT_FREE<br>
ではアンダースコアが(DATAが省略されて)入っています。また<br>
rb_data_typed_object_alloc()<br>
という、単語が前後入れ替わった関数があったりもします</p>
<p>もう少し統一していただけると、思いだしやすかったり、<br>
類推しやすかったりすると思うのですが、いかがでしょうか。</p>
<p>とりあえず、typedが入っている三つの関数</p>
<p>rb_check_typeddata<br>
rb_data_typed_object_alloc<br>
rb_typeddata_is_kind_of</p>
<p>について考えたのですが、「RTypedDataに着目した関数である」ので</p>
<p>rb_typeddata_check<br>
rb_typeddata_object_alloc<br>
rb_typeddata_is_kind_of</p>
<p>というふうに揃えるのはいかがでしょうか。</p>
<p>無論、自分が推測できた以上に意味のある語順や名前であれば、<br>
変更する必要はないと思います。</p>
<p>よろしくお願いします。<br>
=end</p> Ruby master - Feature #3068 (Rejected): [TypedData] RUBY_TYPED_DEFAULT_FREE は必要?https://bugs.ruby-lang.org/issues/30682010-04-01T01:27:46Ztad (Tadashi Saito)
<p>=begin<br>
斎藤と申します。</p>
<p>1.9.2からRUBY_TYPED_DEFAULT_FREEというのが導入されるようですが、<br>
これは本当に必要なものでしょうか。</p>
<p>#define RUBY_TYPED_DEFAULT_FREE ((void (*)(void *))-1)</p>
<p>のように、-1を(dfreeと同じ型の)関数ポインタにキャストするだけの<br>
簡単なものですが、直に「-1」と書くのにくらべて、10倍以上長くなって<br>
しまいます。</p>
<a name="さらによーく見るとvoid-void-1と直書きする"></a>
<h1 >さらによーく見ると、「((void (*)(void *))-1)」と直書きする<a href="#さらによーく見るとvoid-void-1と直書きする" class="wiki-anchor">¶</a></h1>
<a name="よりも長くなってますね"></a>
<h1 >よりも長くなってますね<a href="#よりも長くなってますね" class="wiki-anchor">¶</a></h1>
<p>-1を指定するのは、README.EXTにも載っている伝統ある方法なので、<br>
わざわざ今になって別名をつける事もなんじゃないでしょうか。<br>
それとも、どこからか意見や議論があったのでしょうか。<br>
(見逃してたならごめんなさい)</p>
<p>また、もし「『-1』というマジックナンバーを指定するのが汚い」、<br>
「『-1』と直書きした場合、『(void (*)(void <em>))とintの型が違う』と<br>
コンパイラに怒られる」(ということはあったかなぁ?)などの理由で<br>
-1と書きたくないならば、それらの多くはRTypedDataのみでなくRDataにも<br>
当てはまることではないかと推測します。それならばTypedでない方の<br>
RData用にも、RUBY_DEFAULT_FREE 等を定義するのが筋ではないで<br>
しょうか。その場合は同様に、RUBY_NEVER_FREE == (void (</em>)(void *))0<br>
や RUBY_TYPED_NEVER_FREE を定義する必要も出るでしょう。</p>
<p>ということで、中途半端だと混乱するので、</p>
<p>・一通り別名を用意して、これからはそちらを使うように推奨する<br>
・長い別名は定義せず、簡潔な数値の直書きを第一手段とし続ける</p>
<p>のどちらかにちゃんとそろえて欲しいです。</p>
<p>よろしくおねがいします。<br>
=end</p> Ruby master - Feature #3066 (Rejected): [TypedData] wrap_struct_name は必要?https://bugs.ruby-lang.org/issues/30662010-04-01T00:53:26Ztad (Tadashi Saito)
<p>=begin<br>
斎藤と申します。</p>
<p>rb_data_type_tのメンバーとして、 const char *wrap_struct_name と<br>
いうのがありますが、これは本当に必要なものなのでしょうか。</p>
<p>Rubyオブジェクトの実体となる構造体の型に名前をつけるもの、のように<br>
自分には見えますが、そもそもRubyオブジェクトになる時点で、なんらかの<br>
クラス名が必ず付いているはずです。実際に*.cで、wrap_struct_nameと<br>
して使われている文字列を見ましたが、自分が見た限りではクラス名その物<br>
でした。二回同じものを指定するのは、DRYじゃないです。</p>
<p>また、僕が想像する範囲では、このメンバーは、将来作られるメモリ<br>
プロファイラが、オブジェクトの種類を分かりやすく表示できるように<br>
用意したのでは、と邪推しているのですが(間違っていたらごめんなさい)、<br>
上記のとおりクラス名を取ればほとんど同じ事ができるはずです。<br>
(rb_obj_classname(obj)で。)</p>
<p>ということでこのメンバーは不要なのではないかと思っているのですが、<br>
どうなのでしょうか。自分の想定している使い方でなかったり、自分が<br>
思いつかなかった意味のある使い方があって必要ならば、Closeして<br>
ください。<br>
=end</p> Ruby master - Feature #3065 (Rejected): [TypedData] という名前についてhttps://bugs.ruby-lang.org/issues/30652010-04-01T00:30:34Ztad (Tadashi Saito)
<p>=begin<br>
斎藤と申します。</p>
<p>1.9.2に取り込まれないであろうことは百二十くらい承知で、TypedDataに<br>
付いての疑問点をいくつか書かせていただきます。</p>
<p>trunkには、RDataの代わりに(なりそうな)RTypedDataが導入されましたが、<br>
これは良くない名前ではないでしょうか。</p>
<p>まず、新しい構造体には「Type」という単語が追加されたわけですが、これは<br>
struct RTypedDataのメンバーであるtypeから察するに、rb_data_type_tの<br>
事を指し、それによって型をまとめてチェックできる(rb_typeddata_is_kind_of)<br>
という意味になると思います。</p>
<p>しかしささださんと先日Twitter上で話したところ、これを作った主な動機は<br>
メモリ使用状況の正確な把握にある、つまりrb_data_type_tとして追加で<br>
dsize関数ができたことにあるようでした。(間違っていたらすみません)</p>
<p>つまり「自分でメモリ使用量を知っているRData」を作りたかったのに、<br>
名前から伝わる印象はそれと異なり、「型の把握が簡単なRData」になって<br>
しまっています。</p>
<a name="Typedにもし自分の資源消費量を知っているという意味があれば"></a>
<h1 >「Typed」にもし「自分の資源消費量を知っている」という意味があれば、<a href="#Typedにもし自分の資源消費量を知っているという意味があれば" class="wiki-anchor">¶</a></h1>
<a name="問題ないと思いますその場合単に自分の知識不足のでCloseして"></a>
<h1 >問題ないと思います。その場合、単に自分の知識不足ので、Closeして<a href="#問題ないと思いますその場合単に自分の知識不足のでCloseして" class="wiki-anchor">¶</a></h1>
<a name="くださいごめんなさい"></a>
<h1 >ください。ごめんなさい。<a href="#くださいごめんなさい" class="wiki-anchor">¶</a></h1>
<p>自分の今までのコンピュータの知識では、「型」という言葉には、その<br>
オブジェクトが現実のコンピュータでどれほど資源を食っているか、という<br>
意味では使われないと思います。もしそうならば、名が体を表していないの<br>
で、良くない名前だと思います。</p>
<p>メモリサイズが測れるということを伝えるのならば、シンプルに「RSizedData」<br>
とかの方が、分かりやすくて良いと思います。</p>
<p>という、API変更の提案でした。誤解がたくさんあるかもしれませんが、どうぞ<br>
よろしくお願いします。<br>
=end</p> Ruby master - Bug #3064 (Rejected): TypedDataについてのドキュメントがないhttps://bugs.ruby-lang.org/issues/30642010-04-01T00:03:51Ztad (Tadashi Saito)
<p>=begin<br>
斎藤と申します。拡張ライブラリの作者・librubyの1ユーザーです。</p>
<p>1.9.2で導入される予定のTypedDataについてのドキュメントが、まったく<br>
ない事で困っています。具体的には、README.EXT{,.ja}に追記がなされ<br>
ないと、拡張ライブラリ作者(つまり今の自分)としては</p>
<p>・今までのDataとの違いはなんだろう?<br>
・今までのDataのAPIはobsoleteなんだろうか?<br>
・それとも新しいTypedDataは内部向けで触っていけないものだろうか?</p>
<p>という疑問がたくさん沸いてきて、DataとTypedDataの使い分けをしようにも<br>
どちらをどう触ってよいのか分かりません。そのあたりを、README.EXTに<br>
書いていただきたいです。</p>
<p>自分がドキュメントを書くことにやぶさかではないのですが、導入の動機や<br>
これから拡張ライブラリを作る人にどういう扱いをして欲しいかという<br>
大事な点が分かっていないので、ささださんにぜひ導入者として責任を持って<br>
書いていただきたいです。(もしささださん以外にTypedDataをよく分かって<br>
いる方がいるならば、もちろんどなたでも構いません)</p>
<p>もっと具体的には、README.EXTの3.3「CのデータをRubyオブジェクトにする」<br>
あたりの次と、Appendix B.の「** Cデータのカプセル化」の項などについて、<br>
TypedDataの場合を追記して欲しいです。もちろん外部に使って欲しくなくて<br>
「触るなキケン」ならば、その旨だけ書けば、詳細はいらないと思います。</p>
<p>加えて、TypedData新設の動機・メリットを示す形で、NEWSにも書いて欲しいです。<br>
=end</p> Ruby master - Bug #1039 (Rejected): test-all fails without installationhttps://bugs.ruby-lang.org/issues/10392009-01-23T01:15:11Ztad (Tadashi Saito)
<p>=begin<br>
In the current state of ruby_1_9_1, some tests in <code>make test-all</code> fails when I didn't <code>make install</code>.</p>
<ol>
<li>Failure:<br>
test_class_build_extconf_fail(TestGemExtExtConfBuilder) [/home/tadashi/svn/ruby/ruby_1_9_1/test/rubygems/test_gem_ext_ext_conf_builder.rb:66]:<br>
Expected /\Aextconf failed:</li>
</ol>
<p>/usr/local/bin/ruby1.9 extconf.rb.*<br>
checking for main() in .*?nonexistent/m to match "extconf failed:\n\n/usr/local/bin/ruby1.9 extconf.rb\nsh: /usr/local/bin/ruby1.9: No such file or directory\n".</p>
<ol start="2">
<li>Error:<br>
test_class_build(TestGemExtExtConfBuilder):<br>
Gem::InstallError: extconf failed:</li>
</ol>
<p>/usr/local/bin/ruby1.9 extconf.rb<br>
sh: /usr/local/bin/ruby1.9: No such file or directory</p>
<pre><code> /home/tadashi/svn/ruby/ruby_1_9_1/test/rubygems/test_gem_ext_ext_conf_builder.rb:24:in `block in test_class_build'
/home/tadashi/svn/ruby/ruby_1_9_1/test/rubygems/test_gem_ext_ext_conf_builder.rb:23:in `chdir'
/home/tadashi/svn/ruby/ruby_1_9_1/test/rubygems/test_gem_ext_ext_conf_builder.rb:23:in `test_class_build'
</code></pre>
<ol start="3">
<li>Failure:<br>
test_build_extensions_extconf_bad(TestGemInstaller) [/home/tadashi/svn/ruby/ruby_1_9_1/test/rubygems/test_gem_installer.rb:75]:<br>
Expected //usr/local/bin/ruby1.9: No such file/ to match "/usr/local/bin/ruby1.9 extconf.rb\nsh: /usr/local/bin/ruby1.9: No such file or directory\n".</li>
</ol>
<p>Is this the spec?<br>
=end</p> Ruby master - Bug #919 (Closed): tool/file2lastrev.rbでエラーhttps://bugs.ruby-lang.org/issues/9192008-12-23T01:54:03Ztad (Tadashi Saito)
<p>=begin<br>
ソースと違うディレクトリでtrunkをmakeしようとすると、<br>
tool/file2lastrev.rbでエラーが出てmakeできません。</p>
<p>$ make<br>
ruby ../tool/file2lastrev.rb --revision.h ".." > "../revision.h.tmp"<br>
svn: '.' is not a working copy<br>
../tool/file2lastrev.rb:34:in `get_revisions': last revision not found (RuntimeError)<br>
from ../tool/file2lastrev.rb:70<br>
make: *** [../revision.h] エラー 1</p>
<p>一応下ので直りましたが、汎用性があるのか正直自信がありません。</p>
<a name="Index-toolfile2lastrevrb"></a>
<h1 >Index: tool/file2lastrev.rb<a href="#Index-toolfile2lastrevrb" class="wiki-anchor">¶</a></h1>
<p>--- tool/file2lastrev.rb (revision 20922)<br>
+++ tool/file2lastrev.rb (working copy)<br>
@@ -10,8 +10,8 @@</p>
<pre><code>path = target_path.directory? ? target_path : target_path.parent
begin
</code></pre>
<ul>
<li>return :svn, target_path.relative_path_from(path) if File.directory?("#{path}/.svn")</li>
<li>return :git, target_path.relative_path_from(path) if File.directory?("#{path}/.git")</li>
</ul>
<ul>
<li>return :svn, target_path.relative_path_from(Pathname.pwd) if File.directory?("#{path}/.svn")</li>
<li>return :git, target_path.relative_path_from(Pathname.pwd) if File.directory?("#{path}/.git")<br>
path, orig = path.parent, path<br>
end until path == orig<br>
raise VCSNotFoundError, "does not seem to be under a vcs"<br>
=end</li>
</ul> Ruby master - Bug #782 (Closed): 余分な外部シンボルhttps://bugs.ruby-lang.org/issues/7822008-11-24T21:19:08Ztad (Tadashi Saito)
<p>=begin<br>
無意味に外部シンボルを増やさないでください。</p>
<a name="Index-signalc"></a>
<h1 >Index: signal.c<a href="#Index-signalc" class="wiki-anchor">¶</a></h1>
<p>--- signal.c (revision 20337)<br>
+++ signal.c (working copy)<br>
@@ -49,7 +49,6 @@</p>
<p>#if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK)<br>
#define USE_SIGALTSTACK<br>
-int is_altstack_defined = 0;<br>
#endif</p>
<p>static const struct signals {<br>
@@ -424,6 +423,7 @@<br>
/* alternate stack for SIGSEGV */<br>
static void register_sigaltstack() {<br>
stack_t newSS, oldSS;</p>
<ul>
<li>
<p>static int is_altstack_defined = 0;</p>
<p>if(is_altstack_defined)<br>
return;<br>
=end</p>
</li>
</ul>