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

1222 Коммитов

Автор SHA1 Сообщение Дата
naruse 28f5e12c24 * configure.in: check function attirbute const and pure,
and define CONSTFUNC and PUREFUNC if available.
  Note that I don't add those options as default because
  it still shows many false-positive (it seems not to consider
  longjmp).

* vm_eval.c (stack_check): get rb_thread_t* as an argument
  to avoid duplicate call of GET_THREAD().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08 17:44:51 +00:00
yui-knk deca1d8007 * string.c (rb_str_sub): Fix a special match variable name.
[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-05 05:39:35 +00:00
naruse cdef0bc833 * string.c (count_utf8_lead_bytes_with_word): Use __builtin_popcount
only if it can use SSE 4.2 POPCNT whose latency is 3 cycle.

* internal.h (rb_popcount64): use __builtin_popcountll because now
  it is in fast path.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-03 13:14:30 +00:00
nobu c353ec0c9e string.c: shortcut
* string.c (rb_str_concat): shortcut concatenation to ASCII-8BIT
  as well as US-ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-02 03:58:28 +00:00
nobu 321c6df89b string.c: fix doc
* string.c (rb_str_concat): [DOC] fix the indefinite article, for
  replacement from Fixnum to Integer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-02 03:53:34 +00:00
nobu 0e3475a6d9 string.c: fix braces
* string.c (search_nonascii): fix braces unmatched by a
  preprocessing condition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-02 00:06:04 +00:00
naruse 2fc973796a fix mixed declaration on non UNALIGNED_WORD_ACCESS
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 18:27:41 +00:00
naruse 64837f778a fix for where UNALIGNED_WORD_ACCESS is not allowed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 14:19:02 +00:00
naruse db2c32778d Use WORDS_BIGENDIAN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 09:07:14 +00:00
naruse 0f0121fe1a * string.c (search_nonascii): use nlz on big endian environments.
* internal.h (nlz_intpr): defined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 22:32:05 +00:00
naruse 424a706afe More optimization for r54854's search_nonascii
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 16:32:36 +00:00
naruse 4cf460a7bb * string.c (search_nonascii): unroll and use ntz
* configure.in (__builtin_ctz): check.

* configure.in (__builtin_ctzll): check.

* internal.h (rb_popcount32): defined for ntz_int32.
  it can use __builtin_popcount but this function is not used on
  GCC environment because it uses __builtin_ctz.
  When another function uses this, using __builtin_popcount
  should be re-considered.

* internal.h (rb_popcount64): ditto.

* internal.h (ntz_int32): defined for ntz_intptr.

* internal.h (ntz_int64): defined for ntz_intptr.

* internal.h (ntz_intptr): defined as ntz for uintptr_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 15:39:02 +00:00
nobu a491508753 string.c: rb_str_concat_literals
* string.c (rb_str_concat_literals): concatenate literal string
  fragments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-05 08:15:22 +00:00
nobu 0f32783976 string.c: skip invalid char gap
* string.c (enc_succ_alnum_char): try to skip an invalid character
  gap between GREEK CAPITAL RHO and SIGMA.
  [ruby-core:74478] [Bug #12204]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-21 10:09:33 +00:00
nobu 49a272d728 string.c: Symbol#match
* string.c (sym_match_m): delegate to String#match but not
  String#=~.  [ruby-core:72864] [Bug #11991]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-18 12:06:20 +00:00
nobu 5a6a502ef9 string.c: fix rb_str_init
* string.c (rb_str_init): fix segfault and memory leak, consider
  wide char encoding terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17 11:24:09 +00:00
naruse d092fc5398 Additional fix and tests for r53851
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17 10:15:28 +00:00
nobu b6053df008 remove unnecessary declaration so that rdoc works
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17 07:37:20 +00:00
naruse 49dee548f4 fix rubyspec error from r53850
http://rubyci.s3.amazonaws.com/tk2-243-31075/ruby-trunk/log/20160217T061402Z.fail.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17 07:24:13 +00:00
naruse d46e2aea71 * string.c (rb_str_init): introduce String.new(capacity: size)
[Feature #12024]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17 03:21:35 +00:00
duerst 2ca7569c6d * string.c, enc/unicode.c: Disassociating ONIGENC_CASE_FOLD flag from
ONIGENC_CASE_DOWNCASE.
(with Kimihito Matsui)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-08 11:44:12 +00:00
nobu 1bea5a6127 string.c: remove magic number
* string.c (rb_str_dump): share same string literal instead of a
  magic number.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-08 03:44:48 +00:00
nobu 6442f02176 string.c: use encoding index
* string.c (rb_external_str_with_enc, rb_str_concat, rb_str_dump):
  use encoding index as shortcut without rb_encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-08 03:41:16 +00:00
nobu 94c70c7d72 fstring_enc_new
* string.c (rb_fstring_enc_new, rb_fstring_enc_cstr): functions to
  make fstring with encoding.
* re.c (rb_reg_initialize): make fstring without copying.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-04 06:35:34 +00:00
naruse 040ce05610 * string.c (str_new_frozen): if the given string is embeddedable
but not embedded, embed a new copied string. [Bug #11946]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-03 04:52:13 +00:00
naruse 21daa56b2a * re.c: Introduce RREGEXP_PTR.
patch by dbussink.
  partially merge https://github.com/ruby/ruby/pull/497

* include/ruby/ruby.h: ditto.

* gc.c: ditto.

* ext/strscan/strscan.c: ditto.

* parse.y: ditto.

* string.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-02 04:39:44 +00:00
nobu 439224a590 RUBY_ASSERT
* error.c (rb_assert_failure): assertion with stack dump.
* ruby_assert.h (RUBY_ASSERT): new header for the assertion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-22 08:33:55 +00:00
hsbt 4c6713f374 * string.c: fix a typo. [fix GH-1202][ci skip] Patch by @sunboshan
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-18 02:48:24 +00:00
duerst e580847ce8 * string.c: Any kind of option is now taking the new code path for
upcase/downcase/capitalize/swapcase. :lithuanian can be used for
  testing if no specific option is desired.
* test/ruby/enc/test_case_mapping.rb: Adjusted to above.
  (with Kimihito Matsui)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-17 11:40:46 +00:00
duerst 959bbb6f72 * enc/unicode.c: Removed artificial expansion for Turkic,
added hand-coded support for Turkic, fixed logic for swapcase.
* string.c: Made use of new case mapping code possible from upcase,
  capitalize, and swapcase (with :lithuanian as a guard).
* test/ruby/enc/test_case_mapping.rb: Adjusted for above.
  (with Kimihito Matsui)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-17 08:42:16 +00:00
duerst c12af76763 * enc/unicode.c: Artificial mapping to test buffer expansion code.
* string.c: Fixed buffer expansion logic.
* test/ruby/enc/test_case_mapping.rb: Tests for above.
(with Kimihito Matsui)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-16 08:24:58 +00:00
hsbt 219467abde * enc/unicode.c: fix implicit conversion error with clang. fixup r53548.
* string.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-16 01:51:58 +00:00
svn 72fa5a8ee5 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-16 01:24:04 +00:00
duerst be897c2507 * string.c, enc/unicode.c: New code path as a preparation for Unicode-wide
case mapping. The code path is currently guarded by the :lithuanian
  option to avoid accidental problems in daily use.
* test/ruby/enc/test_case_mapping.rb: Test for above.
* string.c: function 'check_case_options': fixed logical errors

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-16 01:24:03 +00:00
duerst 4a5d3572e6 string.c: made a variable name more grammatically correct
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-12 09:42:07 +00:00
duerst f23658f1c1 string.c: minor grammar fix [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-12 09:35:00 +00:00
svn d956652d90 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-12 07:03:32 +00:00
duerst 2788cd9849 string.c: Added option parsing/checking for upcase/downcase/
capitalize/swapcase (with Kimihito Matsui

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-12 07:03:31 +00:00
nobu 2a4729a40d Fix rdoc for String#rstrip!, lstrip! [ci skip]
* string.c (rb_str_lstrip_bang, rb_str_rstrip_bang): [DOC] Fix
  ruby-doc comments for String#rstrip! and lstrip!.  It looks like
  dropped bang.  [Fix GH-1175]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27 09:08:17 +00:00
yui-knk adc0898538 * string.c: Fix document. Default value of the first
argument of `String#split` is not `$;` but `nil`.
  When `nil` is passed as first argument, `$;` is used.
  [ci skip] [Bug #11729] [ruby-dev:49378]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-23 03:02:07 +00:00
nobu 9da8a29760 string.c: no exception on dummy encoding
* string.c (str_compat_and_valid): as scrub does nothing for dummy
  encoding string now, incompatible encoding is not a matter.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22 06:21:14 +00:00
nobu 61c19c9d43 string.c: infection
* string.c (rb_str_scrub): the result should be infected by the
  original string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-17 05:16:27 +00:00
nobu 365fae4dd9 string.c: radix indicators [ci skip]
* string.c (rb_str_oct): [DOC] mention radix indicators.
  [ruby-core:71310] [Bug #11648]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15 04:49:59 +00:00
hsbt 52cd994814 * enum.c: fix a typo in documentation.
[ci skip][fix GH-1140] Patch by @jutaz
* io.c: ditto.
* iseq.c: ditto.
* numeric.c: ditto.
* process.c: ditto.
* string.c: ditto.
* vm_trace.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14 02:52:14 +00:00
naruse e3ab670a71 * object.c (rb_inspect): dump inspected result with rb_str_escape()
instead of raising Encoding::CompatibilityError. [Feature #11801]

* string.c (rb_str_escape): added to dump given string like
  rb_str_inspect without quotes and always dump in US-ASCII
  like rb_str_dump.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-10 18:57:08 +00:00
nobu cf183a58de string.c: use rb_id_encoding
* string.c (rb_str_init): rb_id_encoding() returns same ID with
  caching.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 23:41:27 +00:00
usa 4466d4baa9 * string.c (rb_str_init): now accepts new option parameter `encoding'.
[Feature #11785]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 16:48:52 +00:00
duerst d9c6135c5b string.c: removed unused variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 08:36:43 +00:00
ko1 6d8bf54c44 * string.c: introduce String#+@ and String#-@ to control
String mutability.
  [Feature #11782]




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-07 15:10:00 +00:00
nobu cae3905e89 string.c: should not taint fstring
* string.c (rb_obj_as_string): fstring should not be infected.
  re-apply r52872 and fix a typo.
  TODO: other frozen strings also may not be.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-04 07:48:22 +00:00