Bignum#* might invoke GC parallelly?

e$B1sF#$H?=$7$^$9!#e(B

rb_big_mul e$B$de(B divrem e$B$Oe(B rb_thread_blocking_region
e$B$NCf$G<B9T$5$l$^$9$,!"e(B
e$B$=$NCf$G%*%V%8%’%/%H$r@8@.$9$k$?$a!“e(BGC e$B$,e(B GVL
e$B$r%m%C%/$7$J$$>uBV$GH/@8e(B
e$B$9$ke(B (e$B2<<j$r$9$k$He(B GC e$B$,JBNs$KF0:n$9$ke(B)
e$B2DG=@-$,$”$k$h$&$J5$$,$7$^$7$?!#e(B

e$BB>?M;v$N$h$&$K8@$C$F$^$9$,!"e(Brb_thread_blocking_region
e$B$G<B9T$9$k$h$&$Ke(B
e$BDs0F$7$F%Q%C%A$r=q$$$?$N$O;d$G$9e(B ([ruby-dev:32632])
e$B!#$4$a$s$J$5$$!#e(B

e$B4m$J$=$&$JNc$G$bMn$A$?$3$H$O$J$$$N$G<B$OLdBj$J$$$N$+$b$7$l$^$;$s!#$G$be(B
e$B>/$7I]$$$N$G!"%*%V%8%’%/%H$N@8@.$re(B rb_thread_blocking_region
e$B$N30$G9T$&e(B
e$B%Q%C%A$r=q$$$F$_$^$7$?!#$48!F$$/$@$5$$!#e(B

e$B$^$?!"e(BFFT e$B$rMQ$$$?>h;;e(B ([ruby-dev:32629])
e$B$N$3$H$b8!F$$7$F$$$?$@$1$k$He(B
e$B4r$7$$$G$9!#e(B

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 wrote:

e$B1sF#$H?=$7$^$9!#e(B

rb_big_mul e$B$de(B divrem e$B$Oe(B rb_thread_blocking_region e$B$NCf$G<B9T$5$l$^$9$,!"e(B
e$B$=$NCf$G%*%V%8%’%/%H$r@8@.$9$k$?$a!“e(BGC e$B$,e(B GVL e$B$r%m%C%/$7$J$$>uBV$GH/@8e(B
e$B$9$ke(B (e$B2<<j$r$9$k$He(B GC e$B$,JBNs$KF0:n$9$ke(B) e$B2DG=@-$,$”$k$h$&$J5$$,$7$^$7$?!#e(B

e$B!!LdBj$"$j$G$9!#e(B

e$B4m$J$=$&$JNc$G$bMn$A$?$3$H$O$J$$$N$G<B$OLdBj$J$$$N$+$b$7$l$^$;$s!#$G$be(B
e$B>/$7I]$$$N$G!"%*%V%8%’%/%H$N@8@.$re(B rb_thread_blocking_region e$B$N30$G9T$&e(B
e$B%Q%C%A$r=q$$$F$_$^$7$?!#$48!F$$/$@$5$$!#e(B

e$B!!$=$l$O$=$l$H$7$F!"1sF#$5$s$r%3%%C%?!<$K!"$H$$$&OC$O$I$3$G;$^$C$Fe(B
e$B$k$s$G$7$?$C$1!)!!$^$D$b$H$5$s$,%4!<$H8@$($PNI$$!)e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33141] Re: Bignum#* might invoke GC
parallelly?”
on Thu, 17 Jan 2008 09:54:38 +0900, SASADA Koichi [email protected]
writes:

|> e$B4m$J$=$&$JNc$G$bMn$A$?$3$H$O$J$$$N$G<B$OLdBj$J$$$N$+$b$7$l$^$;$s!#$G$be(B
|> e$B>/$7I]$$$N$G!“%*%V%8%'%/%H$N@8@.$re(B rb_thread_blocking_region e$B$N30$G9T$&e(B
|> e$B%Q%C%A$r=q$$$F$$^$7$?!#$48!F$$/$@$5$$!#e(B
|
|e$B!!$=$l$O$=$l$H$7$F!"1sF#$5$s$r%3%
%C%?!<$K!”$H$$$&OC$O$I$3$G;_$^$C$Fe(B
|e$B$k$s$G$7$?$C$1!)!!$^$D$b$H$5$s$,%4!<$H8@$($PNI$$!)e(B

e$B;d$O@>;3$5$s$re(BOKe$B$7$?;~$KF1;~$Ke(BOKe$B=P$7$?G’<1$G$$$^$9!#$G!“$=$Ne(B
e$B$3$H$O@>;3$5$s7PM3$G1sF#$5$s$KEA$o$C$F$k$O$:$G$9$+$i!“8e$O1se(B
e$BF#$5$s$+$ie(Bgpge$B$G%5%$%s$5$l$?e(Bssh2e$B8x3+80$re(B cvs-admin
e$B$XAw$C$F$$e(B
e$B$?$@$1$l$P!”%”%+%&%s%H$r:n$j$^$9!#e(B

e$B1sF#$G$9!#e(B

08/01/17 e$B$Ke(B Yukihiro M.[email protected]
e$B$5$s$O=q$-$^$7$?e(B:

|e$B!!$=$l$O$=$l$H$7$F!"1sF#$5$s$r%3%%C%?!<$K!"$H$$$&OC$O$I$3$G;$^$C$Fe(B
|e$B$k$s$G$7$?$C$1!)!!$^$D$b$H$5$s$,%4!<$H8@$($PNI$$!)e(B

e$B;d$O@>;3$5$s$re(BOKe$B$7$?;~$KF1;~$Ke(BOKe$B=P$7$?G’<1$G$$$^$9!#e(B

e$B;d$Oe(B OK e$B$rD:$$$?G’<1$G$$$^$;$s$G$7$?!#e(B

e$B8e$O1sF#$5$s$+$ie(Bgpge$B$G%5%$%s$5$l$?e(Bssh2e$B8x3+80$re(B cvs-admin e$B$XAw$C$F$$e(B
e$B$?$@$1$l$P!“%”%+%&%s%H$r:n$j$^$9!#e(B

e$BN;2r$7$^$7$?!#$"$j$,$H$&$4$6$$$^$9!#e(B

e$B1sF#$G$9!#e(B

08/01/28 e$B$Ke(B Tanaka A.[email protected] e$B$5$s$O=q$-$^$7$?e(B:

e$B4m$J$=$&$JNc$G$bMn$A$?$3$H$O$J$$$N$G<B$OLdBj$J$$$N$+$b$7$l$^$;$s!#$G$be(B
e$B>/$7I]$$$N$G!"%*%V%8%'%/%H$N@8@.$re(B rb_thread_blocking_region e$B$N30$G9T$&e(B
e$B%Q%C%A$r=q$$$F$_$^$7$?!#$48!F$$/$@$5$$!#e(B

e$B:#F|!“0J2<$N$h$&$Ke(B rb_thread_blocking_region e$BCf$Ke(B GC e$B$,H/@8e(B
e$B$7$?$H$-$Ke(B SEGV e$B$,5/$3$k$N$K=P2q$C$?$s$G$9$,!”$3$NLdBj$C$F$Ie(B
e$B$&$$$&OC$K$J$C$?$s$G$7$?$C$1e(B?

e$B$9$C$+$jK:$l$F$^$7$?!#$4$a$s$J$5$$!#e(B
e$B%Q%C%A$r$"$F$F$b$$$$$G$7$g$&$+!#e(B> e$BC/$+e(B

In article
[email protected],
“Yusuke ENDOH” [email protected] writes:

rb_big_mul e$B$de(B divrem e$B$Oe(B rb_thread_blocking_region e$B$NCf$G<B9T$5$l$^$9$,!"e(B
e$B$=$NCf$G%*%V%8%'%/%H$r@8@.$9$k$?$a!“e(BGC e$B$,e(B GVL e$B$r%m%C%/$7$J$$>uBV$GH/@8e(B
e$B$9$ke(B (e$B2<<j$r$9$k$He(B GC e$B$,JBNs$KF0:n$9$ke(B) e$B2DG=@-$,$”$k$h$&$J5$$,$7$^$7$?!#e(B

e$BB>?M;v$N$h$&$K8@$C$F$^$9$,!"e(Brb_thread_blocking_region e$B$G<B9T$9$k$h$&$Ke(B
e$BDs0F$7$F%Q%C%A$r=q$$$?$N$O;d$G$9e(B ([ruby-dev:32632]) e$B!#$4$a$s$J$5$$!#e(B

e$B4m$J$=$&$JNc$G$bMn$A$?$3$H$O$J$$$N$G<B$OLdBj$J$$$N$+$b$7$l$^$;$s!#$G$be(B
e$B>/$7I]$$$N$G!"%*%V%8%'%/%H$N@8@.$re(B rb_thread_blocking_region e$B$N30$G9T$&e(B
e$B%Q%C%A$r=q$$$F$_$^$7$?!#$48!F$$/$@$5$$!#e(B

e$B:#F|!“0J2<$N$h$&$Ke(B rb_thread_blocking_region e$BCf$Ke(B GC
e$B$,H/@8e(B
e$B$7$?$H$-$Ke(B SEGV e$B$,5/$3$k$N$K=P2q$C$?$s$G$9$,!”$3$NLdBj$C$F$Ie(B
e$B$&$$$&OC$K$J$C$?$s$G$7$?$C$1e(B?


test_convert(TestBignum): .
test_div(TestBignum): .
test_divmod(TestBignum): .
test_divrem(TestBignum): .
test_eq(TestBignum): .
test_eql(TestBignum): .
test_even(TestBignum): .
test_hash(TestBignum): .
test_int2inum(TestBignum): .
test_interrupt(TestBignum):
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/test/ruby/test_bignum.rb:352:
[BUG] Segmentation fault
ruby 1.9.0 (2008-01-28 revision 15288) [i686-linux]

– control frame ----------
c:0025 p:---- s:0089 b:0089 l:000088 d:000088 CFUNC :join
c:0024 p:0065 s:0086 b:0086 l:000aa4 d:000aa4 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/test/ruby/test_bignum.rb:352
c:0023 p:0008 s:0079 b:0078 l:000eb4 d:000eb4 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/test/ruby/test_bignum.rb:357
c:0022 p:0039 s:0075 b:0075 l:000074 d:000074 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testcase.rb:76
c:0021 p:0015 s:0070 b:0070 l:000064 d:000069 BLOCK
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:34
c:0020 p:---- s:0070 b:0070 l:000069 d:000069 FINISH :name
c:0019 p:---- s:0068 b:0068 l:000067 d:000067 CFUNC :each
c:0018 p:0026 s:0065 b:0065 l:000064 d:000064 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:33
c:0017 p:0015 s:0060 b:0060 l:000054 d:000059 BLOCK
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:34
c:0016 p:---- s:0060 b:0060 l:000059 d:000059 FINISH :concat
c:0015 p:---- s:0058 b:0058 l:000057 d:000057 CFUNC :each
c:0014 p:0026 s:0055 b:0055 l:000054 d:000054 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:33
c:0013 p:0015 s:0050 b:0050 l:000044 d:000049 BLOCK
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:34
c:0012 p:---- s:0050 b:0050 l:000049 d:000049 FINISH :%
c:0011 p:---- s:0048 b:0048 l:000047 d:000047 CFUNC :each
c:0010 p:0026 s:0045 b:0045 l:000044 d:000044 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:33
c:0009 p:0128 s:0040 b:0040 l:00181c d:00181c METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/ui/testrunnermediator.rb:46
c:0008 p:0008 s:0031 b:0031 l:000030 d:000030 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/ui/console/testrunner.rb:67
c:0007 p:0023 s:0028 b:0028 l:000027 d:000027 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/ui/console/testrunner.rb:41
c:0006 p:0026 s:0025 b:0025 l:000024 d:000024 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/ui/testrunnerutilities.rb:29
c:0005 p:0052 s:0020 b:0020 l:000019 d:000019 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/autorunner.rb:216
c:0004 p:0070 s:0016 b:0016 l:000015 d:000015 METHOD
/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/autorunner.rb:12
c:0003 p:0139 s:0008 b:0007 l:000006 d:000006 TOP ./test/runner.rb:9
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP :17

DBG> :
“/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/test/ruby/test_bignum.rb:352:in
interrupt'" DBG> : "/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/test/ruby/test_bignum.rb:357:in test_interrupt’”
DBG> :
“/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testcase.rb:76:in
run'" DBG> : "/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:34:in block in run’”
DBG> :
“/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:33:in
each'" DBG> : "/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:33:in run’”
DBG> :
“/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:34:in
block in run'" DBG> : "/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:33:in each’”
DBG> :
“/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:33:in
run'" DBG> : "/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:34:in block in run’”
DBG> :
“/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:33:in
each'" DBG> : "/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/testsuite.rb:33:in run’”
DBG> :
“/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/ui/testrunnermediator.rb:46:in
run_suite'" DBG> : "/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/ui/console/testrunner.rb:67:in start_mediator’”
DBG> :
“/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/ui/console/testrunner.rb:41:in
start'" DBG> : "/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/ui/testrunnerutilities.rb:29:in run’”
DBG> :
“/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/autorunner.rb:216:in
run'" DBG> : "/disk3/akr/chkbuild-tmp/build/ruby-trunk/20080128T130252/ruby/lib/test/unit/autorunner.rb:12:in run’”
DBG> : “./test/runner.rb:9:in `'”
– backtrace of native function call (Use addr2line) –
0x80eaed0
0x81081eb
0x8108222
0x80bb120
0xffffe440
0x8064257
0x80642fd
0x80627be
0x80f98cd
0x80f990e
0x80f99f1
0x80fc6e2
0x80ec53e
0x80fc9d3
0x80fdcc0
0x80faab1
0x80fae6b
0x80fb1b9
0x80fb261
0x80fb2bc
0x80e8f0a
0x80ea15c
0x80e9642
0x80e6388
0x80e7b90
0x80e31c7
0x80e344a
0x80ebdd2
0x80eb2a8
0xb7f7eb63
0xb7ec418a

gmake: *** [test-all] Aborted (core dumped)
exit 2

binary:
/home/akr/chkbuild/tmp/build/ruby-trunk/20080128T130252/ruby/ruby
core:
/home/akr/chkbuild/tmp/build/ruby-trunk/20080128T130252/ruby/core.13203.chkbuild.1

warning: current_sos: Can’t read pathname for load map: Input/output
error

Using host libthread_db library “/lib/tls/libthread_db.so.1”.
Core was generated by `./test/runner.rb test_interrupt(TestBignum)
'.
Program terminated with signal 6, Aborted.
#0 0xb7e1483b in raise () from /lib/tls/libc.so.6
#0 0xb7e1483b in raise () from /lib/tls/libc.so.6
#1 0xb7e15fa2 in abort () from /lib/tls/libc.so.6
#2 0x08108227 in rb_bug (fmt=0x6 <Address 0x6 out of bounds>) at
error.c:226
#3 0x080bb120 in sigsegv (sig=11) at signal.c:540
#4
#5 mark_locations_array (x=0xb6bb4000, n=-1671500) at gc.c:745
#6 0x08064257 in mark_current_machine_context (th=0x0) at gc.c:1448
#7 0x080642fd in garbage_collect () at gc.c:1491
#8 0x080627be in ruby_xmalloc (size=54432) at gc.c:246
#9 0x080f98cd in rb_big_realloc (big=3058354540, len=0) at bignum.c:72
#10 0x080f990e in rb_big_resize (big=3058354540, len=13608) at
bignum.c:84
#11 0x080f99f1 in bignew_1 (klass=3065192528, len=13608, sign=1) at
bignum.c:99
#12 0x080fc6e2 in bigmul1 (ptr=0xb6b322e0) at bignum.c:1465
#13 0x080ec53e in rb_thread_blocking_region (func=0x80fc670 ,
data1=0xb6b32050, ubf=0, data2=0x0) at thread.c:714
#14 0x080fc9d3 in rb_big_mul0 (x=3058393440, y=3058393320) at
bignum.c:1513
#15 0x080fdcc0 in bigsqr (x=181465152) at bignum.c:1951
#16 0x080faab1 in power_cache_get_power (base=10, n1=157832, m1=0x28b)
at bignum.c:740
#17 0x080fae6b in big2str_karatsuba (x=3058435740, base=10,
ptr=0xb6762008 “+”, n1=0, len=315663, hbase=10000, trim=1) at
bignum.c:885
#18 0x080fb1b9 in rb_big2str0 (x=3058436400, base=10, trim=1) at
bignum.c:930
#19 0x080fb261 in rb_big2str (x=3065192528, base=-1229774768) at
bignum.c:943
#20 0x080fb2bc in rb_big_to_s (argc=0, argv=0xb6b32050, x=3065192528)
at bignum.c:969
#21 0x080e8f0a in call_cfunc (func=0x80fb270 <rb_big_to_s>,
recv=3058436400,
len=0, argc=0, argv=0xb6b3301c) at vm_insnhelper.c:282
#22 0x080ea15c in vm_call_cfunc (th=0xa826ab0, reg_cfp=0xb6bb2f28,
num=0,
id=792, recv=3058436400, klass=3084250200, flag=97, mn=0xb7d5ec30,
blockptr=0xb6b32050) at vm_insnhelper.c:372
#23 0x080e9642 in vm_call_method (th=0xa826ab0, cfp=0xb6bb2f28, num=0,
blockptr=0x0, flag=0, id=792, mn=0x0, recv=3058436400,
klass=3084250200)
at vm_insnhelper.c:504
#24 0x080e6388 in vm_eval (th=0xa826ab0, initial=0) at insns.def:1076
#25 0x080e7b90 in vm_eval_body (th=0xa826ab0) at vm.c:1147
#26 0x080e31c7 in invoke_block (th=0xa826ab0, block=0xa9518b8,
self=3083876340, argc=0, argv=0xa9f1a40, blockptr=0xb6b32050) at
vm.c:572
#27 0x080e344a in vm_invoke_proc (th=0xa826ab0, proc=0xa9518b8,
self=3083876340, argc=0, argv=0xa9f1a40, blockptr=0x0) at vm.c:606
#28 0x080ebdd2 in thread_start_func_2 (th=0xa826ab0,
stack_start=0xb6b32050)
at thread.c:314
#29 0x080eb2a8 in thread_start_func_1 (th_ptr=0xb6b32050)
at thread_pthread.c:175
#30 0xb7f7eb63 in start_thread () from /lib/tls/libpthread.so.0
#31 0xb7ec418a in clone () from /lib/tls/libc.so.6
gdb status: pid 14575 exit 0
failed(test-all)

e$B!!$5$5$@$G$9!#e(B

Yukihiro M. wrote:

e$BH=CG$O$5$5$@$/$s$,$9$k$N$,$$$$$H;W$C$F$?$s$G$9$1$I!":G6aH?1~e(B
e$B$,$"$j$^$;$s$M!#K;$7$$$N$+$J!#e(B

e$B!!:#=$O@?3::Cf$G$9!J?3::$9$k$[$&$G$b$5$l$k$[$&$G$bL5$$$G$9$,!K!#e(B

e$B%Q%C%A!“Ev$F$A$c$C$F$/$@$5$$!#ITK~$,$”$C$?$j!“JL$K9M$($F$$$ke(B
e$B%W%i%s$,$”$k$J$i!"$5$5$@$/$s$,%j%P!<%H$9$k$G$7$g$&!#e(B

e$B!!$I$&$>$*4j$$$7$^$9!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33471] Re: Bignum#* might invoke GC
parallelly?”
on Mon, 28 Jan 2008 21:04:12 +0900, “Yusuke ENDOH” [email protected]
writes:

|> e$B:#F|!“0J2<$N$h$&$Ke(B rb_thread_blocking_region e$BCf$Ke(B GC e$B$,H/@8e(B
|> e$B$7$?$H$-$Ke(B SEGV e$B$,5/$3$k$N$K=P2q$C$?$s$G$9$,!”$3$NLdBj$C$F$Ie(B
|> e$B$&$$$&OC$K$J$C$?$s$G$7$?$C$1e(B?
|
|e$B$9$C$+$jK:$l$F$^$7$?!#$4$a$s$J$5$$!#e(B
|e$B%Q%C%A$r$"$F$F$b$$$$$G$7$g$&$+!#e(B> e$BC/$+e(B

e$BH=CG$O$5$5$@$/$s$,$9$k$N$,$$$$$H;W$C$F$?$s$G$9$1$I!“:G6aH?1~e(B
e$B$,$”$j$^$;$s$M!#K;$7$$$N$+$J!#e(B

e$B%Q%C%A!“Ev$F$A$c$C$F$/$@$5$$!#ITK~$,$”$C$?$j!“JL$K9M$($F$$$ke(B
e$B%W%i%s$,$”$k$J$i!"$5$5$@$/$s$,%j%P!<%H$9$k$G$7$g$&!#e(B