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

1134 Коммитов

Автор SHA1 Сообщение Дата
nobu e396ba84fb intern.h: rb_str_new_literal
* include/ruby/intern.h (rb_str_new_literal): define on all
  platforms, not only gcc.

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

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

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

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



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

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

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

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

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

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

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

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



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

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

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

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

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

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

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


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

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

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

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

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

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

* node.h (nd_set_line): Ditto.

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

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

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

* vm_core.h (VM_FRAME_MAGIC_MASK): Ditto.

* vm_trace.c (recalc_add_ruby_vm_event_flags): Ditto.



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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



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

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

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

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

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

* vm_insnhelper.c (vm_getivar): ditto

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



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

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

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

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

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


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

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

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

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

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

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-20 04:19:06 +00:00