[#32910] NKF,Kconv — Kazuhiro NISHIYAMA <zn@...>
西山和広です。
[#32913] openの"b"とencoding — Kazuhiro NISHIYAMA <zn@...>
西山和広です。
[#32922] SEGV by regexp match in while loop — Tanaka Akira <akr@...>
Debian GNU/Linux (sarge) の gcc-3.4 を使ってビルドした ruby
[#32935] queue and timeout — Tanaka Akira <akr@...>
timeout で Queue#pop に時間制限をつけた時、タイムアウト時に
まつもと ゆきひろです
[#32940] ripper cannot build on win32 — yukimi_sake <yukimi_sake@...>
雪見酒です。
[#32945] Shift_JIS variants and UTF-16 support — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
中村さん、こんにちは。
まつもと ゆきひろです
成瀬です。
まつもと ゆきひろです
こんにちは、なかむら(う)です。
成瀬です。
こんにちは、なかむら(う)です。
成瀬です。
こんにちは、なかむら(う)です。
まつもと ゆきひろです
[#32946] replica と alias の違い(encoding) — KIMURA Koichi <kimura.koichi@...>
木村です。
[#32987] error with open-uri (instance_eval?) — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
[#32988] Re: [ruby-cvs:22194] Ruby:r14957 (trunk): * encoding.c (rb_enc_init): UTF-{16,32}{BE,LE} are not builtin. — Yukihiro Matsumoto <matz@...>
まつもと ゆきひろです
[#32992] ASCII is alias of US-ASCII; replica of dummy encoding is not a dummy — "NARUSE, Yui" <naruse@...>
成瀬です。
まつもと ゆきひろです
At 18:13 08/01/09, Yukihiro Matsumoto wrote:
成瀬です。
まつもと ゆきひろです
成瀬です。
まつもと ゆきひろです
なかだです。
まつもと ゆきひろです
[#32996] binmode and ASCII-8BIT — Kazuhiro NISHIYAMA <zn@...>
西山和広です。
[#33069] Re: [ruby-cvs:22244] Ruby:r15007 (trunk): * enc/make_encdb.rb: added. search enc/*.c and make encoding database. — Yukihiro Matsumoto <matz@...>
まつもと ゆきひろです
まつもと ゆきひろです
[#33076] Encoding.compatible? and dummy encodings — sheepman <sheepman@...>
こんにちは sheepman です。
成瀬です。
まつもと ゆきひろです
[#33078] NEW REPLICA ENCODINGS AND ENCODING ALIASES — "NARUSE, Yui" <naruse@...>
成瀬です。
[#33101] String#valid_encoding? shoud be strict? — Masayoshi Takahashi <maki@...>
高橋征義です。1.9のエンコーディングとString#valid_encoding?について。
[#33139] Bignum#* might invoke GC parallelly? — "Yusuke ENDOH" <mame@...>
遠藤と申します。
[#33156] default script encoding and -K option — sheepman <sheepman@...>
こんばんは sheepman です。
こんにちは、なかむら(う)です。
まつもと ゆきひろです
[#33164] default encoding for Marshal.load — "Shugo Maeda" <shugo@...>
前田です。
まつもと ゆきひろです
[#33185] コンパイルの問題 (r15218) — Martin Duerst <duerst@...>
r15128 当たりで (実はもう少し前から) コンパイルできなくなりました。
[#33218] Re: Ruby1.9String バイト列へのインデックス アクセス — "Hisanori Kiryu" <hkiryu@...>
> ちなみに、byte のではなく bytes の方が妥当だと思います。
[#33224] printf "%0x" — Tanaka Akira <akr@...>
printf の %0x に負の整数を与えると、値によって .. がついたり
[#33226] [PATCH] warnings of enc/trans/utf_16_32.c — Nobuyoshi Nakada <nobu@...>
なかだです。
[#33239] Re: [ruby-cvs:22386] Ruby:r15149 (trunk): * string.c (rb_str_each_char): move forward. — Tanaka Akira <akr@...>
In article <200801210259.m0L2x3CW017171@ci.ruby-lang.org>,
なかだです。
In article <20080121065650.55F60E0662@mail.bc9.jp>,
なかだです。
まつもと ゆきひろです
[#33247] requests to transcode — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
[#33303] Time#strftimeのエンコーディング — rubikitch@...
るびきちです。
まつもと ゆきひろです
なかだです。
西山和広です。
[#33368] summary of script encoding — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
まつもと ゆきひろです
こんにちは、なかむら(う)です。
まつもと ゆきひろです
永井@知能.九工大です.
[#33387] HashからStructを作る — rubikitch@...
るびきちです。
まつもと ゆきひろです
From: Yukihiro Matsumoto <matz@ruby-lang.org>
まつもと ゆきひろです
From: Yukihiro Matsumoto <matz@ruby-lang.org>
まつもと ゆきひろです
From: Yukihiro Matsumoto <matz@ruby-lang.org>
まつもと ゆきひろです
[#33399] regexp match /.../n against to UTF-8 string — Tanaka Akira <akr@...>
以下のように、つけてもいない正規表現の n オプションに関して
[#33400] /#{}/e.encoding — Tanaka Akira <akr@...>
以下のように /#{}/e の encoding が US-ASCII になります。
[#33403] wrapped String#gsub — "Park Ji-In" <tisphie@...>
こんにちは、朴 芝印です。
[#33417] コンパイルの問題 — Martin Duerst <duerst@...>
現在 (r15264 で) コンパイル使用とすると、エラーになります:
At 16:28 08/01/27, you wrote:
[#33433] Win32OLE: set encoding to OLE string — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
成瀬です。
助田です。
こんにちは、なかむら(う)です。
こんにちは、なかむら(う)です。
[#33452] enc/euc_kr.c (euckr_mbc_enc_len) euc_kr.c is also used by CP942 — "NARUSE, Yui" <naruse@...>
成瀬です。
まつもと ゆきひろです
成瀬です。
[#33461] Failed to make ruby-1.8.6-p111 on MacOSX 10.5(Leopard) — MORITA Hideyuki <h-morita@...>
=1B$B?9ED$H?=3D$7$^$9!#=1B(B
なかだです。
森田です。
なかだです。
森田です。
天野竜太郎と申します。
森田です。
天野です。
森田です。
天野です。
森田です。
天野です。
森田です。
天野です。
[#33488] 現在の script encoding の値を得る方法は? — Hidetoshi NAGAI <nagai@...>
永井@知能.九工大です.
まつもと ゆきひろです
永井@知能.九工大です.
成瀬です。
永井@知能.九工大です.
成瀬です。
永井@知能.九工大です.
成瀬です。
In article <47A00E86.4010701@airemix.com>,
成瀬です。
In article <47A03C9D.2090008@airemix.com>,
In article <87hcgvu1ng.fsf@fsij.org>,
[#33521] nkf の CP932 — Martin Duerst <duerst@...>
成瀬さん、皆さん、こんにちは。
[#33548] block parameter of String#gsub — "NARUSE, Yui" <naruse@...>
成瀬です。
まつもと ゆきひろです
[ruby-dev:33139] Bignum#* might invoke GC parallelly?
遠藤と申します。
rb_big_mul や divrem は rb_thread_blocking_region の中で実行されますが、
その中でオブジェクトを生成するため、GC が GVL をロックしない状態で発生
する (下手をすると GC が並列に動作する) 可能性があるような気がしました。
他人事のように言ってますが、rb_thread_blocking_region で実行するように
提案してパッチを書いたのは私です ([ruby-dev:32632]) 。ごめんなさい。
危なそうな例でも落ちたことはないので実は問題ないのかもしれません。でも
少し怖いので、オブジェクトの生成を rb_thread_blocking_region の外で行う
パッチを書いてみました。ご検討ください。
また、FFT を用いた乗算 ([ruby-dev:32629]) のことも検討していただけると
嬉しいです。
Index: bignum.c
===================================================================
--- bignum.c (revision 15080)
+++ bignum.c (working copy)
@@ -1449,7 +1449,7 @@
}
struct big_mul_struct {
- VALUE x, y, stop;
+ VALUE x, y, z, stop;
};
static VALUE
@@ -1458,11 +1458,10 @@
struct big_mul_struct *bms = (struct big_mul_struct*)ptr;
long i, j;
BDIGIT_DBL n = 0;
- VALUE x = bms->x, y = bms->y, z;
+ VALUE x = bms->x, y = bms->y, z = bms->z;
BDIGIT *zds;
j = RBIGNUM_LEN(x) + RBIGNUM_LEN(y) + 1;
- z = bignew(j, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
zds = BDIGITS(z);
while (j--) zds[j] = 0;
for (i = 0; i < RBIGNUM_LEN(x); i++) {
@@ -1488,7 +1487,7 @@
rb_big_mul0(VALUE x, VALUE y)
{
struct big_mul_struct bms;
- VALUE z;
+ volatile VALUE z;
switch (TYPE(y)) {
case T_FIXNUM:
@@ -1507,6 +1506,7 @@
bms.x = x;
bms.y = y;
+ bms.z = bignew(RBIGNUM_LEN(x) + RBIGNUM_LEN(y),
RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
bms.stop = Qfalse;
if (RBIGNUM_LEN(x) + RBIGNUM_LEN(y) > 10000) {
@@ -1533,20 +1533,64 @@
}
struct big_div_struct {
- VALUE x, y, *divp, *modp, stop;
+ long nx, ny;
+ BDIGIT *yds, *zds;
+ VALUE stop;
};
static VALUE
bigdivrem1(void *ptr)
{
struct big_div_struct *bds = (struct big_div_struct*)ptr;
- VALUE x = bds->x, y = bds->y, *divp = bds->divp, *modp = bds->modp;
+ long nx = bds->nx, ny = bds->ny;
+ long i, j;
+ BDIGIT *yds = bds->yds, *zds = bds->zds;
+ BDIGIT_DBL_SIGNED num;
+ BDIGIT_DBL t2;
+ BDIGIT q;
+
+ j = nx==ny?nx+1:nx;
+ do {
+ if (bds->stop) return Qnil;
+ if (zds[j] == yds[ny-1]) q = BIGRAD-1;
+ else q = (BDIGIT)((BIGUP(zds[j]) + zds[j-1])/yds[ny-1]);
+ if (q) {
+ i = 0; num = 0; t2 = 0;
+ do { /* multiply and subtract */
+ BDIGIT_DBL ee;
+ t2 += (BDIGIT_DBL)yds[i] * q;
+ ee = num - BIGLO(t2);
+ num = (BDIGIT_DBL)zds[j - ny + i] + ee;
+ if (ee) zds[j - ny + i] = BIGLO(num);
+ num = BIGDN(num);
+ t2 = BIGDN(t2);
+ } while (++i < ny);
+ num += zds[j - ny + i] - t2;/* borrow from high digit; don't update */
+ while (num) { /* "add back" required */
+ i = 0; num = 0; q--;
+ do {
+ BDIGIT_DBL ee = num + yds[i];
+ num = (BDIGIT_DBL)zds[j - ny + i] + ee;
+ if (ee) zds[j - ny + i] = BIGLO(num);
+ num = BIGDN(num);
+ } while (++i < ny);
+ num--;
+ }
+ }
+ zds[j] = q;
+ } while (--j >= ny);
+ return Qnil;
+}
+
+static VALUE
+bigdivrem(VALUE x, VALUE y, VALUE *divp, VALUE *modp)
+{
+ struct big_div_struct bds;
long nx = RBIGNUM_LEN(x), ny = RBIGNUM_LEN(y);
long i, j;
- VALUE yy, z;
+ volatile VALUE yy, z;
BDIGIT *xds, *yds, *zds, *tds;
BDIGIT_DBL t2;
- BDIGIT_DBL_SIGNED num;
BDIGIT dd, q;
if (BIGZEROP(y)) rb_num_zerodiv();
@@ -1612,36 +1656,18 @@
while (j--) zds[j] = xds[j];
}
- j = nx==ny?nx+1:nx;
- do {
- if (bds->stop) return Qnil;
- if (zds[j] == yds[ny-1]) q = BIGRAD-1;
- else q = (BDIGIT)((BIGUP(zds[j]) + zds[j-1])/yds[ny-1]);
- if (q) {
- i = 0; num = 0; t2 = 0;
- do { /* multiply and subtract */
- BDIGIT_DBL ee;
- t2 += (BDIGIT_DBL)yds[i] * q;
- ee = num - BIGLO(t2);
- num = (BDIGIT_DBL)zds[j - ny + i] + ee;
- if (ee) zds[j - ny + i] = BIGLO(num);
- num = BIGDN(num);
- t2 = BIGDN(t2);
- } while (++i < ny);
- num += zds[j - ny + i] - t2;/* borrow from high digit; don't update */
- while (num) { /* "add back" required */
- i = 0; num = 0; q--;
- do {
- BDIGIT_DBL ee = num + yds[i];
- num = (BDIGIT_DBL)zds[j - ny + i] + ee;
- if (ee) zds[j - ny + i] = BIGLO(num);
- num = BIGDN(num);
- } while (++i < ny);
- num--;
- }
- }
- zds[j] = q;
- } while (--j >= ny);
+ bds.nx = nx;
+ bds.ny = ny;
+ bds.zds = zds;
+ bds.yds = yds;
+ bds.stop = Qfalse;
+ if (RBIGNUM_LEN(x) > 10000 || RBIGNUM_LEN(y) > 10000) {
+ z = rb_thread_blocking_region(bigdivrem1, &bds, rb_big_stop, &bds.stop);
+ }
+ else {
+ z = bigdivrem1(&bds);
+ }
+
if (divp) { /* move quotient down in z */
*divp = rb_big_clone(z);
zds = BDIGITS(*divp);
@@ -1665,26 +1691,6 @@
RBIGNUM_SET_LEN(*modp, ny);
RBIGNUM_SET_SIGN(*modp, RBIGNUM_SIGN(x));
}
- return Qnil;
-}
-
-static VALUE
-bigdivrem(VALUE x, VALUE y, VALUE *divp, VALUE *modp)
-{
- struct big_div_struct bds;
- VALUE z;
-
- bds.x = x;
- bds.y = y;
- bds.divp = divp;
- bds.modp = modp;
- bds.stop = Qfalse;
- if (RBIGNUM_LEN(x) > 10000 || RBIGNUM_LEN(y) > 10000) {
- z = rb_thread_blocking_region(bigdivrem1, &bds, rb_big_stop, &bds.stop);
- }
- else {
- z = bigdivrem1(&bds);
- }
return z;
}
--
Yusuke ENDOH <mame@tsg.ne.jp>