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

340 Коммитов

Автор SHA1 Сообщение Дата
normal 585e1594c9 Revert r47971, r47972 [ruby-core:65764]
The current implementation currently delivers signals to self
immediately and synchronously, so we do not need explicit,
potentially-confusing sleeps to wait for signal delivery.

* test/-ext-/bug_reporter/test_bug_reporter.rb
  (test_bug_reporter_add): revert r47972
* test/ruby/test_rubyoptions.rb (test_segv_test): revert r47971
  [ruby-core:65764]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-16 18:11:49 +00:00
akr 4c02456b3d Set ASCII-8BIT encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-16 12:27:43 +00:00
normal eec651a05e test/-ext-/bug_reporter/test_bug_reporter.rb: fix race
Signal delivery is not immediate, so wait for signal delivery.

* test/-ext-/bug_reporter/test_bug_reporter.rb
  (test_bug_reporter_add): fix race

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-16 02:01:51 +00:00
akr e1ba2d418a * test/ruby/envutil.rb (assert_pattern_list) Renamed from
assert_regexp_list.
  Show multiline string in multi lines.

* test/-ext-/bug_reporter/test_bug_reporter.rb: Use
  assert_pattern_list.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-15 08:59:46 +00:00
normal f8b219e4d6 st: test packed-to-unpacked transitions during iteration
The st_foreach and st_foreach_check functions support transitioning
from a packed to an unpacked state during iteration.  However, this
functionality did not get exercised by the current test suite until
now.  This should help us prevent breakage when making modifications
to st.

