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

1135 Коммитов

Автор SHA1 Сообщение Дата
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
nobu 90c1ebbfd5 compar.c: fail if recursion
* compar.c (cmp_eq): fail if recursion.  [ruby-core:57736] [Bug #9003]
* thread.c (rb_exec_recursive_paired_outer): new function which is
  combinnation of paired and outer variants.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09 04:53:18 +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
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 774bff0adb * include/ruby/debug.h: add backtrace collecting APIs for profiler.
* int rb_profile_frames(int start, int limit, VALUE *buff, int *lines);
  Collect information of frame information.
* VALUE rb_profile_frame_path(VALUE frame);
* VALUE rb_profile_frame_absolute_path(VALUE frame);
* VALUE rb_profile_frame_label(VALUE frame);
* VALUE rb_profile_frame_base_label(VALUE frame);
* VALUE rb_profile_frame_first_lineno(VALUE frame);
* VALUE rb_profile_frame_classpath(VALUE frame);
* VALUE rb_profile_frame_singleton_method_p(VALUE frame);
  Get information about each frame.
  These APIs are designed for profilers, for example, no objectallocation,
  and enough information for profilers.
  In this version, this API collects only collect Ruby level frames.
  This issue will be fixed after Ruby 2.1.
* vm_backtrace.c: implement above APIs.
* iseq.c (rb_iseq_klass): return local_iseq's class.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07 07:21:11 +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 fa4c213397 ruby.h: export ruby_safe_level_4_warning
* include/ruby/ruby.h (ruby_safe_level_4_warning): needed by extension
  libraries which check safe level 4.  [ruby-dev:47517] [Bug #8652]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-01 07:03:50 +00:00
ko1 dc626dbab3 * include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().
RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and
  usecase of this macro is not acquire raw pointer, but acquire
  read-only pointer. So we rename to better name.
  RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR()
  (I expect that nobody use it).
* array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c,
  string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c:
  catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-25 08:24:34 +00:00
nobu d700d34043 internal.h: move inline functions
* internal.h (rb_float_value, rb_float_new): move inline functions
  from ruby/ruby.h.
* numeric.c (rb_float_value, rb_float_new): define external functions
  for extension libraries.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-25 07:58:49 +00:00
nobu f5f0b869e9 intern.h: move rb_ary_cat from internal.h
* include/ruby/intern.h (rb_ary_cat): move from internal.h, since it
  is described in README.EXT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-22 20:07:51 +00:00
ko1 1e27eda2fa * include/ruby/ruby.h: make Symbol objects frozen.
[Feature #8906]
  I want to freeze this good day, too.
* test/ruby/test_eval.rb: catch up this change.
* test/ruby/test_symbol.rb: add a test to check frozen symbols.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-19 05:30:02 +00:00
glass e334bb2ce5 * common.mk: use RUNRUBY instead of MINIRUBY because MINIRUBY can't
require extension libraries. The patch is from nobu
  (Nobuyoshi Nakada).

* ext/thread/extconf.rb: for build ext/thread/thread.c.

* include/ruby/intern.h: ditto.

* thread.c: ditto.

* lib/thread.rb: removed and replaced by ext/thread/thread.c.

* ext/thread/thread.c: Queue, SizedQueue and ConditionVariable
  implementations in C. This patch is based on patches from panaggio
  (Ricardo Panaggio) and funny_falcon (Yura Sokolov) and  ko1
  (Koichi Sasada). [ruby-core:31513] [Feature #3620]

* test/thread/test_queue.rb (test_queue_thread_raise): add a test for
  ensuring that killed thread should be removed from waiting threads.
  It is based on a code by ko1 (Koichi Sasada). [ruby-core:45950]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-06 15:15:07 +00:00
nobu f245f0c664 win32.c: clock_getres
* win32/win32.c (clock_getres): required as well as clock_gettime().
  [ruby-dev:47699] [Bug #8869]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-06 05:23:28 +00:00
nobu 7ce11f57ed transcode.c: add rb_econv_append
* transcode.c (rb_econv_append): new function to append a string data
  with converting its encoding.  split from rb_econv_substr_append.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-06 02:45:50 +00:00
charliesome 6fd9000076 * include/ruby/ruby.h: add RSTRING_FSTR flag
* internal.h: add rb_fstring() prototype
* parse.y (str_suffix_gen): deduplicate frozen string literals
* string.c (rb_fstring): deduplicate frozen string literals
* string.c (rb_str_free): delete fstrings from frozen_strings table when
  they are GC'd
* string.c (Init_String): initialize frozen_strings table
* test/ruby/test_string.rb: test frozen strings are deduplicated

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-05 04:49:16 +00:00
nobu 5669902126 string.c: rb_enc_str_new_cstr
* string.c (rb_enc_str_new_cstr): new function to create a string from
  the C-string pointer with the specified encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03 13:03:54 +00:00
nobu 6908e4960d encoding.h: fix conflicts
* include/ruby/encoding.h (rb_{ascii8bit,utf8,usascii}_encindex): get
  rid of conflict with macros defined in internal.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-30 15:25:26 +00:00
ko1 5da55dfcb4 * struct.c (rb_struct_define_without_accessor_under): added.
This function is similar to rb_define_class_under() against
  rb_define_class().
* include/ruby/intern.h: add a declaration of this function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-29 09:12:25 +00:00
nobu 92d7cdc29a vm_eval.c: constify
* vm_eval.c (rb_check_funcall, rb_check_funcall_with_hook): constify
  argv.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27 07:08:32 +00:00
akr dbef5ecd7a * include/ruby/defines.h: Fix a compilation error with
i586-mingw32msvc-gcc of gcc-mingw32 package on Debian squeeze.
  ruby/missing.h should be included before include/ruby/win32.h
  because struct timespec, used in the clock_gettime declaration in
  include/ruby/win32.h, is defined in ruby/missing.h instead of
  system headers.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-19 12:39:09 +00:00
usa 5a096eddb3 * include/ruby/win32.h (CLOCK_MONOTONIC): typo.
* win32/win32.c: removed duplicated declarations.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-19 04:29:41 +00:00
usa 866cee6162 * include/ruby/win32.h, win32/Makefile.sub, win32/win32.c
(clock_gettime): [experimental] emulates clock_gettime(2) of posix.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-15 05:32:02 +00:00
charliesome dc548ba04e * include/ruby/encoding.h: Reduce ENCODING_INLINE_MAX to 127 as this
should be sufficient to represent all the encodings Ruby supports.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-11 04:23:12 +00:00
ko1 3aea31c101 * include/ruby/ruby.h: define USE_RGENGC_LOGGING_WB_UNPROTECT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08 10:56:52 +00:00
ko1 c9d01961f1 * include/ruby/ruby.h: add old macro name `RUBY_EVENT_SWITCH'.
This macro name is obsolete because it is renamed to
  RUBY_INTERNAL_EVENT_SWITCH, but it has compatibility problem
  using this macro name like ruby-prof.
  I want to remove this macro after ruby 2.1.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08 07:50:55 +00:00
nobu d1ede0c12b proc.c: constifiy
* proc.c (rb_proc_call_with_block): constifiy argv.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08 05:48:52 +00:00
charliesome ac93b28403 * include/ruby/encoding.h: document which user flags are used by
ENCODING_MASK for better greppability

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-05 02:51:58 +00:00
nobu 042e5013a3 struct.c: rb_struct_define_under
* struct.c (rb_struct_define_under): new function to define Struct
  under the given namespace, not under Struct.  [Feature #8264]
* ext/etc/etc.c: use rb_struct_define_under.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-03 00:31:02 +00:00
mrkn e06407cf7d * rational.c (rb_flt_rationalize_with_prec): new public C function
to rationalize a Float instance with a precision.

* rational.c (rb_flt_rationalize): new public C function to
 rationalize a Float instance.  A precision is calculated from
 the given float number.

* include/ruby/intern.h: Add rb_flt_rationalize_with_prec and
  rb_flt_rationalize.

* parse.y: implement number literal suffixes, 'r' and 'i'.
  [ruby-core:55096] [Feature #8430]

* bootstraptest/test_literal_suffix.rb: add tests for parser to scan
  number literals with the above tsuffixes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-01 14:58:54 +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
akr 8fd992d71d * include/ruby/intern.h (rb_integer_pack): Declaration moved from
internal.h.
  (rb_integer_unpack): Ditto.
  [ruby-core:42813] [Feature #6065]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-27 15:11:03 +00:00
nobu 8948280c67 load.c: search in OS path encoding
* load.c (rb_load_internal): use rb_load_file_str() to keep path
  encoding.
* load.c (rb_require_safe): search in OS path encoding for Windows.
* ruby.c (rb_load_file_str): load file with keeping path encoding.
* win32/file.c (rb_file_load_ok): use WCHAR type API assuming incoming
  path is encoded in UTF-8.  [ruby-core:56136] [Bug #8676]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-26 04:04:23 +00:00
naruse 14dfb46b5f * include/ruby/ruby.h: check defined(USE_RGENGC_LOGGING_WB_UNPROTECT)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25 16:38:49 +00:00
ko1 33ebcb0538 * array.c, gc.c: move ary_unprotect_logging() into
rb_gc_unprotect_logging() which is general version
* include/ruby/ruby.h: add USE_RGENGC_LOGGING_WB_UNPROTECT
  to enable.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-24 09:42:43 +00:00
nobu 241ad8877d encoding.c: add rb_enc_code_to_mbclen
* encoding.c (rb_enc_code_to_mbclen): add new function which returns
  mbclen from codepoint like as rb_enc_codelen() but 0 for invalid
  char.
* include/ruby/encoding.h (rb_enc_code_to_mbclen): declaration and
  shortcut macro.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-20 03:13:40 +00:00
nobu 862bad2d2a ruby.h: error only in the core
* include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): make only
  rb_set_safe_level(4) an error always but make rb_secure(4) an error
  only in the core.  [ruby-dev:47517] [Bug #8652]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-18 06:45:50 +00:00
ko1 6795b09fb9 * include/ruby/ruby.h: fix spell miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-18 06:42:28 +00:00
nobu 0ef059b217 ruby.h: no $
* include/ruby/ruby.h (ruby_safe_level_4): get rid of special
  character.  [ruby-dev:47512] [misc #8646]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-18 06:11:16 +00:00
akr f44eeda928 * include/ruby/st.h (st_strcasecmp): Macro defined for compatibility.
(st_strncasecmp): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17 03:31:44 +00:00
akr 8795574510 * st.c (st_locale_insensitive_strcasecmp): Renamed from st_strcasecmp.
(st_locale_insensitive_strncasecmp): Renamed from st_strncasecmp.

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

* include/ruby/ruby.h: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16 23:15:41 +00:00
glass 13a1fd6d82 * configure.in: revert r42008. strcasecmp() uses the current locale.
* include/ruby/ruby.h: ditto.

* st.c (st_strcasecmp): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16 12:49:01 +00:00
glass a0d9bd4445 * configure.in: check strcasecmp().
* include/ruby/ruby.h: use strcasecmp() as st_strcasecmp() if it
  exists.

* st.c (st_strcasecmp): define the function only if strcasecmp()
  doesn't exist.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16 12:13:19 +00:00
akr 46360975a4 * include/ruby/intern.h (rb_big2str0): Deprecated.
* bignum.c (rb_big2str1): Renamed from rb_big2str0.
  (rb_big2str0): Deprecated wrapper for rb_big2str1.
  (rb_big2str): Invoke rb_big2str1 instead of rb_big2str0.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-15 05:42:22 +00:00
nobu d52844380a string.c: rb_str_subpos
* string.c (rb_str_subpos): make public function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-10 14:12:04 +00:00
naruse 9ae509504b Revert r41786 "broken utf-8"
revert unexpected commit

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-09 07:38:15 +00:00
nobu 3d7fa44b05 win32.c: for strict ANSI
* win32/win32.c (rb_w32_pow): move from win32.h and disable strict
  ANSI mode macro to let _controlfp() stuff defined.
  [ruby-core:55312] [Bug #8495]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-08 14:13:13 +00:00
naruse ed37bfcc9d broken utf-8
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-05 00:54:11 +00:00
naruse d39f196401 * regcomp.c (): Merge Onigmo 5.13.5 23b523076d6f1161.
https://bugs.ruby-lang.org/issues/8583

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-04 01:16:22 +00:00
nobu aa1acf1d42 encoding.c: validate index
* encoding.c (rb_enc_set_index, rb_enc_associate_index): validate
  argument encoding index.
* include/ruby/encoding.h (ENCODING_SET): use rb_enc_set_index()
  instead of setting inlined bits directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02 08:22:19 +00:00
nobu dc0b06aa38 win32.c: UTF-8 spawn
* win32/win32.c (w32_spawn): extract codepage aware code from
  rb_w32_spawn().
* win32/win32.c (rb_w32_uspawn): add UTF-8 version function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-30 01:59:07 +00:00
nobu 64d39448d3 win32.c: UTF-8 aspawn
* win32/win32.c (w32_aspawn_flags): extract codepage aware code from
  rb_w32_aspawn_flags().
* win32/win32.c (rb_w32_uaspawn_flags, rb_w32_uaspawn_flags): add
  UTF-8 version functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-30 01:59:03 +00:00
nobu 7cc4b8097c intern.h: rb_enumeratorize_with_size with cast
* include/ruby/intern.h (rb_enumeratorize_with_size): cast for
  backward compatibility.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26 13:44:03 +00:00
nobu 5e2f227d21 intern.h: define rb_enumerator_size_func
* include/ruby/intern.h (rb_enumerator_size_func): define strict
  function declaration for rb_enumeratorize_with_size().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26 13:43:22 +00:00
akr ad6d79e7cb * include/ruby/defines.h (BDIGIT): Define it only if it is not defined
yet.  This eases tests and debug.
  (SIZEOF_BDIGITS): Ditto.
  (BDIGIT_DBL): Ditto.
  (BDIGIT_DBL_SIGNED): Ditto.
  (PRI_BDIGIT_PREFIX): Ditto.
  (PRI_BDIGIT_DBL_PREFIX): Ditto.
  (PRIdBDIGIT): Define it only if PRI_BDIGIT_PREFIX is defined.
  (PRIiBDIGIT): Ditto.
  (PRIoBDIGIT): Ditto.
  (PRIuBDIGIT): Ditto.
  (PRIxBDIGIT): Ditto.
  (PRIXBDIGIT): Ditto.
  (PRIdBDIGIT_DBL): Ditto.
  (PRIiBDIGIT_DBL): Ditto.
  (PRIoBDIGIT_DBL): Ditto.
  (PRIuBDIGIT_DBL): Ditto.
  (PRIxBDIGIT_DBL): Ditto.
  (PRIXBDIGIT_DBL): Ditto.

* include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Define it only if it is
  not defined yet.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-23 14:10:07 +00:00
ko1 982fee4fcc * include/ruby/ruby.h, gc.c: rename macros and functions:
OBJ_WB_GIVEUP() -> OBJ_WB_UNPROTECT(),
  rb_obj_wb_giveup() -> rb_obj_wb_unprotect(),
  rb_gc_giveup_promoted_writebarrier() ->
  rb_gc_writebarrier_unprotect_promoted(),
* class.c, eval.c, hash.c: use OBJ_WB_UNPROTECT().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22 21:54:10 +00:00
akr 4b4ba84eb8 * ext/dl/cfunc.c (rb_dlcfunc_call): Use rb_big_pack instead of
rb_big2ulong_pack and rb_big2ull.

* include/ruby/intern.h (rb_big2ulong_pack): Deprecated.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22 05:37:30 +00:00
ko1 4223f00713 * include/ruby/ruby.h (OBJ_WRITE): cast to (VALUE *) for second
parameter `slot'. You don't need to write a cast (VALUE *) any more.
* class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c,
  vm.c, vm_method.c: remove cast expressions for OBJ_WRITE().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 19:52:40 +00:00
ko1 508b255b9a * include/ruby/ruby.h: constify RArray::as::ary and RArray::heap::ptr.
Use RARRAY_ASET() or RARRAY_PTR_USE() to modify Array objects.
* array.c, gc.c: catch up above changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 11:53:33 +00:00
ko1 6a1101f23e * include/ruby/ruby.h: support write barrier protection for T_STRUCT.
Introduce the following C APIs:
  * RSTRUCT_RAWPTR(st) returns pointer (do WB on your risk).
    The type of returned pointer is (const VALUE *).
  * RSTRUCT_GET(st, idx) returns idx-th value of struct.
  * RSTRUCT_SET(st, idx, v) set idx-th value by v with WB.
  And
  * RSTRUCT_PTR(st) returns pointer with shady operation.
    The type of returned pointer is (VALUE *).
* struct.c, re.c, gc.c, marshal.c: rewrite with above APIs.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 11:22:18 +00:00
ko1 9296bd49da * include/ruby/ruby.h, re.c: support write barrier for T_REGEXP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 10:14:04 +00:00
ko1 9b47ec04a8 * include/ruby/ruby.h (struct rb_data_type_struct), gc.c: add
rb_data_type_struct::flags. Now, this flags is passed
  at T_DATA object creation. You can specify FL_WB_PROTECTED
  on this flag.
* iseq.c: making non-shady iseq objects.
* class.c, compile.c, proc.c, vm.c: add WB for iseq objects.
* vm_core.h, iseq.h: constify fields to detect WB insertion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19 06:26:01 +00:00
akr 1a6a65f16b * configure.in: Check __int128.
* include/ruby/defines.h (BDIGIT_DBL): Use uint128_t if it is available.
  (BDIGIT): Use uint64_t if uint128_t is available.
  (SIZEOF_BDIGITS): Defined for above case.
  (BDIGIT_DBL_SIGNED): Ditto.
  (PRI_BDIGIT_PREFIX): Ditto.

* include/ruby/ruby.h (PRI_64_PREFIX): Defined.

* bignum.c (rb_big_pow): Don't use BITSPERDIG for the condition which
  rb_big_pow returns Float or Bignum.

[ruby-dev:47413] [Feature #8509]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18 09:46:01 +00:00
ktsj 62bd8db198 * include/ruby/ruby.h, vm_eval.c (rb_funcall_with_block):
new function to invoke a method with a block passed
  as an argument.

* string.c (sym_call): use the above function to avoid
  a block sharing. [ruby-dev:47438] [Bug #8531]

* vm_insnhelper.c (vm_yield_with_cfunc): don't set block
  in the frame.

* test/ruby/test_symbol.rb (TestSymbol#test_block_given_to_proc):
  run related tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-17 12:47:26 +00:00
ktsj 1720a5bac4 * include/ruby/intern.h, proc.c (rb_method_call_with_block):
new function to invoke a Method object with a block passed
  as an argument.

* proc.c (bmcall): use the above function to avoid a block sharing.
  [ruby-core:54626] [Bug #8341]

* test/ruby/test_proc.rb (TestProc#test_block_persist_between_calls):
  run related tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-17 12:38:52 +00:00
ko1 87a120fbdc * class.c, include/ruby/ruby.h: add write barriers for T_CLASS,
T_MODULE, T_ICLASS.
* constant.h: constify rb_const_entry_t::value and file to detect
  assignment.
* variable.c, internal.h (rb_st_insert_id_and_value, rb_st_copy):
  added. update table with write barrier.
* method.h: constify some variables to detect assignment.
* object.c (init_copy): add WBs.
* variable.c: ditto.
* vm_method.c (rb_add_method): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-14 09:23:54 +00:00
nobu 19faee195a ruby.h: suppress warnings
* include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): suppress warnings
  "left-hand operand of comma expression has no effect", on gcc 4.4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-14 03:21:23 +00:00
nobu 3dbf227ed0 ruby.h: safe_level check
* include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): check constant safe
  level at compile time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13 05:51:14 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
mrkn 27e92c6649 * include/ruby/ruby.h: fix alignment in comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05 11:35:50 +00:00
charliesome 3264042eb9 add parentheses for clarity
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05 11:32:07 +00:00
nobu e71d501ee0 error.c: better names for rb_exc_new family
* error.c (rb_exc_new_cstr): rename from rb_exc_new2.
* error.c (rb_exc_new_str): rename from rb_exc_new3.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-01 02:16:25 +00:00
nobu d956526a76 string.c: remove old interfaces
* string.c (rb_str_new[2-5], rb_{tainted,usascii}_str_new2),
  (rb_str_buf_new2): remove old interfaces.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-01 01:13:21 +00:00
nobu 0544c09761 vm_eval.c: new names of rb_funcall family
* vm_eval.c (rb_funcallv): add better names of rb_funcall2.
* vm_eval.c (rb_funcallv_public): ditto for rb_funcall3.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-31 08:27:06 +00:00
nobu 1c5cdc62cc array.c: new names of rb_ary_new family
* array.c (rb_ary_new_capa): add better names of rb_ary_new2.
* array.c (rb_ary_new_from_args): ditto for rb_ary_new3.
* array.c (rb_ary_new_from_values): ditto for rb_ary_new4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-31 08:04:56 +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
akr 783cffce1d * include/ruby/ruby.h (RHASH_SIZE): Add a cast to suppress a
warning, comparison between signed and unsigned integer
  expressions [-Wsign-compare], on ILP32.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 13:11:06 +00:00
ko1 f0b6cb6fc7 * include/ruby/ruby.h: rename RUBY_INTERNAL_EVENT_FREE to
RUBY_INTERNAL_EVENT_FREEOBJ.
* ext/-test-/tracepoint/tracepoint.c,
  ext/objspace/object_tracing.c,
  gc.c, vm_trace.c: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 10:28:25 +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
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
ko1 a20a14727f * hash.c, include/ruby/ruby.h: support WB protected hash.
* constify RHash::ifnone and make new macro RHASH_SET_IFNONE().
* insert write barrier for st_update().
* include/ruby/intern.h: declare rb_hash_set_ifnone(hash, ifnone).
* marshal.c (r_object0): use RHASH_SET_IFNONE().
* ext/openssl/ossl_x509name.c (Init_ossl_x509name): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26 12:37:11 +00:00
charliesome de8cb828f5 * intern.h: remove dangling rb_class_init_copy declaration
[ruby-core:55120] [Bug #8434]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-24 08:07:01 +00:00
ktsj edb98f8b91 fix typos. Patch by k_takata.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 03:10:21 +00:00
nobu 9c0ff0c1c8 configure.in: setjmpex
* configure.in (setjmp-type): check if setjmpex() is really available.
  workaround for i686-w64-mingw32 which declares it but lacks its
  definition.
* include/ruby/defines.h: include setjmpex.h only if also setjmpex()
  is available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 16:40:10 +00:00
nobu 344db69c45 configure.in: setjmpex
* configure.in (setjmp-type): use setjmpex() on w64-mingw32 to get rid
  of -Wclobbered warnings.
* include/ruby/defines.h: include setjmpex.h here becase setjmp.h is
  included from win32.h via intrin.h, winnt.h, and so on.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 14:57:59 +00:00
nobu baa65ad108 gc.c: rb_gc_guarded_ptr
* gc.c (rb_gc_guarded_ptr): unoptimize on other compilers than gcc and
  msvc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-17 08:35:26 +00:00
nobu d70a806a17 ruby.h: fix typo
* include/ruby/ruby.h (ruby_check_sizeof_long_long): fix typo of
  availablity macro.  [ruby-dev:47341]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-14 14:27:25 +00:00
nobu cd9165458b iphlpapi is unavailable with older VC
* include/ruby/win32.h, win32/Makefile.sub, win32/win32.c: iphlpapi is
  not available with older Visual C.  works with VC9 or later at least.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-14 08:24:58 +00:00
nobu f83c42d970 win32.h: fix for VC9
* include/ruby/win32.h (INTPTR_MAX, INTPTR_MIN, UINTPTR_MAX): split
  from intptr_t and uintptr_t, since VC9 defines the latters only in
  crtdefs.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-14 05:52:06 +00:00
ko1 b8c0ff86d5 * include/ruby/ruby.h: enable to generate write barrier protected
arrays (T_ARRAY).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:23:35 +00:00
ko1 5016b37ae4 * include/ruby/ruby.h: enable to generate write barrier protected
objects (T_STRING).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:22:17 +00:00
ko1 305382bd69 * include/ruby/ruby.h: enable to generate write barrier protected
objects (T_OBJECT).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:21:32 +00:00
ko1 1829147fb5 * include/ruby/ruby.h: enable to generate write barrier protected
objects for numeric types (Float, Complex, Rational, Bignum).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:19:30 +00:00
ko1 9b6b3672cc * include/ruby/ruby.h: enable RGENGC (USE_RGENGC)
but no type creates write protected (sunny) objects
  (RGENGC_WB_PROTECTED_* == 0).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:14:01 +00:00
ko1 4f401816ff * gc.c: support RGENGC. [ruby-trunk - Feature #8339]
See this ticet about RGENGC.
* gc.c: Add several flags:
* RGENGC_DEBUG: if >0, then prints debug information.
* RGENGC_CHECK_MODE: if >0, add assertions.
* RGENGC_PROFILE: if >0, add profiling features.
  check GC.stat and GC::Profiler.
* include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0).
* array.c: add write barriers for T_ARRAY and generate sunny objects.
* include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if
  you want to access raw pointers. If you modify the contents which
  pointer pointed, then you need to care write barrier.
* bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects.
* complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX
  and generate sunny objects.
* rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write
  barriers for T_RATIONAL and generate sunny objects.
* internal.h: add write barriers for RBasic::klass.
* numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects.
* object.c (rb_class_allocate_instance), range.c:
  generate sunny T_OBJECT objects.
* string.c: add write barriers for T_STRING and generate sunny objects.
* variable.c: add write barriers for ivars.
* vm_insnhelper.c (vm_setivar): ditto.
* include/ruby/ruby.h, debug.c: use two flags
  FL_WB_PROTECTED and FL_OLDGEN.
* node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED):
  move flag bits.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:07:47 +00:00
ko1 89e6910f04 * include/ruby/ruby.h: constify RRational::(num,den) and
RComplex::(real,imag).
  Add macro to set these values:
* RRATIONAL_SET_NUM()
* RRATIONAL_SET_DEN()
* RCOMPLEX_SET_REAL()
* RCOMPLEX_SET_IMAG()
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
  TODO: API design. RRATIONAL_SET(rat,num,den) is enough?
  TODO: Setting constify variable with cast has same issue of r40691.
* complex.c, rational.c: use above macros.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 15:55:09 +00:00
eregon 8ccd658e54 * include/ruby/ruby.h: fix a typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 14:41:08 +00:00
usa cb3fcdcdc3 * win32/win32.c, include/ruby/win32.h (getipaddrs): [experimental]
emulate getipaddrs(3) on Unix.

* win32/Makefile.sub, configure.in (LIBS): need iphlpapi.lib for above
  function.

* include/ruby/win32.h (socketpair): rb_w32_socketpair() doesn't
  substitute for any function, so use non-prefixed name.

* ext/socket/extconf.rb (socketpair); follow above change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 11:29:32 +00:00
ko1 83aba04862 * include/ruby/ruby.h: constify RBasic::klass and add
RBASIC_CLASS(obj) macro which returns a class of `obj'.
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
  This function reveal interal (hidden) object by rb_obj_hide().
  Note that do not change class before and after hiding.
  Only permitted example is:
  klass = RBASIC_CLASS(obj);
  rb_obj_hide(obj);
  ....
  rb_obj_reveal(obj, klass);
  TODO: API design. rb_obj_reveal() should be replaced with others.
  TODO: modify constified variables using cast may be harmful for
  compiler's analysis and optimizaton.
  Any idea to prohibt inserting RBasic::klass directly?
  If rename RBasic::klass and force to use RBASIC_CLASS(obj),
  then all codes such as `RBASIC(obj)->klass' will be
  compilation error. Is it acceptable? (We have similar
  experience at Ruby 1.9,
  for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
  object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
  without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
  file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
  parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
  string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
  Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
  ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 10:49:11 +00:00
ko1 12bf73637b * include/ruby/ruby.h: add new utility macros to access
Array's element.
* RARRAY_AREF(a, i) returns i-th element of an array `a'
* RARRAY_ASET(a, i, v) set i-th element of `a' to `v'
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:41:48 +00:00
ko1 b6b85f6eaf * object.c (rb_obj_setup): added.
* include/ruby/ruby.h (OBJSETUP): ues rb_obj_setup() instead of
  a macro.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 06:33:48 +00:00
nobu d2b4011a94 ruby.h: OFFT2NUM redefinition
* include/ruby/ruby.h (OFFT2NUM): RUBY_REPLACE_TYPE also defines macro
  to convert int type to VALUE if found.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12 12:13:01 +00:00
kosaki 2b881310f8 * include/ruby/intern.h (rb_iv_set, rb_iv_get): removed. Bcause
ruby.h has a declaration for that.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12 09:02:10 +00:00
kosaki f3c9bb063e * include/ruby/intern.h (rb_uint2big, rb_int2big, rb_uint2inum)
(rb_int2inum, rb_ll2inum, rb_ull2inum): removed because ruby.h
  has a declaration for these.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12 09:01:57 +00:00
kosaki 05628d3b6d * configure.in: removes AC_CHECK_FUNC(ftruncate64).
* configure.in: adds RUBY_REPLACE_TYPE(off_t) for creating
  NUM2OFFT.
* file.c (rb_file_truncate): use correct type. chsize() take
  a long.
* include/ruby/ruby.h (NUM2OFFT): use a definition created by
  a configure script by default.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12 08:41:24 +00:00
kosaki e79f790798 * configure.in: removes AC_CHECK_FUNC(fseeko, fseeko64, ftello,
ftello64). They are not used from anywhere.

* win32/win32.c (fseeko): removes.
* win32/win32.c (rb_w32_ftello): removes.
* include/ruby/win32.h: removes declarations of rb_w32_ftello and
  rb_w32_fseeko.
* win32/Makefile.sub: removes '#define HAVE_FTELLO 1'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12 08:41:12 +00:00
nobu b8bcd92059 ruby.h: ISGRAPH
* include/ruby/ruby.h (ISGRAPH): add missing macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-08 04:06:34 +00:00
kosaki 9b89888dda * include/ruby/defines.h (RUBY_ATTR_ALLOC_SIZE): New for
attribute((alloc_size(params))).

* include/ruby/defines.h (xmalloc, xmalloc2, xcalloc)
(xrealloc, xrealloc2): Annotated by RUBY_ATTR_ALLOC_SIZE.
* include/ruby/ruby.h (rb_alloc_tmp_buffer): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-03 21:03:58 +00:00
nobu 3b62e8e78b win32.h: INTPTR_MAX, INTPTR_MIN, UINTPTR_MAX
* include/ruby/win32.h (INTPTR_MAX, INTPTR_MIN, UINTPTR_MAX): also
  should be defined when defining intptr_t and uintptr_t.
  bigdecimal.c requires the former two now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-03 04:29:18 +00:00
nobu 3a0641a896 intern.h: rb_block_lambda
* include/ruby/intern.h (rb_block_lambda): add declaration instead of
  deprecated rb_f_lambda.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-30 03:30:23 +00:00
charliesome 5d7b5481ca * benchmark/bm_hash_shift.rb: add benchmark for Hash#shift
* hash.c (rb_hash_shift): use st_shift if hash is not being iterated to
  delete element without iterating the whole hash.

* hash.c (shift_i): remove function

* include/ruby/st.h (st_shift): add st_shift function

* st.c (st_shift): ditto

[Bug #8312] [ruby-core:54524] Patch by funny-falcon

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-25 05:03:30 +00:00
naruse 536a3274c9 * Merge Onigmo 5.13.4 f22cf2e566712cace60d17f84d63119d7c5764ee.
[bug] fix problem with optimization of \z (Issue #16) [Bug #8210]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-13 11:30:35 +00:00
headius 0626d9b91c Fix #6154 by introducing new EAGAIN/EWOULDBLOCK/EINPROGRESS
subclasses that include WaitReadable or WaitWritable rather than
extending them into the exception object each time.

* error.c: Capture EGAIN, EWOULDBLOCK, EINPROGRESS exceptions and
  export them for use in WaitReadable/Writable exceptions.
* io.c: Create versions of EAGAIN, EWOULDBLOCK, EINPROGRESS that
  include WaitReadable and WaitWritable. Add rb_readwrite_sys_fail
  for nonblocking failures using those exceptions. Use that
  function in io_getpartial and io_write_nonblock instead of
  rb_mod_sys_fail
* ext/openssl/ossl_ssl.c: Add new SSLError subclasses that include
  WaitReadable and WaitWritable. Use those classes for
  write_would_block and read_would_block instead of rb_mod_sys_fail.
* ext/socket/ancdata.c: Use rb_readwrite_sys_fail instead of
  rb_mod_sys_fail in bsock_sendmsg_internal and
  bsock_recvmsg_internal.
* ext/socket/init.c: Use rb_readwrite_sys_fail instead of
  rb_mod_sys_fail in rsock_s_recvfrom_nonblock and
  rsock_s_connect_nonblock.
* ext/socket/socket.c: Use rb_readwrite_sys_fail instead of
  rb_mod_sys_fail in sock_connect_nonblock.
* include/ruby/ruby.h: Export rb_readwrite_sys_fail for use instead
  of rb_mod_sys_fail. Introduce new constants RB_IO_WAIT_READABLE and
  RB_IO_WAIT_WRITABLE for first arg to rb_readwrite_sys_fail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-08 19:58:55 +00:00
akr 1f32d09523 * include/ruby/defines.h: Simplify the logic to include sys/select.h.
This fixes a compilation error on Haiku (gcc2 and gcc4).

* configure.in: Use shared linker as $(CC) for Haiku.
  This fixes a build error on Haiku (gcc2).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-07 02:00:46 +00:00
akr e9382c7332 fix a typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05 11:57:59 +00:00
akr 755e09ebf1 * include/ruby/defines.h (HAVE_TRUE_LONG_LONG): Defined to distinguish
availability of long long and availability of 64bit integer type.

* pack.c: Use HAVE_TRUE_LONG_LONG to distinguish q! and Q! support.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05 11:44:56 +00:00
nobu bff997e02b defines.h: RUBY_SYMBOL_EXPORT_{BEGIN,END}
* include/ruby/defines.h (RUBY_SYMBOL_EXPORT_{BEGIN,END}): visibility
  control macros.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05 10:29:38 +00:00
akr 61b245cc40 * include/ruby/ruby.h (FIX2LONG): Parenthesize the macro body.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 13:54:10 +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
nobu cea3a73f19 ruby/io.h: get rid of conflict on AIX
* include/ruby/io.h: undef POSIX compliants names on AIX, which are no
  longer needed.  patch suggested by edelsohn (David Edelsohn) in
  [ruby-core:53815].  [Bug #8174]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-29 01:24:14 +00:00
nobu 05f5cbeb75 ruby/io.h: get rid of conflict on AIX
* include/ruby/io.h: rename SVR3,4 member names as POSIX compliants,
  to get rid of conflict on AIX.  [ruby-core:53765] [Bug #8174]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-28 14:10:21 +00:00