[#43284] [Ruby 1.9 - Bug #4456] [Open] Time#strftime で %F 指定子に大きな幅を指定した際の不具合 — tadayoshi funaba <redmine@...>
14 messages
2011/03/02
[#43285] [Ruby 1.9 - Bug #4457] [Open] Time#strftime で %z 指定子などに大きな幅を指定した際の不具合 — tadayoshi funaba <redmine@...>
6 messages
2011/03/02
[#43296] [Ruby 1.9 - Bug #3990] [Assigned]tests of rexml/rss reports many errors and failures without iconv — Yui NARUSE <redmine@...>
5 messages
2011/03/03
[#43297] Re: [Ruby 1.9 - Bug #3990] [Assigned]tests of rexml/rss reports many errors and failures without iconv
— SASADA Koichi <ko1@...>
2011/03/03
(2011/03/03 18:56), Yui NARUSE wrote:
[#43298] Re: [Ruby 1.9 - Bug #3990] [Assigned]tests of rexml/rss reports many errors and failures without iconv
— "U.Nakamura" <usa@...>
2011/03/03
こんにちは、なかむら(う)です。
[#43317] [Ruby 1.9 - Bug #4474][Open] 複数のスレッドからトランザクションに入ろうとした場合のPStoreの挙動 — Masaki Matsushita <redmine@...>
9 messages
2011/03/06
[#43346] [BUG] lib/irb/locale.rb — keiju@... (Keiju ISHITSUKA)
けいじゅ@いしつかです.
8 messages
2011/03/24
[#43347] Re: [BUG] lib/irb/locale.rb
— Yugui <yugui@...>
2011/03/24
2011/3/24 Keiju ISHITSUKA <keiju@ishitsuka.com>:
[#43355] [Ruby 1.9 - Feature #4529][Assigned] date_core と long 型 — Yui NARUSE <redmine@...>
10 messages
2011/03/25
[#43359] [Ruby 1.9 - Feature #4529][Rejected] date_core と long 型
— tadayoshi funaba <redmine@...>
2011/03/26
[#43360] Re: [ruby-dev:43359] [Ruby 1.9 - Feature #4529][Rejected] date_core と long 型
— "NARUSE, Yui" <naruse@...>
2011/03/26
(2011/03/26 19:21), tadayoshi funaba wrote:
[#43365] [Ruby 1.9 - Bug #4536][Open] 定数参照について1.8と1.9の違い — Yukihiro Matsumoto <matz@...>
11 messages
2011/03/29
[#43366] Re: [ruby-dev:43365] [Ruby 1.9 - Bug #4536][Open] 定数参照について1.8と1.9の違い
— SASADA Koichi <ko1@...>
2011/03/29
ささだです.
[ruby-dev:43311] Re: iseq_compile_each()でのマジックナンバ
From:
きたざわけんいち <peisunstar@...>
Date:
2011-03-06 02:25:27 UTC
List:
ruby-dev #43311
北澤です。
iseq_compile_each(compile.c)のNODE_BREAKあたりのマジックナンバのパッチを送ります。
svn diffで差分をとったけど、これでよいのかしら?
色々未経験な部分があるので、指摘してください。
Index: vm_core.h
===================================================================
--- vm_core.h (リビジョン 31028)
+++ vm_core.h (作業コピー)
@@ -583,6 +583,12 @@
#define RUBYVM_CFUNC_FRAME_P(cfp) \
(VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
+/* vm_throw state */
+#define VM_THROW_GET_DFP 0x8000
+#define VM_THROW_STATE_MASK 0xff
+#define VM_THROW_LVL_SHIFT 16
+#define VM_THROW_LEVEL(s) (s >> VM_THROW_LVL_SHIFT)
+
/* inline cache */
typedef struct iseq_inline_cache_entry *IC;
Index: compile.c
===================================================================
--- compile.c (リビジョン 31028)
+++ compile.c (作業コピー)
@@ -15,6 +15,7 @@
#define USE_INSN_STACK_INCREASE 1
#include "vm_core.h"
#include "iseq.h"
+#include "eval_intern.h"
#include "insns.inc"
#include "insns_info.inc"
@@ -3336,7 +3337,7 @@
break_by_insn:
/* escape from block */
COMPILE(ret, "break val (block)", node->nd_stts);
- ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | 0x02) /*
TAG_BREAK */ );
+ ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | TAG_BREAK)
/* TAG_BREAK */ );
if (poped) {
ADD_INSN(ret, nd_line(node), pop);
}
@@ -3355,11 +3356,7 @@
level++;
if (ip->compile_data->redo_label != 0) {
- level = 0x8000;
- if (ip->compile_data->loopval_popped == 0) {
- /* need value */
- level |= 0x4000;
- }
+ level = VM_THROW_GET_DFP;
goto break_by_insn;
}
else if (ip->type == ISEQ_TYPE_BLOCK) {
@@ -3419,7 +3416,7 @@
break;
}
- level = 0x8000 | 0x4000;
+ level = VM_THROW_GET_DFP;
if (ip->compile_data->redo_label != 0) {
/* while loop */
break;
@@ -3435,7 +3432,7 @@
}
if (ip != 0) {
COMPILE(ret, "next val", node->nd_stts);
- ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | 0x03) /* TAG_NEXT */ );
+ ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | TAG_NEXT) /*
TAG_NEXT */ );
if (poped) {
ADD_INSN(ret, nd_line(node), pop);
@@ -3481,7 +3478,7 @@
else {
rb_iseq_t *ip;
unsigned long level;
- level = 0x8000 | 0x4000;
+ level = VM_THROW_GET_DFP;
ip = iseq;
while (ip) {
if (!ip->compile_data) {
@@ -3503,7 +3500,7 @@
}
if (ip != 0) {
ADD_INSN(ret, nd_line(node), putnil);
- ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | 0x05) /* TAG_REDO */ );
+ ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | TAG_REDO) /*
TAG_REDO */ );
if (poped) {
ADD_INSN(ret, nd_line(node), pop);
@@ -3518,7 +3515,7 @@
case NODE_RETRY:{
if (iseq->type == ISEQ_TYPE_RESCUE) {
ADD_INSN(ret, nd_line(node), putnil);
- ADD_INSN1(ret, nd_line(node), throw, INT2FIX(0x04) /* TAG_RETRY */ );
+ ADD_INSN1(ret, nd_line(node), throw, INT2FIX(TAG_RETRY) /* TAG_RETRY */ );
if (poped) {
ADD_INSN(ret, nd_line(node), pop);
@@ -4316,7 +4313,7 @@
}
}
else {
- ADD_INSN1(ret, nd_line(node), throw, INT2FIX(0x01) /* TAG_RETURN */ );
+ ADD_INSN1(ret, nd_line(node), throw, INT2FIX(TAG_RETURN) /*
TAG_RETURN */ );
if (poped) {
ADD_INSN(ret, nd_line(node), pop);
}
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c (リビジョン 31028)
+++ vm_insnhelper.c (作業コピー)
@@ -1432,9 +1432,9 @@
vm_throw(rb_thread_t *th, rb_control_frame_t *reg_cfp,
rb_num_t throw_state, VALUE throwobj)
{
- int state = (int)(throw_state & 0xff);
- int flag = (int)(throw_state & 0x8000);
- rb_num_t level = throw_state >> 16;
+ int state = (int)(throw_state & VM_THROW_STATE_MASK);
+ int flag = (int)(throw_state & VM_THROW_GET_DFP);
+ rb_num_t level = VM_THROW_LEVEL(throw_state);
if (state != 0) {
VALUE *pt = 0;
--
---
ぺーさん(peisunstar@gmail.com)