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

241 Коммитов

Автор SHA1 Сообщение Дата
ngoto f687a147eb Workaround for optimization bug of Oracle Solaris Studio 12.4 and 12.5
* pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for
  optimization bug of Oracle Solaris Studio 12.4 and 12.5
  (Oracle Developer Studio 12.5) on Solaris with -xO4 optimization
  option. [Bug #11684] [ruby-core:80690]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-14 19:12:51 +00:00
nobu 556a1352e4 backward.h: 2.2 deprecated features
* include/ruby/backward.h (DECLARE_DEPRECATED_FEATURE): move
  features deprecated at 2.2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 05:17:41 +00:00
nobu 6877de73de DEPRECATED_INTERNAL_FEATURE
* error.c (ruby_deprecated_internal_feature): renamed, to
  explicitly represent deprecation.

* internal.h (DEPRECATED_INTERNAL_FEATURE): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-17 05:45:44 +00:00
rhe b65b41861f pack.c: avoid returning uninitialized String
Fix unpacking with 'b', 'B', 'h' and 'H' format. Do not return an
uninitialized String to Ruby before filling the content bytes.
Fixes r11175 ("pack.c (pack_unpack): execute block if given with
unpacked value instead of creating an array", 2006-10-15).
[ruby-core:78841] [Bug #13075]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26 06:32:00 +00:00
naruse 7e1b5d8d4f Remove unused variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-01 17:43:41 +00:00
naruse 306f43acfe String#unpack1 [Feature #12752]
Returns the first value of String#unpack.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-01 14:18:32 +00:00
usa b6e137e93c Remove `offset:` from `Array#pack`
* pack.c (pack_pack): can use `@` instead of `offset:`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-01 13:20:47 +00:00
usa 0dd9c302d9 Supports `buffer` and `offset` in `Array#pack`
* pack.c (pack_pack): Supports `buffer` and `offset` in `Array#pack`.
  [Feature #12754] [ruby-dev:49798]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-01 13:08:20 +00:00
nobu 0913d67f5d pack.c: simplify
* pack.c (str_associate): remove unnecessary branch.
  the argument must be a plain vanilla string object.

* pack.c (str_associated): use rb_ivar_lookup to give the
  undefined value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:12:13 +00:00
akr 58206933b4 [DOC] table format refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-25 03:48:23 +00:00
akr e694894dbd [DOC] add description of j and J for unpack.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-25 03:32:00 +00:00
naruse e90e916b44 * pack.c (pack_pack): use union instead of bare variable to ease
optimizations and avoid assigning x87 floating point number.
  [ruby-core:74496] [Bug #12209]

* pack.c (pack_unpack): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-05 02:08:55 +00:00
nobu d226ce8dec internal.h: ONLY_FOR_INTERNAL_USE
* error.c (ruby_only_for_internal_use): raise fatal error when
  deprecated function only for internal use is called, not just a
  warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-27 05:29:49 +00:00
nobu d10d5a974d pack.c: check index range
* pack.c (pack_pack): always check index range against the
  receiver array length, which can be shortened by elements
  conversion.  reported by Marcin 'Icewall' Noga of Cisco Talos.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 09:33:40 +00:00
ngoto 238c6c5b89 * pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for
optimization bug of Oracle Solaris Studio 12.4 on Solaris
  with -xO4 optimization option. [Bug #11684]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13 17:06:43 +00:00
usa dc0d502b71 * pack.c (pack_{un,}pack): new template character `j` and `J`, pointer
with signed and unsigned integers.

* NEWS: mention bout this featre.
  [Feature #11215] [ruby-dev:49015]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-12 12:22:36 +00:00
nobu b4974e71dc util.c: hexdigit
* util.c (hexdigit): extract identical constants.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-13 07:07:39 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
nobu 1f53145dd4 pack.c: escape and encoding
* pack.c (pack_pack): escape unprintable characters and preserve
  the encoding of warning message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-06 14:58:43 +00:00
akr 108627d911 * pack.c (pack_unpack): Add casts for char references for 'u'.
Fix line ending recognition algorithm.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-17 14:28:34 +00:00
akr 50650bb338 * pack.c (pack_unpack): Add casts for char references for 'b' and 'h'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-17 12:52:26 +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
nobu 6a6362d633 pack.c: no nil.taint
* pack.c (pack_pack): nil is not taintable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 08:04:59 +00:00
nobu de79761ef6 pack.c (encodes): name a magic number
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-04 13:27:01 +00:00
nobu 8a608d2b1f pack.c: fix buffer overrun
* pack.c (encodes): fix buffer overrun by tail_lf.  Thanks to
  Mamoru Tasaka and Tomas Hoger.  [ruby-core:63604] [Bug #10019]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-11 01:09:05 +00:00
akr dd5d029db0 * compile.c (BUFSIZE): Unused macro removed.
* vm.c (BUFSIZE): Ditto.

* pack.c (INT64toNUM): Ditto.
  (UINT64toNUM): Ditto.
  (BYTEWIDTH): Ditto.

* time.c (lshift): Ditto.
  (UINT64toNUM): Ditto.
  (id_lshift): Unused variable removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-11 13:29:16 +00:00
akr 49771dd308 * pack.c (swaps): Unused macro removed.
(swapi): Ditto.
  (swapl): Ditto.
  (swapll): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-11 12:24:11 +00:00
nobu b2b5a5db09 pack.c: hide associated objects
* marshal.c (to_be_skipped_id): ignore anonymous attributes.
* pack.c (Init_pack): use anonymous ID so that associated objects
  do not appear in the packed result.
* parse.y (rb_make_internal_id): return an anonymous ID for
  internal use.


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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-04 05:07:21 +00:00
glass 5c54eb4045 * dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-08 02:37:47 +00:00
akr b2be623240 * internal.h (ruby_digit36_to_number_table): Declared.
* util.c (ruby_digit36_to_number_table): Moved from scan_digits.

* bignum.c (conv_digit): Use ruby_digit36_to_number_table.

* pack.c (hex2num): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-03 13:32:14 +00:00
akr cdd1c04453 * pack.c (pack_unpack): Remove specialized unpackers for integers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22 12:05:31 +00:00
akr 654a40a33a * pack.c (num2i32): Removed.
(pack_pack): Don't use num2i32.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22 01:39:15 +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 90be342c9f * pack.c (pack_pack): Move the implementation for 'c' directive after
pack_integer label.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 10:25:40 +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
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 ff6104ba62 * pack.c (pack_pack): Use rb_integer_pack_2comp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 03:35:54 +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 0e8caa7d0f * bignum.c (rb_integer_pack): Returns sign instead of words.
(absint_numwords_generic): Follow the above change.
  (big2str_base_powerof2): Follow the above change.

* internal.h: Ditto.

* hash.c (rb_hash): Ditto.

* pack.c (pack_pack): Ditto.

* random.c (int_pair_to_real_inclusive): Ditto.
  (rand_init): Ditto.
  (random_load): Ditto.
  (limited_big_rand): Ditto.

* time.c (v2w_bignum): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10 10:37:39 +00:00
akr f5ad120b97 * bignum.c (rb_absint_numwords): Renamed from rb_absint_size_in_word.
* internal.h (rb_absint_numwords): Follow the above change.

* pack.c (pack_pack): Ditto.

* random.c (rand_init): Ditto.
  (limited_big_rand): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-09 07:53:20 +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 d1f3d41f11 * internal.h (rb_int_export): countp argument is split into
wordcount_allocated and wordcount.

* bignum.c (rb_int_export): Follow the above change.

* pack.c (pack_pack): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06 22:31:23 +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 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
akr 570015a18b * pack.c (swap32): Don't redefine it if it is already defined.
Bionic defines it.
  (swap64): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-07 03:09:15 +00:00