[#62297] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap. — Eric Wong <normalperson@...>
[email protected] wrote:
7 messages
2014/05/02
[#62307] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
— SASADA Koichi <ko1@...>
2014/05/03
(2014/05/03 4:41), Eric Wong wrote:
[#62402] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
— Eric Wong <normalperson@...>
2014/05/05
SASADA Koichi <[email protected]> wrote:
[#62523] [ruby-trunk - Feature #9632] [PATCH 0/2] speedup IO#close with linked-list from ccan — ko1@...
Issue #9632 has been updated by Koichi Sasada.
3 messages
2014/05/11
[#62556] doxygen (Re: Re: [ruby-trunk - Feature #9632] [PATCH 0/2] speedup IO#close with linked-list from ccan) — Tanaka Akira <akr@...>
2014-05-11 8:50 GMT+09:00 Eric Wong <[email protected]>:
3 messages
2014/05/13
[#62727] [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl — Eric Wong <normalperson@...>
rb_unlink_method_entry may cause old_me to be swept before the new
7 messages
2014/05/24
[#63039] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— SASADA Koichi <ko1@...>
2014/06/10
Hi,
[#63077] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— Eric Wong <normalperson@...>
2014/06/10
SASADA Koichi <[email protected]> wrote:
[#63086] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— SASADA Koichi <ko1@...>
2014/06/11
(2014/06/11 4:47), Eric Wong wrote:
[#63087] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— Eric Wong <normalperson@...>
2014/06/11
SASADA Koichi <[email protected]> wrote:
[#62862] [RFC] README.EXT: document rb_gc_register_mark_object — Eric Wong <normalperson@...>
Any comment on officially supporting this as part of the C API?
5 messages
2014/05/30
[ruby-core:62880] [ruby-trunk - Feature #9888] [Open] Hide Complex internal
From:
shyouhei@...
Date:
2014-05-31 12:53:12 UTC
List:
ruby-core #62880
Issue #9888 has been reported by Shyouhei Urabe. ---------------------------------------- Feature #9888: Hide Complex internal https://bugs.ruby-lang.org/issues/9888 * Author: Shyouhei Urabe * Status: Open * Priority: Normal * Assignee: * Category: core * Target version: current: 2.2.0 ---------------------------------------- ~~~Patch From 774261d2b6f4fc077ba041a1c6cfbed3f1bf282b Mon Sep 17 00:00:00 2001 From: "Urabe, Shyouhei" <[email protected]> Date: Sat, 31 May 2014 21:48:10 +0900 Subject: [PATCH] Hide Complex internal So I agree with Eric and tried to hide RSymbol, but turned out that was already done by him :p Here you are the other (seemingly) okay struct to hide. Signed-off-by: Urabe, Shyouhei <[email protected]> --- ChangeLog | 10 ++++++++++ complex.c | 21 ++++++++++++++++----- include/ruby/ruby.h | 11 ++--------- internal.h | 8 ++++++++ 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f8d338..92d0e38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Sat May 31 21:47:40 2014 URABE Shyouhei <[email protected]> + + * include/ruby/ruby.h (struct RComplex) : no longer. + + * internal.h (struct RComplex) : moved here. + + * complex.c (RCOMPLEX_SET_REAL): add compatibilty setter function. + + * complex.c (RCOMPLEX_SET_IMAG): ditto. + Sat May 31 16:32:50 2014 SHIBATA Hiroshi <[email protected]> * lib/ipaddr.rb: extracted inline tests into test dir. diff --git a/complex.c b/complex.c index f9f9eed..bea5e1a 100644 --- a/complex.c +++ b/complex.c @@ -24,6 +24,16 @@ static ID id_abs, id_arg, id_convert, id_real_p, id_to_f, id_to_i, id_to_r, id_i_real, id_i_imag; +VALUE RCOMPLEX_SET_REAL(VALUE cmp, VALUE r) +{ + return RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r)); +} + +VALUE RCOMPLEX_SET_IMAG(VALUE cmp, VALUE i) +{ + return RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i)); +} + #define f_boolcast(x) ((x) ? Qtrue : Qfalse) #define binop(n,op) \ @@ -272,11 +282,12 @@ inline static VALUE nucomp_s_new_internal(VALUE klass, VALUE real, VALUE imag) { NEWOBJ_OF(obj, struct RComplex, klass, T_COMPLEX | (RGENGC_WB_PROTECTED_COMPLEX ? FL_WB_PROTECTED : 0)); + VALUE ret = (VALUE)obj; - RCOMPLEX_SET_REAL(obj, real); - RCOMPLEX_SET_IMAG(obj, imag); + RCOMPLEX_SET_REAL(ret, real); + RCOMPLEX_SET_IMAG(ret, imag); - return (VALUE)obj; + return ret; } static VALUE @@ -1281,8 +1292,8 @@ nucomp_loader(VALUE self, VALUE a) { get_dat1(self); - RCOMPLEX_SET_REAL(dat, rb_ivar_get(a, id_i_real)); - RCOMPLEX_SET_IMAG(dat, rb_ivar_get(a, id_i_imag)); + RCOMPLEX_SET_REAL(self, rb_ivar_get(a, id_i_real)); + RCOMPLEX_SET_IMAG(self, rb_ivar_get(a, id_i_imag)); return self; } diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 7c7cb67..a664217 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -943,14 +943,8 @@ struct RFile { struct rb_io_t *fptr; }; -struct RComplex { - struct RBasic basic; - const VALUE real; - const VALUE imag; -}; - -#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r)) -#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i)) +VALUE RCOMPLEX_SET_REAL(VALUE cmp, VALUE r); +VALUE RCOMPLEX_SET_IMAG(VALUE cmp, VALUE i); struct RData { struct RBasic basic; @@ -1086,7 +1080,6 @@ struct RStruct { #define RTYPEDDATA(obj) (R_CAST(RTypedData)(obj)) #define RSTRUCT(obj) (R_CAST(RStruct)(obj)) #define RFILE(obj) (R_CAST(RFile)(obj)) -#define RCOMPLEX(obj) (R_CAST(RComplex)(obj)) #define FL_SINGLETON FL_USER0 #define FL_WB_PROTECTED (((VALUE)1)<<5) diff --git a/internal.h b/internal.h index 2c1c6a3..3e09bbf 100644 --- a/internal.h +++ b/internal.h @@ -420,6 +420,14 @@ struct RSymbol { #define RSYMBOL(obj) (R_CAST(RSymbol)(obj)) +struct RComplex { + struct RBasic basic; + const VALUE real; + const VALUE imag; +}; + +#define RCOMPLEX(obj) (R_CAST(RComplex)(obj)) + /* class.c */ void rb_class_subclass_add(VALUE super, VALUE klass); void rb_class_remove_from_super_subclasses(VALUE); -- 1.9.1 ~~~ -- https://bugs.ruby-lang.org/