[ruby/bigdecimal] Avoid RB_GC_GUARD(a) = b in bigdecimal
* This is not supported on TruffleRuby, which requires the value to be set before RB_GC_GUARD() is called. * See https://github.com/oracle/truffleruby/pull/2879 https://github.com/ruby/bigdecimal/commit/7b2957922f
This commit is contained in:
parent
93ac7405b8
commit
5077cc2be6
@ -4142,11 +4142,14 @@ get_vp_value:
|
|||||||
}
|
}
|
||||||
x = VpCheckGetValue(vx);
|
x = VpCheckGetValue(vx);
|
||||||
|
|
||||||
RB_GC_GUARD(one) = VpCheckGetValue(NewOneWrapLimited(1, 1));
|
one = VpCheckGetValue(NewOneWrapLimited(1, 1));
|
||||||
RB_GC_GUARD(two) = VpCheckGetValue(VpCreateRbObject(1, "2", true));
|
two = VpCheckGetValue(VpCreateRbObject(1, "2", true));
|
||||||
|
RB_GC_GUARD(one);
|
||||||
|
RB_GC_GUARD(two);
|
||||||
|
|
||||||
n = prec + BIGDECIMAL_DOUBLE_FIGURES;
|
n = prec + BIGDECIMAL_DOUBLE_FIGURES;
|
||||||
RB_GC_GUARD(vn) = SSIZET2NUM(n);
|
vn = SSIZET2NUM(n);
|
||||||
|
RB_GC_GUARD(vn);
|
||||||
expo = VpExponent10(vx);
|
expo = VpExponent10(vx);
|
||||||
if (expo < 0 || expo >= 3) {
|
if (expo < 0 || expo >= 3) {
|
||||||
char buf[DECIMAL_SIZE_OF_BITS(SIZEOF_VALUE * CHAR_BIT) + 4];
|
char buf[DECIMAL_SIZE_OF_BITS(SIZEOF_VALUE * CHAR_BIT) + 4];
|
||||||
@ -4158,9 +4161,12 @@ get_vp_value:
|
|||||||
}
|
}
|
||||||
w = BigDecimal_sub(x, one);
|
w = BigDecimal_sub(x, one);
|
||||||
x = BigDecimal_div2(w, BigDecimal_add(x, one), vn);
|
x = BigDecimal_div2(w, BigDecimal_add(x, one), vn);
|
||||||
RB_GC_GUARD(x2) = BigDecimal_mult2(x, x, vn);
|
x2 = BigDecimal_mult2(x, x, vn);
|
||||||
RB_GC_GUARD(y) = x;
|
y = x;
|
||||||
RB_GC_GUARD(d) = y;
|
d = y;
|
||||||
|
RB_GC_GUARD(x2);
|
||||||
|
RB_GC_GUARD(y);
|
||||||
|
RB_GC_GUARD(d);
|
||||||
i = 1;
|
i = 1;
|
||||||
while (!VpIsZero((Real*)DATA_PTR(d))) {
|
while (!VpIsZero((Real*)DATA_PTR(d))) {
|
||||||
SIGNED_VALUE const ey = VpExponent10(DATA_PTR(y));
|
SIGNED_VALUE const ey = VpExponent10(DATA_PTR(y));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user