From: Motohiro KOSAKI Date: 2012-02-08T02:52:43+09:00 Subject: [ruby-dev:45208] [ruby-trunk - Feature #490][Closed] relayouting struct RNode Issue #490 has been updated by Motohiro KOSAKI. Status changed from Assigned to Closed ええと nd_file を reservedに変える変更はすでに入ってるので、これ閉じていいですよね? 魅力的な新機能を思いついた人がチケットを切り直してください ---------------------------------------- Feature #490: relayouting struct RNode https://bugs.ruby-lang.org/issues/490 Author: Yuki Sonoda Status: Closed Priority: Low Assignee: Yukihiro Matsumoto Category: core Target version: 2.0.0 =begin Yuguiです。 「第7回RHGの逆襲」(http://qwik.jp/rhg-strikes-back/78.html )の結果とし て、RNode::nd_fileは誰も利用していないことが分かりました。 よって、RNodeのレイアウトにおいてポインタ長だけ空間が余っています。添付 のパッチでは、とりあえずこの空間をvoid *reservedとして、YARVに残っている 無駄なNULL pointer代入を削除してみました。 さて、この空間を何らかの形で有益に活用したいと思います。関係者に聞いてみ たところでは次のような案が出てきました。 1) 行番号に使う 行番号のMAXが15bit増えます。現状では32bit環境でも2**17あるので現実的に 特に困ることはないと思いますが、もう少し増えても悪くはないかもしれません。 2) RNodeを4分木にする ASTの分岐の数を増やします。笹田さんによれば、これで楽になるケースが少 しはあるとのことです。 どのようにしたら良いか、ご意見をいただければと思います。 -- Yugui http://yugui.jp 私は私をDumpする diff --git a/include/ruby/node.h b/include/ruby/node.h index d83f550..6621ac1 100644 --- a/include/ruby/node.h +++ b/include/ruby/node.h @@ -242,7 +242,7 @@ enum node_type { typedef struct RNode { unsigned long flags; - char *nd_file; + void *reserved; union { struct RNode *node; ID id; diff --git a/iseq.c b/iseq.c index b964176..9de648b 100644 --- a/iseq.c +++ b/iseq.c @@ -118,12 +118,10 @@ set_relation(rb_iseq_t *iseq, const VALUE parent) if (type == ISEQ_TYPE_TOP) { /* toplevel is private */ iseq->cref_stack = NEW_BLOCK(th->top_wrapper ? th->top_wrapper : rb_cObject); - iseq->cref_stack->nd_file = 0; iseq->cref_stack->nd_visi = NOEX_PRIVATE; } else if (type == ISEQ_TYPE_METHOD || type == ISEQ_TYPE_CLASS) { iseq->cref_stack = NEW_BLOCK(0); /* place holder */ - iseq->cref_stack->nd_file = 0; } else if (RTEST(parent)) { rb_iseq_t *piseq; diff --git a/vm.c b/vm.c index 730d89c..b1b67d8 100644 --- a/vm.c +++ b/vm.c @@ -748,7 +748,6 @@ vm_cref_push(rb_thread_t *th, VALUE klass, int noex) { rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(th, th->cfp); NODE *cref = NEW_BLOCK(klass); - cref->nd_file = 0; cref->nd_visi = noex; if (cfp) { =end -- http://bugs.ruby-lang.org/