aboutsummaryrefslogtreecommitdiffstats
path: root/random.c
Commit message (Collapse)AuthorAgeFilesLines
* random.c: get rid of blockingnobu2015-07-251-1/+7
| | | | | | | | * random.c (fill_random_bytes_syscall): get rid of blocking when no entropy is available. based on the patch by mame in [ruby-core:70114]. [Bug #11395] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix compile error with clangkazu2015-07-141-1/+1
| | | | | | | * random.c (fill_random_bytes_syscall): fix compile error with clang. [ruby-core:69931] [Bug #11343] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (fill_random_bytes_syscall): fix compile error.kazu2015-07-071-5/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: fix failures on old Linuxnormal2015-07-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows the behavior of fill_random_bytes_urandom and fixes the following failures I encountered on my old machine: 1) Error: TestSecureRandom#test_s_random_bytes_without_openssl: NotImplementedError: No random device $RUBYDIR/lib/securerandom.rb:66:in `gen_random' $RUBYDIR/lib/securerandom.rb:94:in `random_bytes' $RUBYDIR/test/test_securerandom.rb:12:in `test_s_random_bytes' $RUBYDIR/test/test_securerandom.rb:97:in `block in test_s_random_bytes_without_openssl' $RUBYDIR/lib/tmpdir.rb:88:in `mktmpdir' $RUBYDIR/test/test_securerandom.rb:85:in `test_s_random_bytes_without_openssl' 2) Error: TestSecureRandom#test_s_urlsafe_base64: NotImplementedError: No random device $RUBYDIR/lib/securerandom.rb:66:in `gen_random' $RUBYDIR/lib/securerandom.rb:94:in `random_bytes' $RUBYDIR/lib/securerandom.rb:164:in `urlsafe_base64' $RUBYDIR/test/test_securerandom.rb:131:in `block in test_s_urlsafe_base64' $RUBYDIR/test/test_securerandom.rb:130:in `times' $RUBYDIR/test/test_securerandom.rb:130:in `test_s_urlsafe_base64' 3) Error: TestSecureRandom#test_uuid: NotImplementedError: No random device $RUBYDIR/lib/securerandom.rb:66:in `gen_random' $RUBYDIR/lib/securerandom.rb:94:in `random_bytes' $RUBYDIR/lib/securerandom.rb:230:in `uuid' $RUBYDIR/test/test_securerandom.rb:160:in `test_uuid' * random.c (fill_random_bytes_syscall): return -1 for error * random.c (fill_random_bytes): try urandom on syscall failure git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: try getrandomnobu2015-07-071-1/+23
| | | | | | | * random.c (fill_random_bytes_syscall): try getrandom system call on Linux if supported by the kernel. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: separate fill_random_bytesnobu2015-07-071-15/+32
| | | | | | | * random.c (fill_random_bytes): separate into functions by system call and by direct read of urandom device. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: refactornobu2015-06-251-7/+6
| | | | | | | * random.c (fill_random_bytes): separate non-raced and raced conditions, on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: fix handle to releasenobu2015-03-191-2/+2
| | | | | | | * random.c (fill_random_bytes): release the handle in the static variable, not a local variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.h: suppress false warningsnobu2015-03-161-2/+0
| | | | | | | | * include/ruby/ruby.h (rb_data_object_alloc_warning): enable only if __builtin_choose_expr works with __builtin_constant_p so that warnings will be suppressed if klass is 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.h: suppress false warningsnobu2015-03-161-0/+2
| | | | | | | | * include/ruby/ruby.h (rb_data_object_alloc_warning): enable only if __builtin_choose_expr works with __builtin_constant_p so that warnings will be suppressed if klass is 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_raw_seed): Avoid calling fill_random_bytes()odaira2015-03-041-0/+1
| | | | | | | | if the requested size is 0. AIX returns -1 for 0-byte read from /dev/urandom, while other UNIX returns 0. With this change, Random.raw_seed(0) consistently retuns "" in any UNIX. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: suppress a warningnobu2015-02-151-1/+1
| | | | | | | * random.c (fill_random_bytes): use ATOMIC_SIZE_CAS to suppress a strict-aliasing warning by gcc 4.9 for mingw. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: ArgumentError for invalid argumentnobu2015-02-141-4/+17
| | | | | | | * random.c (rand_random_number): raise ArgumentError for invalid argument like as SecureRandom.random_number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: allow negative argument to random_numbernobu2015-02-141-8/+17
| | | | | | | * random.c (rand_random_number): allow negative argument as it is allowed by SecureRandom.random_number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: rand_random_numbernobu2015-02-141-50/+135
| | | | | | | | | * random.c (rand_random_number): add a method to return a random number like SecureRandom to Random::Formatter. * lib/securerandom.rb (random_bytes): move to Random::Formatter, the base method of the module. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: use PRIsVALUEnobu2015-02-141-3/+1
| | | | | | | * random.c (rand_random): use PRIsVALUE to format an error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: Random.raw_seednobu2015-02-141-28/+78
| | | | | | | | * random.c (random_raw_seed): extract platform dependent random seed initialization function as a new method Random.raw_seed. * lib/securerandom.rb (SecureRandom): use Random.raw_seed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use 0 for reservednobu2014-12-011-1/+1
| | | | | | | use 0 for rb_data_type_t::reserved instead of NULL, since its type may be changed in the future and possibly not a pointer type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Include ruby.h and ruby/encoding.h to beakr2014-11-151-1/+0
| | | | | | | | includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: fix castsnobu2014-07-091-4/+4
| | | | | | | * random.c (fill_random_seed): fix type to cast. this may or may not suppress warnings by icc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Init functions don't need ID cachesnobu2014-07-031-1/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.akr2014-02-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS. (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX. (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT. (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN. (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN. (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P. (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P. (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG. (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK. (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT. (BIGNUM_LEN): Renamed from RBIGNUM_LEN. (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS. (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT. * bignum.c: Follow the above change. * gc.c: Ditto. * marshal.c: Ditto. * math.c: Ditto. * numeric.c: Ditto. * random.c: Ditto. * rational.c: Ditto. * sprintf.c: Ditto. * ext/-test-/bignum/bigzero.c: Ditto. * ext/-test-/bignum/intpack.c: Ditto. * ext/bigdecimal/bigdecimal.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_init): Make it possible to specify arbitrary arrayakr2013-11-201-6/+0
| | | | | | | | for init_genrand(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only useko12013-10-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | safe functions during garbage collection such as xfree(). On default, T_DATA objects are freed at same points as fianlizers. This approach protects issues such as reported by [ruby-dev:35578]. However, freeing T_DATA objects immediately helps heap usage. Most of T_DATA (in other words, most of dfree functions) are safe. However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default for safety. * cont.c: ditto. * dir.c: ditto. * encoding.c: ditto. * enumerator.c: ditto. * error.c: ditto. * file.c: ditto. * gc.c: ditto. * io.c: ditto. * iseq.c: ditto. * marshal.c: ditto. * parse.y: ditto. * proc.c: ditto. * process.c: ditto. * random.c: ditto. * thread.c: ditto. * time.c: ditto. * transcode.c: ditto. * variable.c: ditto. * vm.c: ditto. * vm_backtrace.c: ditto. * vm_trace.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * ext/objspace/objspace.c: ditto. * ext/stringio/stringio.c: ditto. * ext/strscan/strscan.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (make_seed_value): a local array declaration was accessedmame2013-10-021-1/+1
| | | | | | out of scope. Coverity Scan found this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().ko12013-09-251-1/+1
| | | | | | | | | | | | | | | RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and usecase of this macro is not acquire raw pointer, but acquire read-only pointer. So we rename to better name. RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR() (I expect that nobody use it). * array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c, string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: coerce before check negativenobu2013-08-131-1/+1
| | | | | | | * random.c (rb_random_ulong_limited): coerce before check negative. [Fixes GH-379] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_load): use RARRAY_RAWPTR() instead ofko12013-08-071-2/+2
| | | | | | | | RARRAY_PTR() because there is no new reference. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo2013-06-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_int): Use rb_big_uminus.akr2013-06-111-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h (INTEGER_PACK_NEGATIVE): Defined.akr2013-06-111-5/+5
| | | | | | | | | | | | | | | | | | | | | (rb_integer_unpack): sign argument removed. * bignum.c (rb_integer_unpack): sign argument removed. Non-negative integers generated by default. INTEGER_PACK_NEGATIVE flag is used to generate non-positive integers. * pack.c (pack_unpack): Follow the above change. * random.c (int_pair_to_real_inclusive): Ditto. (make_seed_value): Ditto. (mt_state): Ditto. (limited_big_rand): Ditto. * marshal.c (r_object0): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_integer_pack): Returns sign instead of words.akr2013-06-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | (absint_numwords_generic): Follow the above change. (big2str_base_powerof2): Follow the above change. * internal.h: Ditto. * hash.c (rb_hash): Ditto. * pack.c (pack_pack): Ditto. * random.c (int_pair_to_real_inclusive): Ditto. (rand_init): Ditto. (random_load): Ditto. (limited_big_rand): Ditto. * time.c (v2w_bignum): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_absint_numwords): Renamed from rb_absint_size_in_word.akr2013-06-091-2/+2
| | | | | | | | | | | | | * internal.h (rb_absint_numwords): Follow the above change. * pack.c (pack_pack): Ditto. * random.c (rand_init): Ditto. (limited_big_rand): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_integer_pack): numwords_allocated argument removed.akr2013-06-091-4/+4
| | | | | | | | | | | | | | | | | | * internal.h (rb_integer_pack): Follow the above change. * hash.c (rb_hash): Ditto. * time.c (v2w_bignum): Ditto. * pack.c (pack_pack): Ditto. * random.c (int_pair_to_real_inclusive): Ditto. (rand_init): Ditto. (random_load): Ditto. (limited_big_rand): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (limited_big_rand): declare rnd, lim and mask as uint32_tcharliesome2013-06-081-3/+4
| | | | | | to avoid 64 bit to 32 bit shorten warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c: Unused RBignum internal accessing macros removed.akr2013-06-081-9/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (limited_big_rand): The argument, limit, is changed toakr2013-06-081-27/+24
| | | | | | | | VALUE. Use rb_integer_pack and rb_integer_unpack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (make_seed_value): Fix the length given forakr2013-06-081-1/+1
| | | | | | | | rb_integer_unpack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_integer_unpack): Don't use rb_funcall if possible.akr2013-06-081-23/+22
| | | | | | | | | * random.c: Use uint32_t for elements of seed. (make_seed_value): Use rb_integer_unpack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_init): Add a cast to fix clang compile error:akr2013-06-081-1/+1
| | | | | | | | | | | random.c:410:32: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32] This cast doesn't cause a problem because len is not bigger than MT_MAX_STATE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_init): Use rb_integer_pack.akr2013-06-081-46/+21
| | | | | | | | (roomof): Removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h (INTEGER_PACK_FORCE_BIGNUM): New flag constant.akr2013-06-081-3/+5
| | | | | | | | | | | * bignum.c (rb_integer_unpack): Support INTEGER_PACK_FORCE_BIGNUM. * random.c (int_pair_to_real_inclusive): Use INTEGER_PACK_FORCE_BIGNUM to use rb_big_mul instead of rb_funcall. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (int_pair_to_real_inclusive): Use rb_funcall instead ofakr2013-06-081-1/+1
| | | | | | | | rb_big_mul because rb_integer_unpack can return a Fixnum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (int_pair_to_real_inclusive): Use rb_integer_pack.akr2013-06-081-15/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (int_pair_to_real_inclusive): Use rb_integer_unpack.akr2013-06-081-22/+19
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_load): Use rb_integer_pack.akr2013-06-071-44/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (numberof): Removed.akr2013-06-071-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c: include internal.h.akr2013-06-071-17/+4
| | | | | | | | (mt_state): Use rb_integer_unpack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (int_pair_to_real_inclusive): Add a cast to BDIGIT.akr2013-06-051-41/+31
| | | | | | | | | (random_load): Fix shift width for fixnums. Re-implement bignum extraction without ifdefs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c: support RGENGC. [ruby-trunk - Feature #8339]ko12013-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See this ticet about RGENGC. * gc.c: Add several flags: * RGENGC_DEBUG: if >0, then prints debug information. * RGENGC_CHECK_MODE: if >0, add assertions. * RGENGC_PROFILE: if >0, add profiling features. check GC.stat and GC::Profiler. * include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0). * array.c: add write barriers for T_ARRAY and generate sunny objects. * include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if you want to access raw pointers. If you modify the contents which pointer pointed, then you need to care write barrier. * bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects. * complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX and generate sunny objects. * rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write barriers for T_RATIONAL and generate sunny objects. * internal.h: add write barriers for RBasic::klass. * numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects. * object.c (rb_class_allocate_instance), range.c: generate sunny T_OBJECT objects. * string.c: add write barriers for T_STRING and generate sunny objects. * variable.c: add write barriers for ivars. * vm_insnhelper.c (vm_setivar): ditto. * include/ruby/ruby.h, debug.c: use two flags FL_WB_PROTECTED and FL_OLDGEN. * node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED): move flag bits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e