* ext/-test-/st/foreach/extconf.rb: new file
* ext/-test-/st/foreach/foreach.c: ditto
* test/-ext-/st/test_foreach.rb: ditto
  [Feature #10321]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-09 07:16:19 +00:00
normal 11548f9253 test/-ext-/string/test_modify_expand.rb: increase limit for {je,tc}malloc
In this test, jemalloc and tcmalloc are both more hesitant to
release memory to the kernel than the stock glibc allocator.

Tested on jemalloc 3.6.0 (self-built) and libtcmalloc-minimal 2.0-2
(Debian package) on x86_64-linux

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-17 22:05:22 +00:00
naruse a8ec4b2cf2 * string.c (sym_find): remove Symbol.find because we have Symbol GC now.
https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20140904Japan
  If you still want this, request again on Redmine. [Feature #7854]
  https://bugs.ruby-lang.org/issues/7854

* ext/-test-/symbol/init.c (sym_find): moved from string.c for tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11 21:22:52 +00:00
nobu fa326bf312 GC.stat key name
* test/-ext-/tracepoint/test_tracepoint.rb: follow the change of
  key name of GC.stat.

* test/ruby/test_hash.rb (TestHash#test_AREF_fstring_key): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09 11:22:23 +00:00
nobu 34ec7c5b49 win32/test_console_attr.rb: reset attributes
* ext/-test-/win32/console/attribute.c (console_set_attribute):
  set console attribute.

* test/-ext-/win32/test_console_attr.rb (reset): reset attributes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-21 13:10:34 +00:00
nobu 43b00d8a11 win32.c: manage reverse video
* win32/win32.c (constat_attr): manage reverse video internally
  since Windows console window does not manage it.  based on the
  patch by white leaf in [ruby-dev:48483].  [Bug #10158]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-21 08:10:34 +00:00
nobu bae87a4790 vsnprintf.c: fix string precision
* vsnprintf.c (BSD_vfprintf): fix string width when precision is
  given.  as the result of `memchr` is NULL or its offset from the
  start cannot exceed the size, the comparison was always false.
  [ruby-core:62737] [Bug #9861]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 02:56:36 +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
nobu b522335554 test_inadvertent_creation.rb: use Symbol.find
* ext/-test-/symbol/intern.c: Symbol.find is available now.

* test/-ext-/symbol/test_inadvertent_creation.rb (noninterned_name):
  use Symbol.find instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30 15:16:07 +00:00
naruse c71019f888 * ext/-test-/string/coderange.c: add Bug::String.new#coderange_scan
to explicitly scan coderange.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-21 10:14:46 +00:00
akr 9aa67e267b * bignum.c (SIZEOF_BDIGIT): Renamed from SIZEOF_BDIGITS.
* internal.h: Ditto.

* marshal.c: Ditto.

* rational.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-13 03:48:17 +00:00
naruse cf0a0c5a66 explicitly specify ::File
There's Bug::File in test/-ext-/file/test_stat.rb.
It prevent constan search with `File`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-10 07:39:44 +00:00
nobu a237db5cbc dln.c: non-ascii path on Windows
* dln.c (dln_load): use wchar version to load a library in
  non-ascii path on Windows.  based on the patch by Bugra Barin
  <bugrabarin AT hotmail.com> in [ruby-core:61845].  [Bug #9699]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-05 23:52:52 +00:00
nobu 8062cdc6b0 test_member.rb: fix locale depending test failure
* test/-ext-/struct/test_member.rb (test_member_get): set
  default_external encoding to fix locale depending test failure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28 22:43:22 +00:00
nobu 4a46362239 struct.c: encoding of member name
* struct.c (not_a_member): preserve encoding of member name in
  error messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28 10:32:36 +00:00
nobu afb4bcbfd6 struct.c: not_a_member message
* struct.c (not_a_member): extract name error and use same error
  messages.  based on the patch by Marcus Stollsteimer <sto.mar AT
  web.de> at [ruby-core:61721].  [Bug #9684]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28 10:32:16 +00:00
akr f042e5113a add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 08:34:33 +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 5b56c1c42b parse.y: attrset from junk ID
* parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug.
* parse.y (rb_enc_symname_type): junk ID succeeded by '=' is also
  attrset ID.  [ruby-core:60668] [Bug #8756]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-13 06:43:18 +00:00
tmm1 98a74d4dd5 parse.y: use rb_fstring() for strings stored in the symbol table
* parse.y (register_symid_str): use fstrings in symbol table
  [Bug #9171] [ruby-core:58656]
* parse.y (rb_id2str): ditto
* string.c (rb_fstring): create frozen_strings on first usage. this
  allows rb_fstring() calls from the parser (before cString is created)
* string.c (fstring_set_class_i): set klass on fstrings generated
  before cString was defined
* string.c (Init_String): convert frozen_strings table to String
  objects after boot
* ext/-test-/symbol/type.c (bug_sym_id2str): expose rb_id2str()
* test/-ext-/symbol/test_type.rb (module Test_Symbol): verify symbol
  table entries are fstrings

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08 01:39:27 +00:00
tmm1 6692436b9f ext/objspace: remove OS.after_gc_start_hook= and move internal test
* ext/objspace/gc_hook.c: remove this file
* ext/-test-/tracepoint/gc_hook.c: new filename for above
* ext/objspace/objspace.c: remove ObjectSpace.after_gc_start_hook=
* test/objspace/test_objspace.rb: remove test
* test/-ext-/tracepoint/test_tracepoint.rb: add above test for
  tracepoint re-entry

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 09:24:02 +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
nobu 04ca48fc38 eval.c: determine exit status and signal before finalization
* eval.c (ruby_cleanup): determine exit status and signal to terminate
  before finalization, to get rid of access destroyed T_DATA execption
  object.  [ruby-core:58643] [Bug #9167]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-30 08:46:41 +00:00
nobu dacc2c2436 vm_eval.c: blockarg
* vm_eval.c (rb_yield_block): implement non-nil block argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-30 04:21:26 +00:00
nobu c38b4a9b3d test_bug_reporter.rb: remove core
* test/-ext-/bug_reporter/test_bug_reporter.rb (test_bug_reporter_add):
  remove expected core file to get rid of false error in chkbuild.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27 00:32:37 +00:00
nobu 94f01c55df should not ignore the rest of recursive constructs
* array.c (rb_ary_hash): should not ignore the rest of recursive
  constructs.
* hash.c (rb_hash_hash): ditto.
* range.c (range_hash): ditto.
* struct.c (rb_struct_hash): ditto.
* test/-ext-/test_recursion.rb (TestRecursion): separate from
  test/ruby/test_thread.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26 17:20:16 +00:00
ko1 5b40cb6a2c * vm_trace.c: prohibit to specify normal events and internal events
simultaneously.
  I will introduce special care for internal events later.
* ext/-test-/tracepoint/tracepoint.c: test this behavior.
* test/-ext-/tracepoint/test_tracepoint.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26 08:41:44 +00:00
ko1 84b7d6d533 * test/-ext-/tracepoint/test_tracepoint.rb: catch up GC.stat changes
at r43835.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24 20:06:02 +00:00
tmm1 5b529e5a3d * vm_backtrace.c (rb_profile_frame_classpath): handle singleton
methods defined directly on an object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-27 19:17:24 +00:00
nobu 347e748bdd variable.c: real class name
* variable.c (rb_class2name): should return real class name, not
  singleton class or iclass.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-19 20:24:30 +00:00
nobu dee91b534a * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-17 01:10:35 +00:00
ko1 955a38da08 * error.c, internal.h (rb_bug_reporter_add): add a new C-API.
rb_bug_reporter_add() allows to register a function which
  is called at rb_bug() called.
* ext/-test-/bug_reporter/bug_reporter.c: add a test for this C-API.
* ext/-test-/bug_reporter/extconf.rb: ditto.
* test/-ext-/bug_reporter/test_bug_reporter.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-16 08:39:39 +00:00
nobu 2e3d072d9d test/-ext-: suppress warnings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-14 19:14:27 +00:00
nobu 5f7f1e5162 test_profile_frames.rb: assert first_lineno
* test/-ext-/debug/test_profile_frames.rb (test_profile_frames):
  assert first_lineno, only the top level of methods for the time
  being.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-14 19:14:20 +00:00
nobu 8cf090743e test_profile_frames.rb: fix typo
* test/-ext-/debug/test_profile_frames.rb (test_profile_frames): fix
  typo, methdo_names to method_names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-14 19:14:17 +00:00
nobu 24cf72029f object.c: avoid inadvertent symbol creation
* object.c (id_for_attr): avoid inadvertent symbol creation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09 14:57:04 +00:00
nobu ef46e8d264 test_inadvertent_creation.rb: fix assertion name
* test/-ext-/symbol/test_inadvertent_creation.rb: fix assertion name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09 09:03:03 +00:00
nobu 6af3029c8c test_inadvertent_creation.rb: use assert_not_interned?
* test/-ext-/symbol/test_inadvertent_creation.rb: use
  assert_not_interned? instead assert_not_send.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09 08:45:30 +00:00
nobu 9ef55da910 test/unit/assertions.rb: return exception
* lib/test/unit/assertions.rb (assert_raise_with_message): return
  raised exception same as assert_raise.

* test/ruby, test/-ext-: use assert_raise_with_message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09 08:43:12 +00:00
nobu 289d6bb30f test: use assert_raise
* test/ruby, test/-ext-: use assert_raise instead of assert_raises.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09 08:41:13 +00:00
nobu b1b4724ea0 test_tracepoint.rb: include zombies
* test/-ext-/tracepoint/test_tracepoint.rb (test_tracks_objspace_count):
  free count should include zombies.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09 08:39:28 +00:00
ko1 b753b9606e * include/ruby/debug.h,
vm_backtrace.c (rb_profile_frame_full_label): add new C API
  rb_profile_frame_full_label() which returns label with
  qualified method name.
  Note that in future version of Ruby label() may return
  same return value of full_label().
* ext/-test-/debug/profile_frames.c,
  test/-ext-/debug/test_profile_frames.rb: fix a test for this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09 00:21:51 +00:00
nobu 3f167b72bd * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-08 13:50:50 +00:00
ko1 cff2b2b666 * vm_backtrace.c, include/ruby/debug.h: add new APIs
* VALUE rb_profile_frame_method_name(VALUE frame)
* VALUE rb_profile_frame_qualified_method_name(VALUE frame)
* iseq.c (rb_iseq_klass), internal.h: add new internal function
  rb_iseq_method_name().
* ext/-test-/debug/profile_frames.c (profile_frames),
  test/-ext-/debug/test_profile_frames.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-08 12:08:20 +00:00
ko1 6b5d5e5322 * test/-ext-/debug/test_profile_frames.rb: rename class C to
something long name because one test depends on absence of
  class ::C.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07 07:51:16 +00:00
ko1 ef7df5a414 * ext/-test-/debug/profile_frames.c:
test/-ext-/debug/test_profile_frames.rb: add a test for new C-APIs.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07 07:35:21 +00:00
nobu 21212fba19 test_old_thread_select.rb: ignore short wait on Windows
* test/-ext-/old_thread_select/test_old_thread_select.rb
  (test_old_select_signal_safe): ignore short wait on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-06 00:28:13 +00:00
nobu c07c33b28a file.c: export rb_stat_new
* file.c (stat_new_0): constify.
* file.c (rb_stat_new): constify and export.  based on a patch by
  Hanmac (Hans Mackowiak) at [ruby-core:53225].  [Feature #8050]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-01 11:54:53 +00:00
nobu 6496dc892d parse.y: allow junk attrset
* parse.y (rb_id_attrset, intern_str): allow junk attrset ID for
  Struct.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-29 14:45:46 +00:00
nobu 771c8ed338 parse.y: fix inconsistency with literals
* parse.y (rb_id_attrset): fix inconsistency with literals, allow
  ID_ATTRSET and return it itself, but ID_JUNK cannot make ID_ATTRSET.
  and raise a NameError instead of rb_bug() for invalid argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-29 13:56:33 +00:00
nobu d8441fcc6e encdb.c, encoding.c: make BOM-encodings dummy
* enc/encdb.c (ENC_DUMMY_UNICODE): make BOM-encodings dummy.
* encoding.c (enc_autoload): keep dummy encodings dummy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24 08:15:18 +00:00
nobu f894022ba5 string/test_ellipsize.rb: remove non-sense tests
* test/-ext-/string/test_ellipsize.rb (Test_StringEllipsize#test_nonascii):
  rb_str_ellipsize() does not support BOM.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24 07:42:58 +00:00
nobu aba824fece parse.y: junk sigil only names
* parse.y (intern_str): sigil only names are junk, at least one
  identifier character is needed.  [ruby-dev:47723] [Bug #8928]
* parse.y (rb_enc_symname_type): fix out of bound access.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-20 06:01:57 +00:00
nobu 831fe26dec ext/-test-/symbol: move upward
* ext/-test-/symbol/extconf.rb: move the extension object file upward.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-20 04:53:11 +00:00
nobu 170344b20e vsnprintf.c: initialize cp
* vsnprintf.c (BSD_vfprintf): initialize cp so that size is 0 in the
  commented case.  fix an accidental bug at r16716.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-19 07:25:09 +00:00
akr 42a3e0dc55 * rational.c: Include gmp.h if GMP is used.
(GMP_GCD_DIGITS): New macro.
  (rb_gcd_gmp): New function.
  (f_gcd_normal): Renamed from f_gcd.
  (rb_gcd_normal): New function.
  (f_gcd): Invoke rb_gcd_gmp or f_gcd_normal.

* internal.h (rb_gcd_normal): Declared.
  (rb_gcd_gmp): Ditto.

* ext/-test-/rational: New directory.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-06 12:07:08 +00:00
akr b1b395911c * bignum.c (GMP_DIV_DIGITS): New macro.
(bary_divmod_gmp): New function.
  (rb_big_divrem_gmp): Ditto.
  (bary_divmod_branch): Ditto.
  (bary_divmod): Use bary_divmod_branch.
  (bigdivrem): Ditto.

* internal.h (rb_big_divrem_gmp): Declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04 23:22:27 +00:00
akr 8f8bf8243d * bignum.c (rb_big_divrem_normal): New function.
* internal.h (rb_big_divrem_normal): Declared.

* ext/-test-/bignum/div.c: New file.

* test/-ext-/bignum/test_div.rb: New file.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04 16:10:06 +00:00
akr c0e1f9e016 Add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03 11:20:17 +00:00
akr 2583689340 * bignum.c (GMP_STR2BIG_DIGITS): New macro.
(str2big_gmp): New function.
  (rb_cstr_to_inum): Use str2big_gmp for big bignums.
  (rb_str2big_gmp): New function.

* internal.h (rb_str2big_gmp): Declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03 11:20:02 +00:00
akr 0b2413b471 * bignum.c (rb_str2big_poweroftwo): New function.
(rb_str2big_normal): Ditto.
  (rb_str2big_karatsuba): Ditto.

* internal.h (rb_str2big_poweroftwo): Declared.
  (rb_str2big_normal): Ditto.
  (rb_str2big_karatsuba): Ditto.

* ext/-test-/bignum/str2big.c: New file.

* test/-ext-/bignum/test_str2big.rb: New file.

* ext/-test-/bignum/depend: Add the dependency for str2big.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03 03:50:15 +00:00
naruse 853c346dde * enc/trans/utf8_mac-tbl.rb: update conversion table to recent OS X.
Previous table is used on Mac OS X 10.1 or prior.
  This table is used on 10.2 or later. [ruby-dev:47680]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-02 23:36:01 +00:00
akr 7dd1604603 * bignum.c (big2str_base_poweroftwo): Renamed from
big2str_base_powerof2.
  (rb_big2str_poweroftwo): New function for test.
  (big2str_generic): Extracted from rb_big2str1.
  (rb_big2str_generic): New function for test.

* internal.h (rb_big2str_poweroftwo): Declared.
  (rb_big2str_generic): Ditto.

* ext/-test-/bignum/big2str.c: New file.

* test/-ext-/bignum/test_big2str.rb: New file.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-01 11:35:57 +00:00
naruse 9962aad7b0 * file.c (rb_str_normalize_ospath):
HFS Plus (Mac OS Extended) uses a variant of Normal Form D in which
  U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 through
  U+2FAFF are not decomposed (this avoids problems with round trip
  conversions from old Mac text encodings).
  http://developer.apple.com/library/mac/qa/qa1173/_index.html
  Therefore fix r42457 to exclude the range.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-10 20:44:10 +00:00
nobu 09adba0dc1 sprintf.c: QUOTE flag
* sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable
  characters.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-30 08:16:20 +00:00
akr e5ff9d58ef * include/ruby/intern.h (rb_absint_size): Declaration moved from
internal.h to calculate required buffer size to pack integers.
  (rb_absint_numwords): Ditto.
  (rb_absint_singlebit_p): Ditto.
  [ruby-core:42813] [Feature #6065]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-28 02:14:58 +00:00
ko1 e93e38d165 * test/-ext-/tracepoint/test_tracepoint.rb: add GC on/off to count
GC events strictly.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23 23:08:48 +00:00
nobu b271a8c98d string.c: multi-byte terminator
* string.c (rb_string_value_cstr): fill minimum length of the encoding
  as the terminator.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11 11:17:59 +00:00
nobu db3ddad3a7 string.c: check null char
* string.c (rb_string_value_cstr): check null char in char, not in
  byte.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11 11:17:54 +00:00
akr 6fdad008a2 * bignum.c (rb_big_sq_fast): New function for testing.
(rb_big_mul_toom3): Ditto.

* internal.h (rb_big_sq_fast): Declared.
  (rb_big_mul_toom3): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-08 13:05:57 +00:00
akr ffe55cdc1e * bignum.c (bary_mul_balance): Reduce work memory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-08 11:56:55 +00:00
akr 1210743cad * bignum.c (bary_mul_karatsuba): Unreachable code removed. Remove
several branches.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-07 15:21:26 +00:00
akr 29634bca31 * internal.h (rb_big_mul_normal): Declared.
(rb_big_mul_balance): Ditto.
  (rb_big_mul_karatsuba): Ditto.

* bignum.c (rb_big_mul_normal): New function for tests.
  (rb_big_mul_balance): Ditto.
  (rb_big_mul_karatsuba): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-07 14:01:40 +00:00
akr 972ae3e538 * bignum.c (bary_unpack_internal): Specialized unpacker implemented.
(bary_unpack): Support INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION.
  (rb_integer_unpack): Support INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22 11:38:19 +00:00
akr 8f0c3ff6e4 * bignum.c (bary_pack): Support
INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION flag.
  Fix byte order and word order handling in code specialized for
  wordsize % SIZEOF_BDIGITS == 0.

* internal.h (INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION): Defined.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22 09:55:27 +00:00
akr 8e9c9ec8e4 * bignum.c (bary_pack): Specialized packers implemented.
(HOST_BIGENDIAN_P): New macro.
  (ALIGNOF): New macro.
  (CLEAR_LOWBITS): New macro.
  (FILL_LOWBITS): New macro.
  (swap_bdigit): New macro.
  (bary_2comp): Returns an int.

* internal.h (swap16): Moved from pack.c
  (swap32): Ditto.
  (swap64): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 17:22:14 +00:00
akr 6ea1aee76e * bignum.c (bary_unpack_internal): Return -2 when negative overflow.
(bary_unpack): Set the overflowed bit if an extra BDIGIT exists.
  (rb_integer_unpack): Set the overflowed bit.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20 13:05:27 +00:00
akr 50794b3222 * bignum.c (bary_2comp): Extracted from get2comp.
(integer_unpack_num_bdigits): Extracted from
  rb_integer_unpack_internal.
  (bary_unpack_internal): Renamed from bary_unpack and support
  INTEGER_PACK_2COMP.
  (bary_unpack): New function to validate arguments and invoke
  bary_unpack_internal.
  (rb_integer_unpack_internal): Removed.
  (rb_integer_unpack): Invoke bary_unpack_internal.
  (rb_integer_unpack_2comp): Removed.

* internal.h (rb_integer_unpack_2comp): Removed.

* pack.c: Follow the above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16 12:59:26 +00:00
akr ecabbf1bf6 * internal.h (INTEGER_PACK_2COMP): Defined.
(rb_integer_pack_2comp): Removed.

* bignum.c (bary_pack): Support INTEGER_PACK_2COMP.
  (rb_integer_pack): Invoke bary_pack directly.
  (rb_integer_pack_2comp): Removed.
  (rb_integer_pack_internal): Ditto.
  (absint_numwords_generic): Follow the above change.

* pack.c (pack_pack): Ditto.

* sprintf.c (rb_str_format): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16 09:53:45 +00:00
shugo 1474dd064b * test/-ext-/test_printf.rb, test/rss/test_parser.rb,
test/ruby/test_array.rb, test/ruby/test_hash.rb,
  test/ruby/test_m17n.rb, test/ruby/test_marshal.rb,
  test/ruby/test_object.rb, test/ruby/test_string.rb: don't use
  untrusted?, untrust, and trust to avoid warnings in case $VERBOSE is
  true.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13 05:41:44 +00:00
akr aaa1461d7b * bignum.c (rb_integer_unpack_2comp): New function.
(rb_integer_unpack_internal): Extracted from rb_integer_unpack and
  nlp_bits_ret argument added.
  (integer_unpack_num_bdigits_small): nlp_bits_ret argument added to
  return number of leading padding bits.
  (integer_unpack_num_bdigits_generic): Ditto.

* internal.h (rb_integer_unpack_2comp): Declared.

* pack.c (pack_unpack): Use rb_integer_unpack_2comp and
  rb_integer_unpack.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 15:18:00 +00:00
akr 0c9a719d77 * internal.h (INTEGER_PACK_NEGATIVE): Defined.
(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
2013-06-11 21:39:55 +00:00
akr b23d9a8a63 * bignum.c (validate_integer_pack_format): Don't require a word order
flag if numwords is 1 or less.
  (absint_numwords_generic): Don't specify a word order for
  rb_integer_pack.

* hash.c (rb_hash): Ditto.

* time.c (v2w_bignum): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11 14:40:16 +00:00
akr 17a5321c40 rb_integer_pack tests refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11 13:15:56 +00:00
akr d5a3818f8e * bignum.c (rb_integer_pack_internal): Renamed from rb_integer_pack
and overflow_2comp argument added.
  (rb_integer_pack): Just call rb_integer_pack_internal.
  (rb_integer_pack_2comp): New function.

* internal.h (rb_integer_pack_2comp): Declared.

* sprintf.c (rb_str_format): Use rb_integer_pack and
  rb_integer_pack_2comp to format binary/octal/hexadecimal integers.
  (ruby_digitmap): Declared.
  (remove_sign_bits): Removed.
  (BITSPERDIG): Ditto.
  (EXTENDSIGN): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11 12:06:40 +00:00
akr 837392b452 * bignum.c (rb_integer_pack): numwords_allocated argument removed.
* 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
2013-06-09 05:53:00 +00:00
akr f31aed6255 * bignum.c (rb_integer_pack): Arguments changed. Use flags to
specify word order and byte order.
  (rb_integer_unpack): Ditto.
  (validate_integer_format): Follow the above change.
  (integer_format_loop_setup): Ditto.

* pack.c: Ditto.

* internal.h: Ditto.
  (INTEGER_PACK_MSWORD_FIRST): Defined.
  (INTEGER_PACK_LSWORD_FIRST): Ditto.
  (INTEGER_PACK_MSBYTE_FIRST): Ditto.
  (INTEGER_PACK_LSBYTE_FIRST): Ditto.
  (INTEGER_PACK_NATIVE_BYTE_ORDER): Ditto.
  (INTEGER_PACK_LITTLE_ENDIAN): Ditto.
  (INTEGER_PACK_BIG_ENDIAN): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 15:02:39 +00:00
akr a08b001100 * bignum.c (rb_integer_pack): Renamed from rb_int_export.
(rb_integer_unpack): Renamed from rb_int_import.

* internal.h, pack.c: Follow the above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 12:41:02 +00:00
akr e0bb10be50 Fix the class name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06 23:05:27 +00:00
akr c9c67d2fe0 * bignum.c (rb_int_import): New function.
(int_import_push_bits): Ditto.

* internal.h (rb_int_import): Declared.

* pack.c (pack_unpack): Use rb_int_import for BER compressed integer.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06 21:20:04 +00:00
akr 9fea8758e9 * configure.in: Invoke RUBY_REPLACE_TYPE for size_t.
Don't invoke RUBY_CHECK_PRINTF_PREFIX for size_t to avoid conflict
  with RUBY_REPLACE_TYPE.

* internal.h (rb_absint_size): Declared.
  (rb_absint_size_in_word): Ditto.
  (rb_int_export): Ditto.

* bignum.c (rb_absint_size): New function.
  (rb_absint_size_in_word): Ditto.
  (int_export_fill_dd): Ditto.
  (int_export_take_lowbits): Ditto.
  (rb_int_export): Ditto.

* pack.c (pack_pack): Use rb_int_export for BER compressed integer.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06 11:57:35 +00:00
ko1 c180e0d880 * vm_trace.c (rb_postponed_job_register_one): fix iteration bug.
* ext/-test-/postponed_job/postponed_job.c,
  test/-ext-/postponed_job/test_postponed_job.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 17:08:25 +00:00
ko1 e4c58251b7 * include/ruby/ruby.h, gc.c: add new internal event
RUBY_INTERNAL_EVENT_GC_END. This event invokes at the end of
  after_sweep().
  Time chart with lazy sweep is here:
  (1) Kick RUBY_INTERNAL_EVENT_GC_START
  (2) [gc_marks()]
  (3) [lazy_sweep()]
  (4) [... run Ruby program (mutator) with lazy_sweep() ...]
  (5) [after_sweep()]
  (6) Kick RUBY_INTERNAL_EVENT_GC_END
  (7) [... run Ruby program (mutator), and go to (1) ...]
* ext/-test-/tracepoint/tracepoint.c,
  test/-ext-/tracepoint/test_tracepoint.rb: modify a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 15:40:27 +00:00
nobu 696d3046d1 * append newline at EOF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 02:16:00 +00:00
ko1 662cbf22fa * test/-ext-/postponed_job/test_postponed_job.rb: fix typo and class name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 00:24:23 +00:00
ko1 680f0b5ba4 * include/ruby/ruby.h, gc.c, vm_trace.c: add internal events.
* RUBY_INTERNAL_EVENT_NEWOBJ: object created.
* RUBY_INTERNAL_EVENT_FREE: object freeed.
* RUBY_INTERNAL_EVENT_GC_START: GC started.
  And rename `RUBY_EVENT_SWITCH' to `RUBY_INTERNAL_EVENT_SWITCH'.
  Internal events can not invoke any Ruby program because the tracing
  timing may be critical (under huge restriction).
  These events can be hooked only by C-extensions.
  We recommend to use rb_potponed_job_register() API to call Ruby
  program safely.
  This change is mostly written by Aman Gupta (tmm1).
  https://bugs.ruby-lang.org/issues/8107#note-12
  [Feature #8107]
* include/ruby/debug.h, vm_trace.c: added two new APIs.
* rb_tracearg_event_flag() returns rb_event_flag_t of this event.
* rb_tracearg_object() returns created/freeed object.
* ext/-test-/tracepoint/extconf.rb,
  ext/-test-/tracepoint/tracepoint.c,
  test/-ext-/tracepoint/test_tracepoint.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 00:21:02 +00:00
nobu 7f4d09d6a6 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26 21:31:05 +00:00
ko1 e2793a908e * include/ruby/debug.h, vm_trace.c: add rb_postponed_job API.
Postponed jobs are registered with this API. Registered jobs
  are invoked at `ruby-running-safe-point' as soon as possible.
  This timing is completely same as finalizer timing.
  There are two APIs:
* rb_postponed_job_register(flags, func, data): register a
  postponed job with data. flags are reserved.
* rb_postponed_job_register_one(flags, func, data): same as
  `rb_postponed_job_register', but only one `func' job is
  registered (skip if `func' is already registered).
  This change is mostly written by Aman Gupta (tmm1).
  https://bugs.ruby-lang.org/issues/8107#note-15
  [Feature #8107]
* gc.c: use postponed job API for finalizer.
* common.mk: add dependency from vm_trace.c to debug.h.
* ext/-test-/postponed_job/extconf.rb, postponed_job.c,
  test/-ext-/postponed_job/test_postponed_job.rb: add a test.
* thread.c: implement postponed API.
* vm_core.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26 21:30:44 +00:00
akr 16dc6c2955 More tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-22 03:13:50 +00:00
nobu 112a3b1fca struct.c: avoid inadvertent symbol creation
* struct.c (make_struct): avoid inadvertent symbol creation.
  (rb_struct_aref): ditto.
  (rb_struct_aset): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 07:55:11 +00:00
nobu 4e59c822a0 object.c: avoid inadvertent symbol creation
* object.c (rb_mod_const_set): avoid inadvertent symbol creation.
  (rb_obj_ivar_set): ditto.
  (rb_mod_cvar_set): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 07:54:44 +00:00
nobu 9f87297c21 enum.c: avoid inadvertent symbol creation
* enum.c (enum_inject): avoid inadvertent symbol creation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 06:46:53 +00:00
nobu 8074844065 thread.c: avoid inadvertent symbol creation
* thread.c (rb_thread_aref): avoid inadvertent symbol creation.
  (rb_thread_variable_get): ditto.
  (rb_thread_key_p): ditto.
  (rb_thread_variable_p): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 05:37:21 +00:00
nobu b30a6b8d1d bignum.c: Bignum zero comparison
* bignum.c (rb_big_eq): test as Fixnum if possible and get rid of zero
  length Bignum.  [ruby-core:53893] [Bug #8204]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-03 07:34:31 +00:00
akr 6d0c59f156 * ext/-test-/num2int/num2int.c: Define utility methods
as module methods of Num2int.

* test/-ext-/num2int/test_num2int.rb: Follow the above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-02 10:26:02 +00:00
akr 662d67f13f Unused module removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-01 22:59:05 +00:00
akr 17cf784d78 conditional test fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-01 22:45:29 +00:00
akr e47f41fb9d more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-01 22:41:13 +00:00
akr d40335aa36 * ext/-test-/num2int/num2int.c: Rename utility methods
to global functions to ease manual experiments.

* test/-ext-/num2int/test_num2int.rb: Follow the above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-01 21:49:55 +00:00
akr 809a7618f0 * test/-ext-/num2int/test_num2int.rb: Test small bignums.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-01 12:22:56 +00:00
akr 0cbe2f4902 * ext/-test-/num2int/num2int.c: Return string for result, instead of
printing.

* test/-ext-/num2int/test_num2int.rb: updated to follow above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-01 11:58:55 +00:00
akr a7526797a6 * include/ruby/ruby.h (FIX2ULONG): Make it consistent with NUM2ULONG.
* ext/-test-/num2int/num2int.c: Add utility methods for FIX2XXX tests.

* test/-ext-/num2int/test_num2int.rb: Add tests for FIX2XXX.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-31 16:14:15 +00:00
akr 31af17963d more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-31 07:51:35 +00:00
akr 59182ccf69 * numeric.c (rb_num2ulong_internal): New function similart to
rb_num2ulong but integer wrap around flag is also returned.
  (rb_num2ulong): Use rb_num2ulong_internal.
  (rb_num2uint): Use rb_num2ulong_internal and the wrap around flag is
  used instead of negative_int_p(val).
  (rb_num2ushort): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-31 04:51:29 +00:00
akr 29e5699992 * test/-ext-/num2int/test_num2int.rb: extract
assert_num2i_success_internal and assert_num2i_error_internal and
  provide assertion messages as "NUM2XXX(NNN)".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-28 09:23:51 +00:00
kazu 45e866c18a fix typos
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-27 17:13:57 +00:00
akr 83f1be1bc3 * numeric.c (LONG_MIN_MINUS_ONE_IS_LESS_THAN): New macro.
(LLONG_MIN_MINUS_ONE_IS_LESS_THAN): Ditto.
  (rb_num2long): Use LONG_MIN_MINUS_ONE_IS_LESS_THAN.
  (rb_num2ulong): Ditto.
  (rb_num2ll): Use LLONG_MIN_MINUS_ONE_IS_LESS_THAN.
  (rb_num2ull): Ditto.

* test/-ext-/num2int/test_num2int.rb (asert_num2i_success): Test the
  value converted into a Float if Float can represent the value
  exactly.
  (asert_num2i_error): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-27 13:12:27 +00:00
akr 7379116878 * test/-ext-/num2int/test_num2int.rb (asert_num2i_success): New
utility method.
  (asert_num2i_error): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-27 12:01:40 +00:00
akr bb945c3722 * test/-ext-/num2int/test_num2int.rb (test_num2ll): test LLONG_MIN,
not LONG_MIN.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-27 03:08:25 +00:00
naruse e525bcd1b3 Add test for [Backport #7896] [ruby-core:52607]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21 08:31:47 +00:00
nobu 98932f5150 eval.c: preserve errinfo
* eval.c (rb_ensure): preserve errinfo accross ensure proc before
  JUMP_TAG().  [ruby-core:52022] [Bug #7802]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-08 07:09:48 +00:00
ko1 18e01f6381 * vm_backtrace.c: fix issue of rb_debug_inspector_open().
The order of making binding should be stack (frame) top to bottom.
  [Bug #7635]
  And also fix issue of collecting klass. Collecting klass is same
  as TracePoint#defined_class.
  (previous version, it returns T_ICLASS (internal objects).
* test/-ext-/debug/test_debug.rb: add a test.
* ext/-test-/debug/extconf.rb, init.c, inspector.c: ditto.
* vm_backtrace.c: remove magic number and add enum CALLER_BINDING_*.
* vm_backtrace.c, include/ruby/debug.h: add new C api (experimental)
  rb_debug_inspector_frame_self_get().
* vm.c, vm_core.h, vm_trace.c: move decl. of
  rb_vm_control_frame_id_and_class() and constify first parameter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29 08:25:32 +00:00
nobu b0c4ac7779 proc.c: original arity
* proc.c (rb_mod_method_arity): return original arity of the method if
  aliased because of visibility change, like as Method#arity.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29 07:49:22 +00:00
shirosaki 262cb379d6 st_update passes the key in st_table
* st.c (st_update): pass the key in st_table so that we can free
  memory of the key in st_table when deleting.
  [ruby-core:49220] [Bug #7330]

* test/-ext-/st/test_update.rb
  (Bug::StTable#test_pass_objects_in_st_table): add a test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 02:46:13 +00:00
nobu f230b1ec98 test_printf.rb: need to be infected
* test/-ext-/test_printf.rb (Test_SPrintf#test_{taint,untrust}): use
  plain object so that the results of to_s and inspect are infected.
  [ruby-dev:46053] [Bug #6881]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-16 02:52:09 +00:00
nobu 665b06ec5b sprintf.c: infect
* sprintf.c (ruby__sfvextra): the result should be infected by the
  given strings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-15 07:26:55 +00:00
nobu bb545e2131 sprintf.c: coderange fix
* sprintf.c (ruby__sfvwrite): set buffer length and exclude
  uninitialized garbage to get correct coderange.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-15 07:23:38 +00:00
ktsj 9564e9bd23 * vm.c (invoke_block_from_c): fix unintentional block passing.
[ruby-dev:45071] [Bug #5832]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-12 03:04:42 +00:00
nobu 81a0c608eb compatible loader
* marshal.c (r_object0): also load TYPE_USRMARSHAL, TYPE_DATA using
  compatible loader.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 02:40:30 +00:00
naruse d054eb9631 Add a test for r35863.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 13:44:02 +00:00
nobu 26f96fe1ce * test/-ext-/test_printf.rb: tests for [Feature #5896].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25 02:20:36 +00:00
shirosaki 5ccee663e9 * include/ruby/win32.h (FD_SET): change function to macro.
To avoid buffer overflow when smaller FD_SETSISE is used in ext
  libraries.

* win32/win32.c (rb_w32_fdset): this function is not used anymore.
  But we leave this for compatibility.

* win32/win32.c (rb_w32_select_with_thread): fix SEGV when smaller
  FD_SETSISE is used in ext libraries. Dereference of fd_set pointer
  causes SEGV.

* test/-ext-/win32/test_fd_setsize.rb(TestFdSetSize): add tests for
  above.
* ext/-test-/win32/fd_setsize/depend: ditto.
* ext/-test-/win32/fd_setsize/extconf.rb: ditto.
* ext/-test-/win32/fd_setsize/fd_setsize.c: ditto.

  [ruby-core:44588] [Bug #6352]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-08 12:47:25 +00:00
naruse 77321aeed9 win32/dln is only for win32.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-17 11:14:24 +00:00
nobu dad31f6e50 * dln.c (rb_w32_check_imported): skip ordinal entries. based on a
patch by phasis68 (Heesob Park) at [ruby-core:44381].
  [ruby-core:44371][Bug #6303]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-17 04:11:17 +00:00
nobu f45fc7daa0 * error.c (rb_enc_raise): new function to raise an exception with
the message in the given encoding.  patched by now (Nikolai
  Weibull) at [ruby-core:41160].  [Feature #5650]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-10 10:07:07 +00:00
nobu 30cea65767 * st.c (st_update): add existing parameter to the callback function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-29 07:36:12 +00:00
nobu f4aff7feb1 num2ll and num2ull
* ext/-test-/num2int/num2int.c (print_num2ll, print_num2ull): define
  only if long long is available, and use long long printf modifier
  checked by configure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-18 15:21:04 +00:00
nobu a73d958c33 * st.c: add st_foreach_check for fixing iteration over packed table
and st_delete_safe.  patched by Sokolov Yura at
  https://github.com/ruby/ruby/pull/84


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-10 14:52:19 +00:00
nobu efae619458 * st.c: fix packed num_entries on delete_safe. patched by Sokolov
Yura at https://github.com/ruby/ruby/pull/84


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-10 14:52:06 +00:00
nobu 5ee0135a2f * test/ruby/envutil.rb (assert_no_memory_leak): new assertion to
check memory leak by invoking child ruby process and watch its
  memory size.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-09 15:47:11 +00:00
nobu fc018c9b34 * test/-ext-/string/test_modify_expand.rb: test for r34492.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-08 13:35:27 +00:00
nobu cf1a22fdf9 * st.c (st_update): table can be unpacked in the callback.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07 05:52:15 +00:00
nobu 97c3c98762 * st.c (st_foreach): should not yield same pair when checking
after unpacking.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07 05:29:20 +00:00
nobu 04726dd749 * vm.c (rb_iter_break_value): new function to break a block with
the value.  [ruby-dev:45132] [Feature #5895]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-24 05:20:48 +00:00
ayumin 0713603b6f * test/-ext-/old_thread_select/test_old_thread_select.rb:
avoid platform bug. [Bug #5858] [ruby-dev:45108]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-07 16:22:47 +00:00
nobu 2f6d8bdc94 * st.c (st_update): new function to lookup the given key and
update the value.  [ruby-dev:44998]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-27 13:04:30 +00:00
kazu 327ea26b59 * ext/bigdecimal/README: Update redmine.ruby-lang.org to bugs.ruby-lang.org
* ext/socket/ancdata.c: ditto
* test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb: ditto
* test/syck/test_yaml.rb: ditto
* doc/ChangeLog-1.9.3: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-20 16:09:17 +00:00
nobu 9dccfb5513 * error.c (rb_check_typeddata): refine error message with
including expected struct name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15 05:33:34 +00:00
naruse aa432d2334 FreeBSD 9.0 RC3 is now released.
See also r33677, r33967, and r33973.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-14 00:28:26 +00:00
naruse 09c399b68e It is fixed in FreeBSD 9.0 RC3, not RC2.
So skip until it is released.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-07 22:13:04 +00:00
naruse 1b99ecc5a2 FreeBSD 9.0 RC2 fixes the bug.
FreeBSD PR: kern/155606, kern/162379

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-07 00:32:37 +00:00
naruse f6f4534382 * variable.c (rb_path2class): don't raise NameError when the middle
constant of the path is not defined but defined on toplevel.
  [ruby-core:41410] [Bug #5691]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-30 14:44:06 +00:00
kosaki ed681d3a82 * bignum.c (rb_big2ull): fix 32bit platform breakage. we must
not assume sizeof(VALUE) == sizeof(LONG_LONG).
* test/-ext-/num2int/test_num2int.rb (class TestNum2int):
  fix false assumption on 32bit platform.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 05:56:09 +00:00
kosaki b2a2ba1191 * include/ruby/ruby.h: add NUM2SHORT(), NUM2USHORT() macros.
* numeric.c: ditto.

* test/-ext-/num2int/test_num2int.rb: add testcases for NUM2SHORT().
* ext/-test-/num2int/num2int.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 03:54:34 +00:00
kosaki d3437b7c1a * bignum.c (rb_big2ull): fix off-by-twice bug of NUM2ULL.
* test/-ext-/num2int/test_num2int.rb (class TestNum2int):
  fix a testcase too.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 03:51:56 +00:00
kosaki 11137bed53 * test/-ext-/num2int/test_num2int.rb (class TestNum2int):
add FIXNUM tests.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 03:47:21 +00:00
kosaki 74a13c7634 * numeric.c (check_uint): fix off-by-one bug of NUM2UINT.
* bignum.c (rb_big2ulong): fix off-by-one bug of NUM2ULONG.

* test/-ext-/num2int/test_num2int.rb: add a testcase for NUM2INT()
  NUM2UINT(), NUM2LONG(), NUM2ULONG(), NUM2LL and NUM2ULL().
* ext/-test-/num2int/depend: ditto.
* ext/-test-/num2int/extconf.rb: ditto.
* ext/-test-/num2int/num2int.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 03:45:47 +00:00
naruse 3d855def9e FreeBSD 8.2 sticks this [ruby-dev:44726] [Bug #5524]
http://redmine.ruby-lang.org/issues/5524

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-08 17:13:03 +00:00
naruse 632f448827 On some platforms, object_id can be negative value like NetBSD.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01 00:42:41 +00:00
nobu 72cbec3f6d * util.c (mmprepare): fix for fragmental size.
* util.c (mmswap_, mmrot3_): portability improvement.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-20 02:42:26 +00:00
nobu d5e7b3972c * test/-ext-/symbol/test_inadvertent_creation.rb (noninterned_name):
sigil of global, instance and class variable names should be
  followed by non-numeric.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-07 11:29:37 +00:00
nobu 881891fb2f * test/-ext-/symbol/test_inadvertent_creation.rb: moved tests from
test_module.rb and test_symbol.rb.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-07 08:57:42 +00:00
nobu 89fef02f13 * vm_eval.c (make_no_method_execption): extract from
raise_method_missing().
* vm_eval.c (send_internal): remove inadvertent symbol creation
  from public_send.  based on a patch by Jeremy Evans <code AT
  jeremyevans.net> in [ruby-core:38576]. [Feature #5112]
* vm_insnhelper.c (vm_call_method): remove inadvertent symbol
  creation from send and __send__, too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06 07:29:33 +00:00
kosaki d4db53a0e0 * test/-ext-/old_thread_select/test_old_thread_select.rb:
select() with timeout may return early in old Linux kernels
  with 250 Hz tickrate and no dynticks, so skip everything older
  than 2.6.32 (which has long term support).
  And, Make the timing assertions consistently use assert_operator with
  timing difference in error message
  Patch by Eric Wong. [Bug #5335] [ruby-core:39618]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-19 09:47:27 +00:00
kosaki 2c9375ba69 * thread.c (rb_thread_select): fix to ignore an argument
modification of rb_thread_fd_select().
  based on a patch by Eric Wong. [Bug #5306] [ruby-core:39435]
* thread.c (rb_fd_rcopy): New. for reverse fd copy.

* test/-ext-/old_thread_select/test_old_thread_select.rb
(test_old_select_false_positive): test for bug5306.

* ext/-test-/old_thread_select/old_thread_select.c (fdset2array):
  New. convert fdsets to array.
* ext/-test-/old_thread_select/old_thread_select.c (old_thread_select):
  return 'read', 'write', 'except' argument of rb_thread_select()
  to ruby script.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-12 11:36:06 +00:00
nobu 61b062ba6d * thread.c (rb_thread_select): fix a typo to initialize efds
properly.  [Bug #5299] [ruby-core:39380]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-09 01:22:06 +00:00
naruse 90c33c2198 Use assert_operator to show clear message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-06 08:11:21 +00:00
usa 13a77870de * test/-ext-/old_thread_select/test_old_thread_select.rb
(TestOldThreadSelect#test_old_select_read_timeout): if the machine
  is fast enough, the time used by code around IO.select may be smaller
  than Time implement threshold.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-30 15:34:54 +00:00
usa 34e65bee79 * ext/-test-/old_thread_select/old_thread_select.c (old_thread_select):
typo.

* test/-ext-/old_thread_select/test_old_thread_select.rb
  (TestOldThreadSelect#test_old_select_signal_safe): use SIGINT instead
  of SIGUSR1 because the former is general and the latter is platform
  dependent.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-30 15:07:21 +00:00
kosaki 0cebfad20a * thread.c (rb_thread_select): rewrite by using
rb_thread_fd_select(). old one is EINTR unsafe.
  Patch by Eric Wong. [Bug #5229] [ruby-core:39102]

* test/-ext-/old_thread_select/test_old_thread_select.rb:
  a testcase for rb_thread_select().
* ext/-test-/old_thread_select/old_thread_select.c: ditto.
* ext/-test-/old_thread_select/depend: ditto.
* ext/-test-/old_thread_select/extconf.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-30 00:33:05 +00:00
usa f9e9eee677 * util.c, include/ruby/util.h (ruby_add_suffix): remove the function.
[Bug #5153] [ruby-core:38736]

* io.c (argf_next_argv): remove the call of above function.

* ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test
  extension module because this is only for testsing ruby_add_suffix().

* LEGAL: remove the mention about a part of util.c, because now we
  removed the part.

* io.c (argf_next_argv): now the new filename is not guranteed to
  use, so should check the return value of rename(2).

* test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible):
  now we expect same result with other platforms on no_safe_rename
  platforms (=Windows).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-03 07:10:56 +00:00
nobu cfa0035962 * encoding.c (rb_enc_set_index, rb_enc_associate_index): should
check if frozen.
* parse.y (rb_intern3), ruby.c (process_options, ruby_script):
  defer freezing after associating encodings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-07 06:44:46 +00:00
kosaki c06da4735d * thread.c (rb_wait_for_single_fd): Fix wrong return value.
* test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb
(TestWaitForSingleFD#test_wait_for_closed_pipe): test for it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-04 10:02:06 +00:00
kosaki 2a989121db * ext/-test-/wait_for_single_fd: New. for testing
rb_wait_for_single_fd() internal function.
  The patch was written by Eric Wong. [ruby-core:35991]

* test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-04 09:50:27 +00:00
nobu 247fdeedf8 * include/ruby/ruby.h (rb_funcall_passing_block): add prototype.
a patch by James M. Lawrence at [ruby-core:35501]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-17 15:54:22 +00:00
nobu f989f7c7ea * string.c (rb_str_ellipsize): new function to ellipsize a string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30 04:01:58 +00:00
nobu 7a6113d6b6 * string.c (rb_string_value_cstr): rb_str_modify can change
RSTRING_PTR.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24 22:00:55 +00:00
nobu 5631792727 * ext/-test-/array/resize/resize.c (Init_resize): renamed method
for test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 20:47:01 +00:00
nobu c8aaf31fdd * array.c (rb_ary_resize): new utility function. [ruby-dev:42912]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 20:10:59 +00:00
nobu 697a45b196 * dln.c (init_funcname_len): ignore rest from first dot.
[ruby-dev:41774]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 20:03:28 +00:00
nobu fd0485acf7 * vm_eval.c (vm_call0): fix for VM_METHOD_TYPE_NOTIMPLEMENTED.
[ruby-dev:41953]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-07 04:33:33 +00:00
nobu 8965ed167d * string.c (rb_str_set_len): should fail to modify shared string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-05 07:42:47 +00:00
nobu 5f13d888cf * string.c (rb_str_resize): reverted r28851. rb_str_resize cannot
work before the length is set.  [ruby-core:31615]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-04 11:08:28 +00:00
nobu 99d96a89ce * string.c (rb_str_resize): should copy the content properly. a
patch from Jeremy Evans at [ruby-core:31615].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-04 07:09:47 +00:00
nobu 7ae7ac4aba * util.c (ruby_add_suffix): fixed a bug returning uninitialized
value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-29 22:59:54 +00:00
nobu 0f36e8fc03 * eval.c (frame_func_id), vm_eval.c (rb_iterate),
vm_insnhelper.c (vm_yield_with_cfunc): as the name of a C-level
  block, use the current method ID at the creation point.
  [ruby-dev:41852]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-14 11:23:10 +00:00