Граф коммитов

1354 Коммитов

Автор SHA1 Сообщение Дата
nobu 13a935b0ba Drop support for BeOS
* beos: Drop support for BeOS now that Haiku is stable.
  [Fix GH-1112]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24 00:17:11 +00:00
nobu e29c109d2a Haiku now best effort support
* configure.in: remove obsolete workarounds for Haiku.
* dln.c, file.c, io.c: remove obsolete Haiku workarounds.
* thread_pthread.c: add stack bounds detection for Haiku.
* signal.c: get stack pointer from signal context on Haiku.
  [ruby-core:67923] [Bug #10811] [Fix GH-1109]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 03:54:42 +00:00
naruse f1df08e76d * time.c (rb_timespec_now): added.
* time.c (rb_time_timespec_new): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-10 02:59:47 +00:00
ko1 92861a1163 * include/ruby/ruby.h (RSTRUCT_PTR): need a close parenthese.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-06 18:35:29 +00:00
ngoto fcf63d1e54 * include/ruby/ruby.h (rb_array_const_ptr, rb_struct_const_ptr):
Suppress pointer type mismatch warnings occurred with old version
  of Fujitsu C Compiler (fcc) on Solaris 10. The warnings cause
  failure of TestMkmf::TestConvertible. [Bug #11644] [ruby-dev:49326]
* include/ruby/ruby.h (FIX_CONST_VALUE_PTR): macro for the above,
  only effective with fcc.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-06 09:19:14 +00:00
normal 2f418fb363 include/ruby/ruby.h (struct RObject): hide iv_index_tbl type
This is an implementation detail and should not be exposed to
C extension users.  We may change this to id_table soon; and
id_table should not be exposed as a public API.

It is highly unlikely any existing C extensions require this;
so the risk of breakage is very low.  Ideally, all of RObject
could be hidden.

[ruby-core:71306] [Feature #11647]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-03 21:16:48 +00:00
ko1 ffa87b4057 * gc.c: introduce rb_wb_unprotected_newobj_of() and
rb_wb_protected_newobj_of(), pass the WB_PROTECTED
  information explicitly.

* internal.h: use introduced functions by NEWOBJ_OF().
  `flag' is immediate value, so that C compilers can
  solve them at compile time.

* include/ruby/ruby.h: add a commnent about that.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29 07:26:44 +00:00
nobu 96003bc9ac missing.h: fix condition
* include/ruby/missing.h (bytesequence4_or_float): define by
  configured result.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-20 07:15:16 +00:00
nobu 603cdc2710 check INFINITY and NAN without C99 option
* configure.in: check INFINITY and NAN without an option for C99
  so that rb_infinity and rb_nan are respectively available
  regardless that option if they may be used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-19 16:29:31 +00:00
nobu 4eba615a0b disable warnings unless optimized
* include/ruby/ruby.h (rb_data_object_{wrap,get}): move
  declarations inside ifdef too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 10:21:35 +00:00
nobu 6094ac4ce8 disable warnings unless optimized
* include/ruby/ruby.h (rb_data_object_{wrap,get,make}): warn only
  if optimized, as __builtin_choose_expr() does not work fine
  unless optimized.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 05:53:26 +00:00
kosaki 0bdf13a104 * include/ruby/backward/util.h: Good-by Borland-C.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 05:41:34 +00:00
kosaki 3a48e12607 * numeric.c: Good-by Borland-C.
* include/ruby/backward/rubyio.h: ditto.
* include/ruby/backward/st.h: ditto.
* include/ruby/backward/util.h: ditto.
* include/ruby/backward/rubysig.h: ditto.
* include/ruby/backward/classext.h: ditto.
* dln.c: ditto.
* gc.c: ditto.
* win32/resource.rb: ditto.
* win32/dir.h: ditto.
* ext/tk/tcltklib.c: ditto.
* NEWS: announce that Borland-C is no longer supported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 02:10:34 +00:00
kosaki 4ad2057f27 * ChangeLog: Good-bye OS/2.
* common.mk: ditto.
* configure.in: ditto.
* dln_find.c: ditto.
* ext/Setup.emx: ditto.
* ext/extmk.rb: ditto.
* ext/socket/extconf.rb: ditto.
* ext/zlib/extconf.rb: ditto.
* file.c: ditto.
* include/ruby/defines.h: ditto.
* io.c: ditto.
* lib/mkmf.rb: ditto.
* missing/os2.c: ditto.
* process.c: ditto.
* ruby.c: ditto.
* NEWS: announce OS/2 is no longer supported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 01:18:34 +00:00
kosaki 6803c4e2a8 * include/ruby/defines.h (DOSISH): add comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 01:17:50 +00:00
nobu d250a33062 ruby.h: RB_OBJ_FROZEN_RAW
* include/ruby/ruby.h (RB_OBJ_FROZEN_RAW): split from
  RB_OBJ_FROZEN.  valid only for non-special-const objects.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-07 12:40:34 +00:00
nobu 334710c155 ruby.h: inlines
* include/ruby/ruby.h: turn function macros into inline functions,
  for debuggers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06 04:56:16 +00:00
nobu fd89a96837 ruby.h: enums
* include/ruby/ruby.h: turn constant macros into enums, for
  debuggers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06 04:54:10 +00:00
nobu 077e2037eb ruby.h: RUBY_FL_PROMOTED
* include/ruby/ruby.h (ruby_fl_type): revive RUBY_FL_PROMOTED for
  .gdbinit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-16 08:15:58 +00:00
nobu 1e3a1bbb66 ruby.h: add prefix
* include/ruby/ruby.h: prefix RUBY or RB to global symbols to get
  rid of name conflicts with other headers.
* include/ruby/encoding.h, include/ruby/intern.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-13 02:03:31 +00:00
nobu f150a381db win32.c: more fcntl
* win32/win32.c (fcntl): implement F_GETFD, F_SETFD, and
  F_DUPFD_CLOEXEC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-12 05:23:22 +00:00
nobu 5e57dc0fae ruby.h: eval ASSUME argument
* include/ruby/ruby.h (ASSUME): evaluate the argument just once
  everywhere.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-05 23:14:18 +00:00
nobu 141ff8e6a0 win32.h: fix macro name
* include/ruby/win32.h: fix macro name for VC runtime version,
  RT_VER is only in Makefile.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-04 14:26:24 +00:00
nobu 8b9ad9d6f0 oniguruma.h: constify
* include/ruby/oniguruma.h (OnigEncodingTypeST): constify
  property_name_to_ctype arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-27 19:49:45 +00:00
nobu 2e5c105ff2 win32.c: symlink
* win32/win32.c (w32_symlink): implement symlink().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-24 21:34:45 +00:00
ko1 3af5298e8c * include/ruby/ruby.h, cont.c, vm_trace.c: add a new event
fiber_switch. We need more discussion about this feature
  so that I don't write it on NEWS.
  [Feature #11348]
* test/ruby/test_settracefunc.rb: add tests.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-21 09:51:01 +00:00
nobu 0eca22904b ruby.h: define RClass only in C
* include/ruby/ruby.h (RClass): define only in C, `__attribute__`
  between `struct` and the name can't compile with g++.
  [ruby-core:70297] [Bug #11426]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-18 07:16:24 +00:00
nobu 49389fe59d ruby.h: adjust for g++
* include/ruby/ruby.h (RClass): move `__attribute__` after the
  keyword `struct` for g++.  [ruby-core:70297] [Bug #11426]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-18 02:40:55 +00:00
nobu df62ca9cae defines.h: tweaks of function alias macros
* include/ruby/defines.h (RUBY_ALIAS_FUNCTION_TYPE): cast the
  result to suppress warnings.

* include/ruby/defines.h (RUBY_ALIAS_FUNCTION_VOID): minimize if
  possible.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-13 04:41:51 +00:00
nobu 471e3a3016 ruby.h: check integer overflow
* include/ruby/ruby.h (ALLOCV_N): check integer overflow, as well
  as ruby_xmalloc2.  pointed out by Paul <pawlkt AT gmail.com>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-11 06:22:34 +00:00
nobu 1f22556040 internal.h: moved RClass
* internal.h (struct RClass): moved from ruby/ruby.h to hide the
  internals.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-28 01:32:15 +00:00
nobu 21dbe868f8 string.c: taint flags
* include/ruby/ruby.h: add raw FL macros, which assume always the
  argument object is not a special constant.
* internal.h (STR_EMBED_P, STR_SHARED_P): valid only for T_STRING.
* string.c: deal with taint flags directly across String instances.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-23 01:25:49 +00:00
nobu 4c4d0389f5 ruby.h: ASSUME
* include/ruby/ruby.h (ASSUME): hint for optimization, the
  expression is assumed to be true always.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-22 11:27:46 +00:00
nobu 42e36319bd ruby/missing.h: M_PI fallback definition
* include/ruby/missing.h (M_PI, M_PI_2): fallback definitions for
  VC6.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21 10:51:40 +00:00
nobu 6f869a57fe ruby/win32.h: include windows.h
* include/ruby/win32.h: include windows.h before winsock2.h,
  because mswsock.h included by the former uses SOCKET defined
  after it in the latter.  fix a build failure with VC6.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21 10:51:14 +00:00
nobu 137d08de4b encoding.h: ENC_CODERANGE_CLEAN_P
* include/ruby/encoding.h (ENC_CODERANGE_CLEAN_P): predicate that
  tells if the coderange is clean, that is 7bit or valid, and no
  needs to scrub.
* re.c (rb_reg_expr_str): use ENC_CODERANGE_CLEAN_P.
* string.c (enc_strlen, rb_enc_cr_str_buf_cat, rb_str_scrub):
  ditto.
* string.c (rb_str_enumerate_chars): ditto, and suppress a warning
  by gcc6.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-17 06:39:29 +00:00
normal 6dda4f17a9 socket: memoize common socket families in fptr->mode
This provides a minor speedup by avoiding an extra syscall

	require 'socket'
	require 'benchmark'
	nr = 100000
	msg = 'hello world'
	buf = ''
	size = msg.bytesize
	puts(Benchmark.measure do
	  UNIXSocket.pair(:SEQPACKET) do |a, b|
	    nr.times do
	      a.sendmsg_nonblock(msg, 0, exception: false)
	      b.recv(size, 0, buf)
	    end
	  end
	end)

             user     system      total        real
before:  0.330000   0.340000   0.670000 (  0.678235)
 after:  0.290000   0.240000   0.530000 (  0.534527)

* ext/socket/rubysocket.h: flags for common socket families
  (rsock_getfamily): update signature
* include/ruby/io.h: comment socket FMODE flags
* ext/socket/init.c (rsock_getfamily): memoize family
* ext/socket/basicsocket.c: adjust rsock_getfamily calls
* ext/socket/ancdata.c: ditto
  [ruby-core:69713] [Feature #11298]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02 01:58:14 +00:00
normal c31b0def42 st.c: use ccan linked-list (try 3)
This improves the bm_vm2_bighash benchmark significantly by
removing branches during insert, but slows down anything
requiring iteration with the more complex loop termination
checking.

Speedup ratio of 1.10 - 1.20 is typical for the vm2_bighash
benchmark.

v3 - st_head calculates list_head address in two steps
     to avoid a bug in old gcc 4.4 (Debian 4.4.7-2)
     bug which incorrectly warned with:
     warning: dereferencing pointer ‘({anonymous})’ does break
     strict-aliasing rules

* include/ruby/st.h (struct st_table): hide struct list_head
* st.c (struct st_table_entry): adjust struct
  (head, tail): remove shortcut macros
  (st_head): new wrapper function
  (st_init_table_with_size): adjust to new struct and API
  (st_clear): ditto
  (add_direct): ditto
  (unpack_entries): ditto
  (rehash): ditto
  (st_copy): ditto
  (remove_entry): ditto
  (st_shift): ditto
  (st_foreach_check): ditto
  (st_foreach): ditto
  (get_keys): ditto
  (get_values): ditto
  (st_values_check): ditto
  (st_reverse_foreach_check): ditto (unused)
  (st_reverse_foreach): ditto (unused)
  [ruby-core:69726] [Misc #10278]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-29 18:10:00 +00:00
normal b8d544832b Revert "st.c: use ccan linked-list (try 2)"
This reverts commit r51044
Still getting failure notices from ko1's CI machine.
ref: g3qkqn

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-26 22:52:26 +00:00
normal d3725a86de st.c: use ccan linked-list (try 2)
This improves the bm_vm2_bighash benchmark significantly by
removing branches during insert, but slows down anything
requiring iteration with the more complex loop termination
checking.

Speedup ratio of 1.10 - 1.20 is typical for the vm2_bighash
benchmark.

* include/ruby/st.h (struct st_table): hide struct list_head
* st.c (struct st_table_entry): adjust struct
  (head, tail): remove shortcut macros
  (st_head): new wrapper function
  (st_init_table_with_size): adjust to new struct and API
  (st_clear): ditto
  (add_direct): ditto
  (unpack_entries): ditto
  (rehash): ditto
  (st_copy): ditto
  (remove_entry): ditto
  (st_shift): ditto
  (st_foreach_check): ditto
  (st_foreach): ditto
  (get_keys): ditto
  (get_values): ditto
  (st_values_check): ditto
  (st_reverse_foreach_check): ditto (unused)
  (st_reverse_foreach): ditto (unused)
  [ruby-core:69726] [Misc #10278]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-26 22:32:06 +00:00
normal cc5547a4ad Revert r51034 "st.c: use ccan linked-list"
Maybe this will stop mysterious CI failures from ko1@sasada-8core:

リビジョン 51034 です。
make[1]: ディレクトリ `/mnt/sdb1/ruby/build' に入ります
../trunk/revision.h unchanged
make[1]: ディレクトリ `/mnt/sdb1/ruby/build' から出ます
make[1]: ディレクトリ `/mnt/sdb1/ruby/build' に入ります
config.guess already exists
config.sub already exists
generating ../trunk/ext/ripper/ripper.c
make[2]: ディレクトリ `/mnt/sdb1/ruby/trunk/ext/ripper' に入ります
extracting ripper.y from ../../parse.y
id.h not found in ["../.."]
make[2]: *** [ripper.y] エラー 1
make[2]: ディレクトリ `/mnt/sdb1/ruby/trunk/ext/ripper' から出ます
make[1]: *** [../trunk/ext/ripper/ripper.c] エラー 2
make[1]: ディレクトリ `/mnt/sdb1/ruby/build' から出ます
make: [up] エラー 2 (無視されました)
make: *** [.rbconfig.time] セグメンテーション違反です
Command exited with non-zero status 2

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-25 19:56:20 +00:00
normal d8748874cc st.c: use ccan linked-list
This improves the bm_vm2_bighash benchmark significantly by
removing branches during insert, but slows down anything
requiring iteration with the more complex loop termination
checking.

Speedup ratio of 1.10 - 1.20 is typical for the vm2_bighash
benchmark.

* include/ruby/st.h (struct st_table): hide struct list_head
* st.c (struct st_table_entry): adjust struct
  (head, tail): remove shortcut macros
  (st_head): new wrapper function
  (st_init_table_with_size): adjust to new struct and API
  (st_clear): ditto
  (add_direct): ditto
  (unpack_entries): ditto
  (rehash): ditto
  (st_copy): ditto
  (remove_entry): ditto
  (st_shift): ditto
  (st_foreach_check): ditto
  (st_foreach): ditto
  (get_keys): ditto
  (get_values): ditto
  (st_values_check): ditto
  (st_reverse_foreach_check): ditto (unused)
  (st_reverse_foreach): ditto (unused)
  [ruby-core:69726] [Misc #10278]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-25 19:01:25 +00:00
nobu ca87ac691b intern.h: rb_strlen_lit
* include/ruby/intern.h (rb_strlen_lit): new macro to get the
  length of a string literal, borrowed from mruby/mruby@e4afd53.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-24 03:47:10 +00:00
nobu a9b06707d9 $SAFE=2 is now obsolete
* include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): fix safe_level
  limit.

* vm_core.h (rb_proc_t): update comment for safe_level.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-18 14:33:12 +00:00
hsbt 5d6ca9e950 * include/ruby/ruby.h: $SAFE=2 is now obsolete.
* dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c
  gc.c, io.c, process.c, safe.c, signal.c, win32/file.c:
  removed code for $SAFE=2
* test/erb/test_erb.rb, test/fiddle/test_handle.rb
  test/ruby/test_env.rb: removed tests for $SAFE=2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-18 14:21:03 +00:00
hsbt bbf440c90b * include/ruby/ruby.h: $SAFE=3 is now obsolete.
* ext/socket/init.c, ext/socket/socket.c, ext/socket/tcpsocket.c
  ext/socket/udpsocket.c, gc.c, object.c, re.c, safe.c: removed code
  for $SAFE=3
* bootstraptest/test_method.rb, test/erb/test_erb.rb, test/ruby/test_dir.rb
  test/ruby/test_file.rb, test/ruby/test_method.rb, test/ruby/test_regexp.rb
  test/ruby/test_thread.rb: remove tests for $SAFE=3

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-17 05:29:51 +00:00
usa 2bc2802096 * file.c (File::SHARE_DELETE): new flag to be able to delete opened file
on Windows.

* include/win32/win32.c (O_SHARE_DELETE): new pseudo file mode flag.

* win32/win32.c (rb_w32_{w,}open): support above flag.  [EXPERIMENTAL]

* NEWS: mention about this feature.
  [Feature #11218] [ruby-dev:49022]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-12 12:14:06 +00:00
hsbt 0eb195cee3 * ext/win32ole/win32ole.c: fix a typo. Patch by @davydovanton
[fix GH-923]
* include/ruby/st.h: ditto.
* include/ruby/util.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-04 02:53:11 +00:00
normal f6cd582505 variable.c: avoid compatibility table with generic ivars
This recovers and improves performance of Marshal.dump/load on
Time objects compared to when we implemented generic ivars
entirely using st_table.

This also recovers some performance on other generic ivar objects,
but does not bring bring Marshal.dump/load performance up to
previous speeds.

benchmark results:
minimum results in each 10 measurements.
Execution time (sec)
		name    trunk   geniv   after
marshal_dump_flo        0.343   0.334   0.335
marshal_dump_load_geniv 0.487   0.527   0.495
marshal_dump_load_time  1.262   1.401   1.257

Speedup ratio: compare with the result of `trunk' (greater is better)
		name    geniv   after
marshal_dump_flo        1.026   1.023
marshal_dump_load_geniv 0.925   0.985
marshal_dump_load_time  0.901   1.004

* include/ruby/intern.h (rb_generic_ivar_table): deprecate
* internal.h (rb_attr_delete): declare
* marshal.c (has_ivars): use rb_ivar_foreach
  (w_ivar): ditto
  (w_object): update for new interface
* time.c (time_mload): use rb_attr_delete
* variable.c (generic_ivar_delete): implement
  (rb_ivar_delete): ditto
  (rb_attr_delete): ditto
  [ruby-core:69323] [Feature #11170]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-30 00:20:15 +00:00
kazu d5a93ed109 fix condition
* include/ruby/defines.h (RUBY_ATTR_ALLOC_SIZE): fix condition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-26 12:37:42 +00:00
nobu 3a08b7e204 intern.h: move rb_sym_all_symbols
* include/ruby/intern.h (rb_sym_count): move `rb_sym_all_symbols`
  to a symbol.c specific section.  a part of patch by Lourens
  Naudé.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-22 12:13:14 +00:00
nobu fdb957925f ruby.h: warn old names
* include/ruby/ruby.h (rb_data_typed_object_alloc),
  (rb_data_object_alloc): warn use of old names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-20 05:09:00 +00:00
nobu 68426106a9 ruby.h: DEPRECATED_BY
* include/ruby/ruby.h (DEPRECATED_BY): fallback definition without
  additional messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-20 04:21:08 +00:00
nobu 1443776cc9 ruby.h: add old names
* include/ruby/ruby.h (rb_data_typed_object_alloc),
  (rb_data_object_alloc): add old names for source level backward
  compatibilities.
* gc.c (rb_data_object_alloc, rb_data_typed_object_alloc): add
  aliases for binary level backward compatibilities.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-19 02:18:49 +00:00
nobu 11c8b83ab6 ruby.h: cast for C++
* include/ruby/ruby.h (Data_Make_Struct0): needs function pointer
  casts to fix function overloading in C++.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-19 00:54:46 +00:00
nobu 356baf95db ruby.h: cast for C++
* include/ruby/ruby.h (Data_Make_Struct0, TypedData_Make_Struct0):
  explicit cast from void* is necessary as implicit cast is
  disallowed in C++.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-19 00:43:58 +00:00
nobu c4d216793b intern.h: rb_f_notimplement for ext on Windows
* include/ruby/intern.h (rb_f_notimplement): should not respond to
  not-implemented methods.  as the address inside a DLL and the
  imported address are different on Windows, use an exported
  variable to share the same address.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-18 06:31:42 +00:00
nobu ecbad6dfa8 gc.c: rename alloc as wrap
* gc.c (rb_data_object_wrap, rb_data_typed_object_wrap): rename
  alloc as wrap.  these functions do not allocate data pointers
  but just wrap the given pointers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-16 12:17:14 +00:00
nobu 3f29f5205c ruby.h: suppress warnings
* include/ruby/ruby.h (Data_Make_Struct, TypedData_Make_Struct):
  make statement-expression to get rid of strict-aliasing warnings
  by old GCC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-11 00:41:11 +00:00
nobu 482bf1959a ruby.h: fix possible memory leak
* include/ruby/ruby.h (Data_Make_Struct, TypedData_Make_Struct):
  allocate wrapper data object before allocating DATA_PTR to get
  rid of possible memory leak when the former failed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-10 15:20:35 +00:00
usa c15a74f3d0 * win32/win32.c (rb_w32_{getc,putc}): removed. they are needed for old
ruby (before 1.8), but not now.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-24 01:44:12 +00:00
naruse 7bf5ba1b49 * win32/win32.c: remove bcc related code.
* include/ruby/win32.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-23 23:41:16 +00:00
nobu a4d2997263 intern.h: stale declarations
* include/ruby/intern.h: remove stale declarations, which were
  removed because of ripper.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-07 02:44:00 +00:00
nobu c57932f782 win32.c: readlink
* win32/win32.c (wreadlink, rb_w32_ureadlink): implement readlink().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-23 08:36:04 +00:00
nobu f5b96e594c win32.c: w32_lstati64
* win32/win32.c (winnt_stat): stat with following symbolic links.
* win32/win32.c (winnt_lstat): rename old winnt_stat, which does
  not follow symbolic links.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-23 05:40:48 +00:00
nobu 5155a402ab win32.c: S_IFLNK
* win32/win32.c (fileattr_to_unixmode): set symlink for reparse
  points.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-19 02:38:02 +00:00
ko1 0db407836b * include/ruby/ruby.h: use rb_gc_writebrrier() simply.
For incremental GC, we need to get a pointer to the objspace.
  We can share this pointer for the following WB process.
  And considering icache hit ratio, prcess in the GC.
* gc.c (rb_gc_writebarrier): added.
* gc.c (gc_writebarrier_generational, gc_writebarrier_incremental):
  make them NOINLINE because inlining them into rb_gc_writebarrier()
  makes a prologue code of rb_gc_writebarrier() longer (storing callee
  save registers).
  This patch improve the performance of WB on micro-benchmarks.
  name                   ruby 2.1   trunk   modified
  vm1_gc_wb_ary*            0.511   0.632      0.532
  vm1_gc_wb_ary_promoted*   0.578   0.701      0.674
  vm1_gc_wb_obj*            0.419   0.575      0.492
  vm1_gc_wb_obj_promoted*   0.537   0.664      0.618
                                                 (sec)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-17 10:26:39 +00:00
nobu c7988fd29d ruby.h: suppress false warnings
* 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
2015-03-16 07:49:27 +00:00
ko1 0952b43b9b * include/ruby/ruby.h: introduce new type T_IMEMO.
T_IMEMO is Internal Memo type, internal use only.
  T_IMEMO has same purpose of NODE_MEMO.
  To insert T_IMEMO, type numbers are modified a little.
* internal.h: define struct RIMemo. Each RIMemo objects
  has imemo_type. We can observe it by the imemo_type() function.
* gc.c (rb_imemo_new): added.
* node.h: remove NODE_CREF and NEW_CREF().
* node.c (rb_gc_mark_node): ditto.
* vm.c (vm_cref_new): use rb_imem_new().
* vm_eval.c: ditto.
* vm_eval.c (eval_string_with_cref):
* vm_eval.c (rb_type_str):
* vm_insnhelper.c: use RIMemo objects for CREF.
* ext/objspace/objspace.c: support T_IMEMO.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11 10:36:17 +00:00
ko1 8f88ff4e37 * internal.h: remove struct method_table_wrapper.
struct method_table_wrapper was introduced to avoid duplicate marking
  for method tables.
  For example, `module M1; def foo; end; end` make one method table
  (mtbl) contains a method `foo`. M1 (T_MODULE) points mtbl.
  Classes C1 and C2 includes M1, then two T_ICLASS objects are created
  and they points mtbl too. In this case, three objects (one T_MODULE
  and two T_ICLASS objects) points same mtbl. On marking phase, these
  three objects mark same mtbl. To avoid such duplication, struct
  method_table_wrapper was introduced.
  However, created two T_ICLASS objects have same or shorter lifetime
  than M1 (T_MODULE) object. So that we only need to mark mtbl from M1,
  not from T_ICLASS objects. This patch tries marking only from M1.
  Note that one `Module#prepend` call creates two T_ICLASS objects.
  One for refering to a prepending Module object, same as
  `Module#include`. We don't nedd to care this T_ICLASS.
  One for moving original mtbl from a prepending class. We need to
  mark such mtbl from this T_ICLASS object. To mark the mtbl,
  we need to use `RCLASS_ORIGIN(klass)` on marking from a prepended
  class `klass`.
* class.c: ditto.
* eval.c (rb_using_refinement): ditto.
* gc.c: ditto.
* include/ruby/ruby.h: define m_tbl directly. The definition of
  struct RClass should be moved to (srcdir)/internal.h.
* method.h: remove decl of rb_free_m_tbl_wrapper().
* object.c: use RCLASS_M_TBL() directly.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-05 22:20:14 +00:00
nobu e396ba84fb intern.h: rb_str_new_literal
* include/ruby/intern.h (rb_str_new_literal): define on all
  platforms, not only gcc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-03 10:52:14 +00:00
nobu 903655ac70 ruby/version.h: bump API version
* include/ruby/version.h: bump API version too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-29 11:16:17 +00:00
nobu 01195a202c ruby.h: parent in rb_data_type_t
* ruby.h (rb_data_type_t): revert r48647 and revise parent member.
  [ruby-core:66969] [Bug #10621]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-24 03:16:31 +00:00
nobu 0618ea7590 ruby.h: get rid of C++ warnings
* include/ruby/ruby.h (PRIsVALUE): put a space after string
  literals not to be confused with C++11 string literal suffix.
  https://github.com/ruby/ruby/commit/a9f3eb7#commitcomment-9040169

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-19 11:00:22 +00:00
ko1 1b6aa03eb9 * class.c (class_alloc): Strat from age == 2.
Class and Module objects can be living long life.
* iseq.c: Same for ISeq objects.
* gc.c (RVALUE_AGE_RESET): added.
* gc.c (newobj_of): allow to generate (age != 0) objects.
* gc.c (rb_copy_wb_protected_attribute): reset age for wb unprotected
  objects.
* include/ruby/ruby.h: add RUBY_TYPED_PROMOTED1 as an unrecommended
  flag.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-11 10:15:30 +00:00
nobu aaed10716a intern.h: SIZED_ENUMERATOR
* include/ruby/intern.h (SIZED_ENUMERATOR): separate from
  RETURN_SIZED_ENUMERATOR.

* string.c (rb_str_enumerate_chars): get rid of calling
  rb_block_given_p() twice.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-03 03:25:12 +00:00
nobu c95b3a16bd ruby.h: no warnings of hidden objects
* include/ruby/ruby.h (rb_data_object_alloc_warning): no warnings
  of internal hidden objects which klass == 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-03 03:25:06 +00:00
nobu 012c558127 re.c: rb_reg_region_copy
* re.c (rb_reg_region_copy): new function to try with GC if copy
  failed and return the error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 21:30:58 +00:00
nobu 544d28c300 ruby.h: no parent in rb_data_type_t
* error.c (rb_typeddata_is_kind_of, rb_check_typeddata): ditto.
* error.c (rb_typeddata_inherited_p): deprecate. still keep for
  potential binary compatibility.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-29 07:14:53 +00:00
nobu c262acb4e0 ruby.h: export keyword argument functions
* include/ruby/ruby.h (rb_get_kwargs, rb_extract_keywords): export
  keyword argument functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-26 13:28:15 +00:00
akr 8463a90871 * include/ruby/io.h (FMODE_WSPLIT): Removed. The write() system call
is not required to split.  It was useful to avoid whole process
  blocking in Ruby 1.8 but not useful since write() is invoked without
  GVL.
  (FMODE_WSPLIT_INITIALIZED): Ditto.

* io.c (wsplit_p): Removed.
  (io_writable_length): Removed.
  (rb_fcntl): Don't update the removed flags.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18 09:10:59 +00:00
nobu de870875f7 vm_eval.c: rb_current_receiver
* vm_eval.c (rb_current_receiver): new function to return the
  receiver in the current control frame.  [Feature #10195]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-16 10:38:15 +00:00
usa fd9f6bde95 * win32/win32.c, include/win32/win32.h (rb_w32_set_nonblock): new
function to support nonblock-mode of pipes.

* win32/win32.c (rb_w32_read): nonblock-mode pipe returns ERROR_NO_DATA
  if there is no data, but also returns it if remote-end is closed.

* win32/win32.c (rb_w32_write): if cannot to write any data, it may be
  blocking.

* io.c (rb_io_set_nonblock): use rb_w32_set_nonblock for Windows.

* ext/io/nonblock/nonblock.c (rb_io_nonblock_set): use ruby's API when
  setting nonblock-mode.

* test/ruby/test_io.rb: test nonblock pipes on Windows.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-10 10:42:19 +00:00
nobu 4b8cb23a36 intern.h: deprecate disable and enable super
* include/ruby/intern.h (rb_disable_super, rb_enable_super): warn
  as deprecated at build time, instead of ignoring silently or
  warning at runtime only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-05 08:20:31 +00:00
nobu 9bc469b950 intern.h: deprecate rb_clear_cache
* include/ruby/intern.h (rb_clear_cache): mark as deprecated, not
  only warnings at runtime.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-05 07:27:02 +00:00
nobu a9f3eb75de ruby.h: add mark to PRIsVALUE
* include/ruby/ruby.h (PRIsVALUE), vsnprintf.c (BSD_vfprintf): add
  RUBY_PRI_VALUE_MARK to reduce danger of accidental conflict with
  plain "%i".  binary incompatible with extension libraries using
  PRIsVALUE and built for 2.1 and earlier.  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-04 03:51:33 +00:00
nobu 44d2958e3b ruby.h: optimize NUM2CHR
* include/ruby/ruby.h (rb_num2char_inline): use RB_TYPE_P for
  optimization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-30 00:47:58 +00:00
akr 1efb3c31b7 * Avoid undefined behaviors found by gcc -fsanitize=undefined.
gcc (Debian 4.9.1-16) 4.9.1

* include/ruby/ruby.h (INT2FIX): Avoid undefined behavior.

* node.h (nd_set_line): Ditto.

* pack.c (encodes): Ditto.
  (pack_unpack): Ditto.

* regint.h (BIT_STATUS_AT): Ditto.
  (BS_BIT): Ditto.

* time.c (time_mdump): Ditto.
  (time_mload): Ditto.

* vm_core.h (VM_FRAME_MAGIC_MASK): Ditto.

* vm_trace.c (recalc_add_ruby_vm_event_flags): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-17 08:50:01 +00:00
yugui 57bc5eaf2f Fixes build failures on Portable Native Client.
Note: Some of the fixes are for newlib in general but not NaCl-specific.

* include/ruby/intern.h (rb_fd_select): declare struct timeval, or the
  struct gets local to the function in C99.

* file.c (#include): add nacl/stat.h for PNaCl.
  (utimes): added a declaration for PNaCl.
  (stat_atimespec): stat::st_atimensec is long long but
  timespec::tv_nsec is long in PNaCl.
  (stat_mtimespec, stat_ctimespec): ditto.
  (rb_group_member): disable getgroups unless HAVE_GETGROUPS.
  (eaccess): unify the fallback to generic defined(USE_GETEUID).

* io.c: include sys/time.h for struct timeval.
  (rb_close_before_exec): nothing we can do if F_GETFD is not
  available.
  (ioctl): pnacl newlib actually doesn't have ioctl.

* process.c (maxgroups): it is used iff
   defined(_SC_NGROUPS_MAX) || defined(NGROUPS_MAX) but not
   defined(HAVE_GETGROUPS) || defined(HAVE_SETGROUPS).
  (obj2gid): fail unless the object is a Fixnum if getgrnam is not
  available.
  (disable_child_handler_fork_child): sigaction is not available in
  PNaCl newlib.

* configure.in (warnflags, strict_warnflags): avoid -ansi for strlcpy.
  (rb_cv_gcc_atomic_builtins): also check
  __atomic_or_etch because it is used in ruby_atomic.h.
  (rb_cv_gcc_sync_builtins): ditto.
  (HAVE_GETGRNAM): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 13:33:14 +00:00
nobu 97d3b04c9b ruby/ruby.h: fix for older gcc
* configure.in (__builtin_choose_expr_constant_p): in gcc 4.8 or
  earlier, __builtin_choose_expr() does not consider
  __builtin_constant_p(variable) a constant expression.

* include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): fix for older gcc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-10 14:20:20 +00:00
nobu 50b78ebb98 ruby/ruby.h: eliminate disabled function call
* include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): eliminate function
  call for warning/error if not match to get rid of unconditional
  warning/error by a certain compiler option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-10 12:45:21 +00:00
nobu b44c47d102 io.c: move RFile initialization
* io.c (rb_io_make_open_file): move from include/ruby/io.h, and
  hide too detailed implementations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-10 02:34:24 +00:00
nobu 91e305bcda ruby/io.h: deprecate old macros
* include/ruby/io.h (rb_io_mode_flags, rb_io_modenum_flags):
  deprecate old macros for compatibility for ruby 1.8 and older.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-10 02:27:41 +00:00
normal 11f3526734 ruby.h: set rb_event_flag_t to uint32_t
This ensures a consistent implementation between 32 and 64-bit
platforms, as vm_trace.c limits events to 32-bits.  This can
also open up struct packing opportunities.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-01 21:13:30 +00:00
nobu c47b523246 ruby.h: warn untyped Data
* include/ruby/ruby.h (rb_data_object_alloc_warning): warn
  Data_Wrap_Struct and Data_Make_Struct only if
  RUBY_UNTYPED_DATA_WARNING is set to 1.

* include/ruby/ruby.h (rb_data_object_get_warning): ditto for
  Data_Get_Struct.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-28 15:27:24 +00:00
nobu bb10a21346 ruby.h: deprecate plain Data
* include/ruby/ruby.h (rb_data_object_alloc_deprecated): deprecate
  Data_Make_Struct and Data_Wrap_Struct.  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-27 01:28:47 +00:00
nobu eb0e3fe78f intern.h: rb_str_new_literal
* include/ruby/intern.h (rb_str_new_literal): make ruby string
  from literal C-string.  incorporated from mruby.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-19 05:53:05 +00:00
nobu abac848564 string.c: rb_str_new_static
* string.c (rb_str_new_static): create string object with static
  buffer.  incorporated from mruby.

* string.c (rb_{usascii,utf8,enc}_str_new_static): ditto with
  encodings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-19 05:53:00 +00:00
nobu 445086e56b class.c: do not freeze class of hidden object
* class.c (rb_freeze_singleton_class): get rid of freeze class of
  hidden object to fix segfaults.

* include/ruby/ruby.h (rb_obj_freeze_inline): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-19 02:40:58 +00:00
nobu 431dc5c8b5 ruby.h: err rb_check_safe_str explicitly
* include/ruby/ruby.h (rb_check_safe_str, Check_SafeStr): show
  error message to update for obsolete function and macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-19 02:01:15 +00:00
nobu 8b9afe6520 error.c: preserve encoding
* error.c (rb_error_frozen_object): preserve encoding of class
  name in error message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-19 01:46:42 +00:00
nobu d9a597408f class.c: do not freeze meta-meta-class
* class.c (rb_freeze_singleton_class): should not propagate to
  meta-meta-class, and so on, which is shared with the original
  class.  fix occational exceptions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-19 01:45:45 +00:00
nobu 1495c2f8e9 string.c: UTF-8 string function
* string.c (rb_utf8_str_new, rb_utf8_str_new_cstr): make UTF-8
  string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-18 14:51:08 +00:00
naruse d2a5354255 * reg*.c: Merge Onigmo 5.15.0 38a870960aa7370051a3544
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-15 16:18:41 +00:00
nobu 4df147d6e8 class.c: freeze meta class only
* class.c (singleton_class_of): should not propagete freezing to
  meta meta class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-13 13:03:46 +00:00
nobu 3889eaca02 ruby/ruby.h: freeze singleton class
* include/ruby/ruby.h (rb_obj_freeze_inline): propagate freezing
  to the singleton class if it is existing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-12 14:25:01 +00:00
nobu 94ee7c47cd ruby/ruby.h: move comments
* include/ruby/ruby.h (enum ruby_special_consts): move bit pattern
  comments side-by-side.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-12 07:44:10 +00:00
ko1 970d8cb613 * include/ruby/ruby.h, gc.c: add new internal events
RUBY_INTERNAL_EVENT_GC_ENTER and
  RUBY_INTERNAL_EVENT_GC_EXIT.
  When invoking GC process, GC_ENTER event is called.
  When exiting from GC process, GC_EXIT event is called.
  Incremental GC (incremental marking and lazy sweep) can call
  these events many times.
  For example (minor marking):
  (1) GC_ENTER
  - (2) GC_START (minor GC)
    (minor marking)
  - (3) GC_END_MARK
    (start lazy sweep)
  (4) GC_EXIT
    (ruby process)
  (5) GC_ENTER
    (lazy sweep)
  (6) GC_EXIT
    (ruby process)
    (... repeat (5), (6))
  (7) GC_ENTER
      (finish lazy sweep)
    - (8) GC_END_SWEEP
  (9) GC_EXIT
  2nd example (incremental major marking):
  (1) GC_ENTER
  - (2) GC_START (minor GC)
    (start incremental marking)
  (3) GC_EXIT
    (ruby process)
  (4) GC_ENTER
    (incremental marking)
  (5) GC_EXIT
     (ruby process)
     (... repeat (4), (5))
  (6) GC_ENTER
    (finish incremental marking)
  - (7) GC_END_MARK
    (start lazy sweep)
  (8) GC_EXIT
    (ruby process)
  (9) GC_ENTER
    (lazy sweep)
  (10) GC_EXIT
    (ruby process)
    (... repeat (9), (10))
  (11) GC_ENTER
    (finish lazy marking)
  - (12) GC_STOP_SWEEP
  (13) GC_EXIT
  Thease internal events enable to measure GC pause time completely.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11 08:46:59 +00:00
ko1 cc3088ea51 * include/ruby/ruby.h: freeze nil/true/false.
* gc.c (should_be_finalizable): check frozen after checkin FL_ABLE.
* object.c (rb_obj_taint): check
  OBJ_TAINTABLE(obj).
* object.c (rb_obj_freeze): remove immediate_frozen_tbl
   because all of immediate values are frozen. YAY!
* object.c (rb_obj_frozen_p): ditto.
* test/ruby/test_eval.rb: skip instance_variable_set for
  frozen objects.
* test/ruby/test_weakmap.rb: check ArgumentError instead of
  RuntimeError.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11 05:37:32 +00:00
normal b3a4367ce4 rb_call_info_t: shrink to 96 bytes from 104 bytes on 64-bit
This keeps ci->flag and ci->aux.index consistent across 32-bit
and 64-bit platforms.

ci->flag: VM_CALL_* flags only use 9 bits, currently
ci->aux.index: 2 billion ivars per class should be enough for anybody

This saves around 50K allocations on "valgrind ruby -e exit" on x86-64
before:
  total heap usage: 48,122 allocs, 19,253 frees, 8,099,197 bytes allocated
after:
  total heap usage: 48,069 allocs, 19,214 frees, 8,047,266 bytes allocated

* vm_core.h (rb_call_info_t): ci->flag becomes 32-bit unsigned int
  ci->index becomes a 32-bit signed int (from signed long).
  Reorder for better packing on 64-bit, giving an 8 byte reduction
  from 104 to 96 bytes for each ci.

* compile.c (new_callinfo, setup_args, iseq_compile_each,
  iseq_build_from_ary_body): adjust for type changes

* vm_insnhelper.c (vm_getivar): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 06:32:44 +00:00
ko1 123eeb1c1a * gc.c: add incremental GC algorithm. [Feature #10137]
Please refer this ticket for details.
  This change also introduces the following changes.
  * Remove RGENGC_AGE2_PROMOTION and introduce object age (0 to 3).
    Age can be count with FL_PROMOTE0 and FL_PROMOTE1 flags in
    RBasic::flags (2 bit). Age == 3 objects become old objects.
  * WB_PROTECTED flag in RBasic to WB_UNPROTECTED bitmap.
  * LONG_LIVED bitmap to represent living objects while minor GCs
    It specifies (1) Old objects and (2) remembered shady objects.
  * Introduce rb_objspace_t::marked_objects which counts marked
    objects in current marking phase. marking count is needed to
    introduce incremental marking.
  * rename mark related function and sweep related function to
    gc_(marks|sweep)_(start|finish|step|rest|continue).
  * rename rgengc_report() to gc_report().
  * Add obj_info() function to get cstr of object details.
  * Add MEASURE_LINE() macro to measure execution time of specific line.
  * and many small fixes.
* include/ruby/ruby.h: add flag USE_RINCGC.
  Now USE_RINCGC can be set only with USE_RGENGC.
* include/ruby/ruby.h: introduce FL_PROMOTED0 and add FL_PROMOTED1
  to count object age.
* include/ruby/ruby.h: rewrite write barriers for incremental marking.
* debug.c: catch up flag name changes.
* internal.h: add rb_gc_writebarrier_remember() instead of
  rb_gc_writebarrier_remember_promoted().
* array.c (ary_memcpy0): use rb_gc_writebarrier_remember().
* array.c (rb_ary_modify): ditto.
* hash.c (rb_hash_keys): ditto.
* hash.c (rb_hash_values): ditto.
* object.c (init_copy): use rb_copy_wb_protected_attribute() because
  FL_WB_PROTECTED is moved from RBasic::flags.
* test/objspace/test_objspace.rb: catch up ObjectSpace.dump() changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-08 04:11:00 +00:00
hsbt 8362f9b581 * symbian/*: removed Symbian support.
[Feature #10199][ruby-core:64725]
* dln.c: ditto.
* include/ruby/defines.h: ditto.
* thread_pthread.c: ditto.
* vm.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-04 11:09:32 +00:00
nobu d0987afc74 make symbol conversion functions public
* include/ruby/encoding.h (rb_check_symbol_cstr): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-03 01:55:10 +00:00
normal 48a2b96d2b introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO use
Using calloc where possible reduces code and binary sizes.

* include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement
  (Data_Make_Struct, TypedData_Make_Struct):
  ZALLOC replaces ALLOC+memset
* compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO
* cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO
* io.c (rb_io_reopen): ditto
* iseq.c (prepare_iseq_build): ditto
* parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto
* re.c (match_alloc): ditto
* variable.c (rb_const_set): ditto
* ext/socket/raddrinfo.c (get_addrinfo): ditto
* ext/strscan/strscan.c (strscan_s_allocate): ditto
* gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 21:34:35 +00:00
ngoto 834eb1a8f6 * include/ruby/io.h (struct rb_io_buffer_t): PACKED_STRUCT should not
be used for platform-specific optimization. PACKED_STRUCT_UNALIGNED
  should be used. [ruby-core:63988] [Bug #10088]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-24 07:03:38 +00:00
nobu 63360be4d2 UNALIGNED_WORD_ACCESS on ppc64
* include/ruby/defines.h, siphash.c, st.c (UNALIGNED_WORD_ACCESS):
  add PowerPC64 too, which is capable to access unaligned words.
  patched by Gustavo Frederico Temple Pedrosa in [ruby-core:63937].
  [Feature #10081]
* regint.h (PLATFORM_UNALIGNED_WORD_ACCESS): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-23 14:50:12 +00:00
nobu 6528ad0971 defines.h: PACKED_STRUCT_UNALIGNED
* include/ruby/defines.h (PACKED_STRUCT_UNALIGNED): move from
  configure.in for universal binary.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-23 14:50:02 +00:00
normal 8cb5f8be6f rb_io_buffer_t: fix packing on gcc
* include/ruby/io.h (rb_io_buffer_t): fix packing on gcc
  r46892 caused packing to be a no-op on gcc (4.7.2-5, Debian)
  [Bug #10079][ruby-core:63912]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-21 16:56:13 +00:00
nobu db433dc39d ruby/io.h: fix rb_io_buffer_t
* include/ruby/io.h (rb_io_buffer_t): fix usage of PACKED_STRUCT().
  it must surround the whole declaration on VC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-21 07:04:21 +00:00
normal eeb05e8c11 rb_io_buffer_t: pack structure
* include/ruby/io.h (rb_io_buffer_t): pack structure
  Reduces rb_io_t from 200 to 192 bytes, allowing rb_io_t to
  occupy one less cache line.
  [Feature #10050]

n.b. this leaves a 4-byte hole after the `cbuf' field which may
be used for future expansion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-20 04:19:06 +00:00
normal 910d081d02 rb_io_t: shrink from 216 to 200 bytes on 64-bit
* include/ruby/io.h (rb_io_t): shrink to 200 bytes from 216 on 64-bit
  This puts us within 8 bytes of being three cache lines instead of
  four lines on x86-64.  This breaks the ABI.
  [Feature #10050]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-20 04:18:58 +00:00
normal f36315a519 re_pattern_buffer: shrink from 464 to 448 bytes on 64-bit
* include/ruby/oniguruma.h (struct re_pattern_buffer): shrink to 448
  bytes from 464 bytes on 64-bit.  This breaks the ABI.
  [Feature #10034]

Reducing struct re_pattern_buffer from 464 to 448 bytes allows it to fit
into neatly into seven 64-byte cache lines on x86-64 systems.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-20 04:18:49 +00:00
naruse 64c81e40d4 * regcomp.c: Merge Onigmo 5.14.1 25a8a69fc05ae3b56a09.
this includes Support for Unicode 7.0 [Bug #9092].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-16 03:27:25 +00:00
nobu 783b3c8d5a st.c: remove equality checks
* st.c (st_update): remove equality checks, callers should ensure
  the equality, otherwise the behavior is undefined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06 15:11:53 +00:00
shyouhei 8250aa2df0 * include/ruby/ruby.h (struct RHash): no longer. [Feature #9889]
* include/ruby/ruby.h (RHASH): ditto.

	* include/ruby/ruby.h (RHASH_ITER_LEV): deprecated.  Will be deleted later.

	* include/ruby/ruby.h (RHASH_IFNONE): ditto.

	* internal.h (struct RHash): moved here.

	* internal.h (RHASH): ditto.

	* hash.c (rb_hash_iter_lev): do not use this.

	* hash.c (rb_hash_ifnone): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-23 07:26:03 +00:00
shyouhei 62bfc4f24e * include/ruby/ruby.h (struct RComplex): no longer. [Feature #9888]
* include/ruby/ruby.h (RCOMPLEX): ditto.

	* include/ruby/ruby.h (RCOMPLEX_SET_REAL): deprecated.  Will be deleted later.

	* include/ruby/ruby.h (RCOMPLEX_SET_IMAG): ditto.

	* internal.h (struct RFloat): moved here.

	* internal.h (RCOMPLEX): ditto.

	* complex.c (rb_complex_set_real): do not use this.

	* complex.c (rb_complex_set_imag): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-23 04:41:27 +00:00
shyouhei 6adcf6a898 * include/ruby/ruby.h (struct RFloat): no longer. [Feature #9863]
* include/ruby/ruby.h (RFLOAT): ditto.

	* internal.h (struct RFloat): moved here.

	* internal.h (RFLOAT): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-23 04:12:19 +00:00
nobu e99ee55abc constify parameters
* include/ruby/intern.h: constify `argv` parameters.

* include/ruby/ruby.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18 06:16:39 +00:00
nobu 6ab08d2e8d configure.in, missing.h: jemalloc mangling
* configure.in (with-jemalloc): also check for header, for ABIs
  which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF
  platforms.  [ruby-core:62939] [Feature #9113]
* include/ruby/missing.h: include alternative malloc header to
  replace memory management functions.
* dln.c, io.c, parse.y, st.c: undef malloc family before
  re-definition to suppress warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-05 05:16:46 +00:00
nobu 0fec24f972 encoding.c: move ruby_encoding_index stuff
* encoding.c: move `ruby_encoding_index` stuff from
  include/ruby/encoding.h to hide the extra field.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02 20:23:52 +00:00
nobu f2980e3e20 encoding.h: constify rb_encoding
* include/ruby/encoding.h: constify `rb_encoding` itself, not only
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02 20:23:47 +00:00
nobu 046831094b constify rb_encoding and OnigEncoding
* include/ruby/encoding.h: constify `rb_encoding` arguments.
* include/ruby/oniguruma.h: constify `OnigEncoding` arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-01 22:06:11 +00:00
normal 205e690646 include/ruby/ruby.h: hide Symbol internals
This is too new to be a compatibility problem.

* include/ruby/ruby.h: Hide Symbol internals.
  (struct RSymbol): moved to internal.h
  (RSYMBOL): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-28 20:08:56 +00:00
naruse 210f863906 revert File::Statfs [Feature #9772]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-22 10:39:48 +00:00
akr 63fee73500 * configure.in: Check nextafter() availability.
* include/ruby/missing.h (nextafter): New optional declaration.

* missing/nextafter.c: New file.

* numeric.c: Float#next_float and Float#prev_float implemented.

   [ruby-core:62562] [Feature #9834]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-18 00:37:10 +00:00
akr e56d2c385a * include/ruby/ruby.h: Hide Rational internal.
(RRational): Moved to internal.h
  (RRATIONAL): Ditto.
  (RRATIONAL_SET_NUM): Moved to rational.c.
  (RRATIONAL_SET_DEN): Ditto.

* rational.c (rb_rational_num): New function.
  (rb_rational_den): Ditto.

* include/ruby/intern.h (rb_rational_num): Declared.
  (rb_rational_den): Ditto.

*  ext/bigdecimal/bigdecimal.c: Follow the above change.

* ext/date/date_core.c: Ditto.

  [ruby-core:60665] [Feature #9513]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-17 16:37:41 +00:00
ko1 7093a2cb5b * ext/openssl/depend: remove dependency from internal headers.
[Feature #9612]
* ext/openssl/ossl.c (ossl_fips_mode_set): ditto.
* ext/coverage/depend: ditto.
* include/ruby/thread_native.h: added.
  This header file only provides wrapper functions to control
  native threads. These wrapper functions are used by MRI
  implementation.
* vm_core.h: use include/ruby/thread_native.h.
* thread.c: ditto.
* thread_pthread.h: ditto.
* thread_win32.h: ditto.
* thread_native.h: removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-14 10:55:38 +00:00
usa 86dc863bd8 * win32/win32.c, include/ruby/win32.h (ustatfs): implementation of
statfs(2) clone. [EXPERIMENTAL]

* file.c (rb_io_statfs): use above function.

* configure.in, win32/Makefile.sub (struct statfs): available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-22 15:45:00 +00:00
akr 95de2b0012 * internal.h (struct RBignum): Use size_t for len.
* include/ruby/intern.h (rb_big_new): Use size_t instead of long to
  specify the size of bignum.
  (rb_big_resize): Ditto.

* bignum.c: Follow above changes.

* rational.c: Follow above changes.

* marshal.c: Follow above changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-19 01:11:04 +00:00
akr a6024cdc1b * numeric.c (rb_num2long): Returns a long.
(rb_num2ulong): Returns a unsigned long.

* bignum.c (rb_big2long): Returns a long.
  (rb_big2ulong): Returns a unsigned long.

* include/ruby/intern.h: Follow above changes.

* include/ruby/ruby.h: Follow above changes.
  (rb_num2long_inline): No need to cast.
  (rb_num2ulong_inline): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-18 15:46:32 +00:00
nobu 37dffb599d string.c: rb_str_cat_cstr
* string.c (rb_str_cat): make non-buf version main.

* string.c (rb_str_cat_cstr): rename from rb_str_cat2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-17 05:22:57 +00:00
nobu 3d69324be3 configure.in: FUNC_MINIMIZED
* configure.in (RUBY_FUNC_ATTRIBUTE): escape double quotes in
  attribute.

* configure.in (FUNC_MINIMIZED): attribute to minimize function
  body.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-17 02:41:39 +00:00
usa 1242292de9 * include/ruby/win32.h (rb_w32_cmdvector): removed.
* win32/win32.c (rb_w32_sysinit): use WCHAR version of GetCommandLine()
  internally.

* win32/win32.c (w32_cmdvector): renamed from rb_w32_cmdvector.  use
  WCHAR* instead of char* internally.

these changes are expected to not changing the behavior yet.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-15 10:39:36 +00:00
nobu ac4e60bfb2 win32.c: wchar conversion
* win32/win32.c (rb_w32_wstr_to_mbstr, rb_w32_mbstr_to_wstr): make
  WCHAR/mb conversion functions public.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-05 23:51:27 +00:00
nari 90b7073842 * parse.y: support Symbol GC. [ruby-trunk Feature #9634]
See this ticket about Symbol GC.

* include/ruby/ruby.h:
  Declare few functions.
  * rb_sym2id: almost same as old SYM2ID but support dynamic symbols.
  * rb_id2sym: almost same as old ID2SYM but support dynamic symbols.
  * rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not
    pin down a dynamic symbol.
  Declare a new struct.
  * struct RSymbol: represents a dynamic symbol as object in
    Ruby's heaps.
  Add few macros.
  * STATIC_SYM_P: check a static symbol.
  * DYNAMIC_SYM_P: check a dynamic symbol.
  * RSYMBOL: cast to RSymbol

* gc.c: declare RSymbol. support T_SYMBOL.

* internal.h: Declare few functions.
  * rb_gc_free_dsymbol: free up a dynamic symbol. GC call this
    function at a sweep phase.
  * rb_str_dynamic_intern: convert a string to a dynamic symbol.
  * rb_check_id_without_pindown: not pinning function.
  * rb_sym2id_without_pindown: ditto.
  * rb_check_id_cstr_without_pindown: ditto.

* string.c (Init_String): String#intern and String#to_sym use
  rb_str_dynamic_intern.

* template/id.h.tmpl: use LSB of ID as a flag for determining a
  static symbol, so we shift left other ruby_id_types.

* string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to
  avoid pinning.

* load.c: use xx_without_pindown function at creating temporary ID
  to avoid pinning.

* object.c: ditto.

* sprintf.c: ditto.

* struct.c: ditto.

* thread.c: ditto.

* variable.c: ditto.

* vm_method.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 04:57:47 +00:00
ko1 53bd4502d8 * include/ruby/intern.h (rb_obj_call_init, rb_class_new_instance):
constify a parameter (VALUE *).
  I believe this incompatibility doesn't break any code.
  However, if you have trouble, please tell us.
* eval.c, object.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-20 04:03:11 +00:00
nobu 1b81dafdd5 win32/win32.c: add rb_w32_inet_pton
* include/ruby/win32.h, win32/win32.c (rb_w32_inet_pton): add a
  wrapper function for inet_pton minimum supported client is
  Vista, as well as inet_ntop.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-23 02:54:04 +00:00
normal 08252d18a3 gc.c: RB_GC_GUARD should be robust enough for any compiler
* include/ruby/ruby.h (RB_GC_GUARD):
  use rb_gc_guarded_ptr_val on non-GCC/MSC
* gc.c (rb_gc_guarded_ptr_val): rename and adjust argument.
  RB_GC_GUARD should be robust enough for any compiler.
  [ruby-core:60816] [Bug #7805]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-20 23:45:55 +00:00
akr 841bf2b208 * internal.h: Move BDIGIT and related definitions from
include/ruby/defines.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-17 11:01:12 +00:00
nobu 71430123d3 ruby.h: use FIX2LONG
* include/ruby/ruby.h (RBIGNUM_SIGN): use FIX2LONG() instead of
  FIX2INT() for optimization, since rb_big_cmp() returns only
  Fixnum -1..+1 for Finxum 0.

  (RBIGNUM_POSITIVE_P, RBIGNUM_NEGATIVE_P): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 07:20:23 +00:00
akr 0bb75c4a71 * include/ruby/ruby.h (RBIGNUM_SIGN): Defined for compatibility.
(RBIGNUM_POSITIVE_P): Ditto.
  (RBIGNUM_NEGATIVE_P): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 05:34:48 +00:00
akr ab9bc151e8 * include/ruby/ruby.h,
internal.h,
  ext/-test-/bignum/bigzero.c: Hide a Bignum definition.
  [ruby-core:42891] [Feature #6083]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14 15:29:10 +00:00
akr 6f8b0e9bb0 * include/ruby/intern.h,
include/ruby/io.h,
  include/ruby/ruby.h,
  include/ruby/win32.h,
  include/ruby/backward/rubysig.h,
  bignum.c,
  gc.c,
  io.c,
  process.c,
  safe.c,
  struct.c,
  thread.c,
  ext/socket/rubysocket.h,
  ext/-test-/old_thread_select: Remove deprecated definitions
  [ruby-core:60581] [Feature #9502]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14 15:16:31 +00:00
nobu cc1910b542 marshal.c: Numerics are not tainted
* include/ruby/ruby.h (OBJ_TAINTABLE, OBJ_TAINT, OBJ_INFECT),
  marshal.c (r_entry0): all Numerics never be tainted now.
  [ruby-core:57346] [Bug #8945]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-08 17:13:55 +00:00
glass cd476cd86b * configure.in: check qsort_r(3) and whether it is GNU version.
BSD version has different prototype.

* util.h: use qsort_r() as ruby_qsort() if it is GNU version.

* util.c: define ruby_qsort() if needed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-08 12:50:28 +00:00
nobu fe1c21087d win32.h: define strtoll and strtoull for earlier VC
* include/ruby/win32.h (strtoll, strtoull): VC8 and later until
  VC12 have LONG_LONG but it is _int64, and provide i64 version
  functions only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-07 03:23:32 +00:00
nobu 4b146b2533 pack.c: use ivar for associated objects
* pack.c (str_associate, str_associated): keep associated objects
  in an instance variables, instead of in the internal structure.
* string.c (rb_str_associate, rb_str_associated): deprecate.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-04 05:07:21 +00:00
nobu 5e9b7bacc3 ruby/util.h: DECIMAL_SIZE_OF_BITS
* include/ruby/util.h (DECIMAL_SIZE_OF_BITS): a preprocessor
  constant macro to approximate decimal representation size of n-bits
  integer.
* iseq.c (register_label): use DECIMAL_SIZE_OF_BITS for better
  approximation.
* ext/bigdecimal/bigdecimal.c (BigMath_s_log): ditto.
* common.mk (iseq.o), ext/bigdecimal/depend (bigdecimal.o): add
  dependency to ruby/util.h for DECIMAL_SIZE_OF_BITS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-12 00:21:37 +00:00
ko1 c2e72fb343 * vm.c (rb_vm_pop_cfunc_frame): added. It cares c_return event.
The patch base by drkaes (Stefan Kaes).
  [Bug #9321]
* variable.c (rb_mod_const_missing): use rb_vm_pop_cfunc_frame()
  instead of rb_frame_pop().
* vm_eval.c (raise_method_missing): ditto.
* vm_eval.c (rb_iterate): ditto.
* internal.h (rb_vm_pop_cfunc_frame): add decl.
* test/ruby/test_settracefunc.rb: add tests.
  provided by drkaes (Stefan Kaes).
* vm.c, eval.c, include/ruby/intern.h (rb_frame_pop):
  move definition of rb_frame_pop() and deprecate it.
  It doesn't care about `return' events.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09 10:12:59 +00:00
nobu 5265e6c0b9 ruby/version.h: bump API version
* include/ruby/version.h: bump API version too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-26 03:53:20 +00:00
ko1 def62c3267 * include/ruby/ruby.h (RARRAY_ASET): try to avoid compiler warning.
[Bug #9287]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-24 03:13:52 +00:00
nobu bc483ae335 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20 11:20:16 +00:00
ko1 c702005a7b * include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN into
RB_OBJ_WRITE and RB_OBJ_WRITTEN.
* array.c, class.c, compile.c, hash.c, internal.h, iseq.c,
  proc.c, process.c, re.c, string.c, variable.c, vm.c,
  vm_eval.c, vm_insnhelper.c, vm_insnhelper.h,
  vm_method.c: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20 08:07:47 +00:00
ko1 b766cc4e70 * include/ruby/ruby.h: add a comment for WB interfaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20 07:01:52 +00:00
tmm1 3409690957 ruby.h: swap iv_index_tbl and super for struct RClass
* include/ruby/ruby.h (struct RClass): add super, remove iv_index_tbl.
  since RCLASS_SUPER() is commonly used inside while loops, we move it
  back inside struct RClass to improve cache hits. this provides a
  small improvement (1%) in hotspots like rb_obj_is_kind_of()
* internal.h (struct rb_classext_struct): remove super, add
  iv_index_table
* internal.h (RCLASS_SUPER): update for new location
* internal.h (RCLASS_SET_SUPER): ditto
* internal.h (RCLASS_IV_INDEX_TBL): ditto
* object.c (rb_class_get_superclass): ditto
* include/ruby/backward/classext.h (RCLASS_SUPER): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20 05:10:07 +00:00
nobu b4ab650e1a variable.c: rb_class_path_cached
* variable.c (rb_class_path_cached): returns cached class path
  only, without searching and allocating new class path string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09 03:25:38 +00:00
tmm1 8f77cfb308 gc.c: promote long-lived NODE_CREF objects to oldgen
* include/ruby/ruby.h: add RGENGC_WB_PROTECTED_NODE_CREF setting
  In a large app, this reduces the size of
  remembered_shady_object_count by 80%. [Bug #9225] [ruby-core:58947]
* gc.c (rb_node_newnode): add FL_WB_PROTECTED flag to NODE_CREF
* class.c (rewrite_cref_stack): insert OBJ_WRITE for NODE_CREF
* iseq.c (set_relation): ditto
* iseq.c (rb_iseq_clone): ditto
* vm_eval.c (rb_yield_refine_block): ditto
* vm_insnhelper.c (vm_cref_push): ditto
* vm_insnhelper.h (COPY_CREF): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08 02:28:04 +00:00
tmm1 4876dd3fb1 gc.c: add GC.latest_gc_info()
* gc.c (struct rb_objspace): rename internal last_collection_flags to
  latest_gc_info
* gc.c (gc_latest_collection_info): add GC.latest_gc_info() with similar
  behavior to GC.stat()
* gc.c (rb_gc_latest_gc_info): new c-api for above
* gc.c (gc_stat_internal): remove :last_collection_flags from GC.stat
* gc.c (gc_profile_decode_flags): remove GC::Profiler.decode_flags
* include/ruby/intern.h (rb_gc_latest_gc_info): export new c-api
* test/ruby/test_gc.rb (class TestGc): test for new behavior
* NEWS: note about new api

* gc.c (gc_stat_internal): raise TypeError on wrong type
* gc.c (gc_stat): fix error message

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 10:30:38 +00:00
tmm1 241c1a5459 gc.c: expose GC.stat() to C-api via rb_gc_stat()
* include/ruby/intern.h: add rb_gc_stat() for access to GC.stat
  variables from c-api
* gc.c (rb_gc_stat): new c-api method. accepts either VALUE hash like
  GC.stat, or VALUE symbol key and returns size_t directly. the second
  form is useful to avoid allocations, i.e. for usage inside
  INTERNAL_EVENT_GC tracepoints.
* gc.c (gc_stat): add GC.stat(:key) to return single value instead of hash
* gc.c (gc_stat_internal): helper method to retrieve single or all stat values
* test/ruby/test_gc.rb (class TestGc): test for new behavior
* NEWS: note about this new api

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 07:45:13 +00:00
tmm1 393b9e65e9 gc.c: split GC_END event into GC_END_MARK and GC_END_SWEEP
* include/ruby/ruby.h: remove INTERNAL_EVENT_GC_END and replace with
  two new events: GC_END_MARK and GC_END_SWEEP
* gc.c (gc_after_sweep): emit GC_END_SWEEP after lazy sweep is done
* gc.c (gc_marks_body): emit GC_END_MARK at end of minor/major mark
* ext/-test-/tracepoint/tracepoint.c (struct tracepoint_track): tests
  for new events.
* test/-ext-/tracepoint/test_tracepoint.rb (class TestTracepointObj):
  ditto.
* NEWS: remove ObjectSpace.after_gc_*_hook. These are only a sample,
  and will be removed before ruby 2.1.
* ext/objspace/gc_hook.c: remove ObjectSpace.after_gc_end_hook=

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 04:26:04 +00:00
tmm1 084b602d9a * include/ruby/ruby.h (struct RClass): Add wrapper struct around
RClass->m_tbl with serial. This prevents double marking method
  tables, since many classes/modules can share the same method table.
  This improves minor mark time in a large application by 30%.
* internal.h (struct method_table_wrapper): Define new
  wrapper struct with additional serial.
* internal.h (RCLASS_M_TBL_INIT): New macro for initializing method
  table wrapper and st_table.
* method.h (void rb_sweep_method_entry): Rename rb_free_m_table to
  rb_free_m_tbl for consistentcy
* .gdbinit (define rb_method_entry): Update rb_method_entry gdb helper
  for new method table structure.
* class.c: Use RCLASS_M_TBL_WRAPPER and
  RCLASS_M_TBL_INIT macros.
* class.c (rb_include_class_new): Share WRAPPER between module and
  iclass, so serial can prevent double marking.
* eval.c (rb_prepend_module): ditto.
* eval.c (rb_using_refinement): ditto.
* gc.c: Mark and free new wrapper struct.
* gc.c (obj_memsize_of): Count size of additional wrapper struct.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03 08:11:07 +00:00
nobu 92b4a05e07 vm_eval.c: rb_yield_block
* vm_eval.c (rb_yield_block): yield block with rb_block_call_func
  arguments.
* range.c (range_each): use rb_yield_block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 08:06:19 +00:00
nobu 58553ca184 ruby/ruby.h, enum.c, vm_eval.c: constify argv
* include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): constify argv.
* enum.c (rb_enum_values_pack): ditto.
* vm_eval.c (rb_block_call, rb_check_block_call): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 08:02:51 +00:00
nobu 7566c49068 ruby/ruby.h: RB_BLOCK_CALL_FUNC_ARGLIST
* include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): for declaration
  argument list of rb_block_call_func.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 07:59:14 +00:00
nobu f0e73fc986 ruby/ruby.h: rb_block_call_func_t
* include/ruby/ruby.h (rb_block_call_func_t): strict check for
  rb_block_call_func* if RB_BLOCK_CALL_FUNC_STRICT is set.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 07:55:11 +00:00
nobu 9f45081627 ruby/ruby.h: add blockarg to rb_block_call_func
* include/ruby/ruby.h (rb_block_call_func): add blockarg.  block
  function can take block argument, e.g., proc {|&blockarg| ...}.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 02:26:48 +00:00
glass 79e6336495 * st.c: add st_values() and st_values_check().
* include/ruby/st.h: add prototypes for above.

* hash.c (rb_hash_values): use st_values_check() for performance
 improvement if VALUE and st_data_t are compatible.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-28 08:39:16 +00:00
glass 78cfcbc657 * st.c (st_keys): fix not to use Qundef in st.c.
* include/ruby/st.h: define modified prototype.

* hash.c (rb_hash_keys): use modified st_keys().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-28 08:15:26 +00:00
nobu 21f81885ab win32.c: rb_w32_dup2
* win32/win32.c (rb_w32_dup2): extract from rb_cloexec_dup2() and
  redirect_dup2().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-28 07:15:56 +00:00
glass b426e1b1fa * st.c (st_keys): define st_keys(). it writes each key to buffer.
* hash.c (rb_hash_keys): use st_keys() for performance improvement
  if st_data_t and VALUE are compatible.

* st.h: define macro ST_DATA_COMPATIBLE_P() to predicate whether
  st_data_t and passed type are compatible.

* configure.in: check existence of builtin function to use in
  ST_DATA_COMPATIBLE_P().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27 16:07:10 +00:00
akr 0224b515a8 * include/ruby/defines.h (SIZEOF_ACTUAL_BDIGIT): Defined.
* include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Use
  SIZEOF_ACTUAL_BDIGIT instead of SIZEOF_BDIGITS.
  SIZEOF_BDIGITS can be different to sizeof(BDIGIT).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24 09:15:34 +00:00
akr d33541009f * include/ruby/defines.h: Don't use int128_t for Bignum.
It's not always faster.

* bignum.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24 04:51:33 +00:00
nobu 4efba669ec ruby.h: define RBIGNUM_EMBED_LEN_MAX by macros
* include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): define by macros
  defined in defines.h, instead of complex and repeated expression.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-23 15:44:34 +00:00
akr 6bcb8edb6d * include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Limit the value to
less than 8.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-23 13:25:36 +00:00
nari f29e925701 * include/ruby/intern.h, internal.h: Expose rb_gc_count().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22 08:16:55 +00:00
nari 9d2f54b3e9 * include/ruby/intern.h (rb_gc_set_params): Deprecate
rb_gc_set_params because it's only used in ruby internal.

* internal.h (ruby_gc_set_params): Declare rb_gc_set_params's
  alias function.

* gc.c: ditto.

* ruby.c: use ruby_gc_set_params.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22 07:26:55 +00:00
nobu 24537e1b1c gc.c: finalizer functions
* gc.c (rb_define_finalizer, rb_undefine_finalizer): rename and export
  finalizer functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 23:03:11 +00:00
ko1 325d2cfcdf * gc.c: add 3gen GC patch, but disabled as default.
RGenGC is designed as 2 generational GC, young and old generation.
  Young objects will be promoted to old objects after one GC.
  Old objects are not collect until major (full) GC.
  The issue of this approach is some objects can promoted as old
  objects accidentally and not freed until major GC.
  Major GC is not frequently so short-lived but accidentally becoming
  old objects are not freed.
  For example, the program "loop{Array.new(1_000_000)}" consumes huge
  memories because short lived objects (an array which has 1M
  elements) are promoted while GC and they are not freed before major
  GC.
  To solve this problem, generational GC with more generations
  technique is known. This patch implements three generations gen GC.
  At first, newly created objects are "Infant" objects.
  After surviving one GC, "Infant" objects are promoted to "Young"
  objects.
  "Young" objects are promoted to "Old" objects after surviving
  next GC.
  "Infant" and "Young" objects are collected if it is not marked
  while minor GC. So that this technique solves this problem.
  Representation of generations:
  * Infant: !FL_PROMOTED and !oldgen_bitmap [00]
  * Young :  FL_PROMOTED and !oldgen_bitmap [10]
  * Old   :  FL_PROMOTED and  oldgen_bitmap [11]
  The macro "RGENGC_THREEGEN" enables/disables this feature, and
  turned off as default because there are several problems.
  (1) Failed sometimes (Heisenbugs).
  (2) Performance down.
      Especially on write barriers. We need to detect Young or Old
      object by oldgen_bitmap. It is slower than checking flags.
  To evaluate this feature on more applications, I commit this patch.
  Reports are very welcome.
  This patch includes some refactoring (renaming names, etc).
* include/ruby/ruby.h: catch up 3gen GC.
* .gdbinit: fix to show a prompt "[PROMOTED]" for promoted objects.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-04 18:59:33 +00:00
ko1 42bd731dc5 * include/ruby/ruby.h: rename FL_OLDGEN to FL_PROMOTED.
This flag represents that "this object is promoted at least once."
* gc.c, debug.c, object.c: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-04 15:04:10 +00:00
nobu adbdd97d28 string.c: export rb_str_scrub
* string.c (rb_str_scrub): export with fixed length arguments, and
  allow nil as replacement string instead of omitting.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-01 07:55:56 +00:00
ko1 0c6940b718 * include/ruby/ruby.h: fix typo (FL_WB_PROTECT -> FL_WB_PROTECTED).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 10:49:45 +00:00
ko1 52811ab159 * include/ruby/ruby.h: introduce new flags for T_TYPEDDATA.
* RUBY_TYPED_FREE_IMMEDIATELY: free the data given by DATA_PTR()
    with dfree function immediately.  Otherwise (default), the data
    freed at finalizaton point.
  * RUBY_TYPED_WB_PROTECTED: make this object with FL_WB_PROTECT
    (not shady).
* gc.c (obj_free): support RUBY_TYPED_FREE_IMMEDIATELY.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 09:42:45 +00:00
charliesome 7fafa8f376 * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: split
ruby_vm_global_state_version into two separate counters - one for the
  global method state and one for the global constant state. This means
  changes to constants do not affect method caches, and changes to
  methods do not affect constant caches. In particular, this means
  inclusions of modules containing constants no longer globally
  invalidate the method cache.

* class.c, eval.c, include/ruby/intern.h, insns.def, vm.c, vm_method.c:
  rename rb_clear_cache_by_class to rb_clear_method_cache_by_class

* class.c, include/ruby/intern.h, variable.c, vm_method.c: add
  rb_clear_constant_cache

* compile.c, vm_core.h, vm_insnhelper.c: rename vmstat field in
  rb_call_info_struct to method_state

* vm_method.c: rename vmstat field in struct cache_entry to method_state

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 00:52:38 +00:00
nobu a0c67155a0 win32.h: suppress INFINITY warnings
* include/ruby/win32.h (rb_infinity_float): suppress overflow in
  constant arithmetic warnings.  [ruby-core:57981] [Bug #9044]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-23 16:34:22 +00:00
nobu 291aead0b7 ruby.h: suppress warnings
* include/ruby/ruby.h (rb_obj_wb_unprotect, rb_obj_written),
  (rb_obj_write): suppress unused-parameter warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-20 04:58:49 +00:00
nobu 6ad62c8309 win32.h: declare fstati64 to suppress warnings
* include/ruby/win32.h (fstati64): declare for ext/-test-/file/stat.c
  on w64-mingw, to suppress warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-14 04:51:23 +00:00
charliesome c4b6e96748 * vsnprintf.c: Fix spelling from compliment to complement.
Patch by @agrimm. Closes GH-422.

* include/ruby/ruby.h: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-13 14:53:40 +00:00
nobu 2d4c2453cc win32.h: define or declare finite always
* include/ruby/win32.h (finite): always define or declare.  some
  mingw (maybe w64 only?) lack the declaration.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-10 23:52:38 +00:00
nobu b28ce966c7 st.c: revert st_keys
* st.c: revert st_keys() at r43238.  VALUE cannot be in st.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-10 16:28:56 +00:00
glass 026955e375 * st.c (st_keys): define st_keys() for performance improvement of
Hash#keys and Array#uniq.

* st.h: ditto.

* hash.c (rb_hash_keys): use st_keys().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-10 12:06:01 +00:00