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

502 Коммитов

Автор SHA1 Сообщение Дата
nobu 81ec47ea18 internal.h: round macros
* internal.h (ROUND_FUNC, ROUND_CALL): macros wrapping round
  functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-18 06:29:51 +00:00
mrkn affa0f845c complex.c: optimize Numeric#polar and Numeric#arg
* complex.c (numeric_polar): optimize for Integer, Float, and Rational.

* complex.c (numeric_arg): directly create the value of pi.

* complex.c (f_negative_p): optimize for Integer, Float, and Rational.

* rational.c (INT_NEGATIVE_P): move the definition into internal.h.

* internal.h (INT_NEGATIVE_P): ditto.

* numeric.c (rb_float_abs): rename from flo_abs and export to be used
  from other source files..

* internal.h (rb_float_abs): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-16 04:25:35 +00:00
mrkn bdd18a2c31 rational.c: optimize Integer#lcm
* rational.c (f_div, f_mul, f_abs): optimize Integer#lcm
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* numeric.c (rb_int_abs): rename from int_abs to be exported.

* internal.h (rb_int_div, rb_int_abs): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 15:43:26 +00:00
mrkn f40607d15d rational.c: optimize Float#to_r
* rational.c (float_to_r): optimize Float#to_r.

* numeric.c (rb_int_lshift): exported.

* internal.h (rb_int_lshift): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 11:52:00 +00:00
mrkn 9bb3022475 rational.c: optimize Rational#{floor,ceil,round,truncate}
* rational.c (f_{expt10,round_common},nurat_{floor,ceil,round_half_{up,even}}):
  optimize Rational#{floor,ceil,round,truncate}.
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* numeric.c (rb_int_divmod): rename from int_divmod to be exported.

* numeric.c (rb_int_and): rename from int_and to be exported.

* intern.h (rb_int_{divmod,and}): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:45:11 +00:00
mrkn e5aa590637 rational.c: purge f_cmp
* rational.c (f_cmp, nurat_expt): purge f_cmp.
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* rational.c (INT_POSITIVE_P): added.

* numeric.c (FIXNUM_POSITIVE_P): move the definition into internal.h.

* internal.h (FIXNUM_POSITIVE_P): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:07:24 +00:00
mrkn d611a7c77b rational.c: optimize Rational#==
* rational.c (nurat_eqeq_p): optimize Rational#==.
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* numeric.c (rb_int_equal): rename from int_equal and remove static
  to be exported.

* internal.h (rb_int_equal): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 02:24:32 +00:00
mrkn fb40c3776a rational.c: optimize Rational#<=>
* rational.c (nurat_cmp): optimize Rational#<=>.
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* numeric.c (rb_int_cmp): rename from int_cmp and remove static
  to be exported.

* internal.h (rb_int_cmp): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 01:29:01 +00:00
mrkn d8769bffe5 rational.c: optimize Rational#**
* rational.c (nurat_expt): optimize Rational#**.
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* numeric.c (rb_float_pow): rename flo_pow() to rb_float_pow()
  and remove static to be exporetd.

* internal.h (rb_int_pow, rb_float_pow): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 16:38:28 +00:00
mrkn 06d701a1f0 rational.c: avoid needless object allocation with nurat_to_double
* rational.c (nurat_to_double): introduce to convert rational to double
  without object allocation.

* rational.c (rb_rational_plus, nurat_{sub,mul,to_f}): rewrite by using
  nurat_to_double.

* bignum.c (rb_big_fdiv_double): introduce to calculate fdiv and return
  the result as a double value.

* bignum.c (big_fdiv{,_int,_float}): change the return types for
  implementing rb_big_fdiv_double.

* bignum.c (rb_big_fdiv): rewrite by using rb_big_fdiv_double.

* numeric.c (rb_int_fdiv_double): introduce to calculate fdiv and return
  the result as a double value.

* numeric.c (fix_fdiv_double): rewrite from fix_fdiv to return the
  result as a double value.

* numeric.c (rb_int_fdiv): rewrite by using rb_int_fdiv_double.

* internal.h (rb_{big,int}_fdiv_double): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 15:55:30 +00:00
mrkn f64a53462e numeric.c, rational.c: refactor by using FIXNUM_NEGATIVE_P and FIXNUM_ZERO_P
* numeric.c (num_zero_p, fix_divide, fix_mod, fix_divmod): refactor by using
  FIXNUM_NEGATIVE_P and FIXNUM_ZERO_P.

* rational.c (INT_NEGATIVE_P, INT_ZERO_P): ditto.

* internal.h: move FIXNUM_NEGATIVE_P and FIXNUM_ZERO_P from numeric.c

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 14:39:25 +00:00
mrkn c05cfe3739 numeric.c, internal.h: export int_fdiv() as rb_int_fdiv()
* numeric.c (rb_int_fdiv): export int_fdiv() as rb_int_fdiv().

* internal.h (rb_int_fdiv): add declaration of rb_int_fdiv().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-10 15:23:33 +00:00
ko1 75775157ea Introduce table improvement by Vladimir Makarov <vmakarov@redhat.com>.
[Feature #12142]
	See header of st.c for improvment details.

	You can see all of code history here:
	<https://github.com/vnmakarov/ruby/tree/hash_tables_with_open_addressing>

	This improvement is discussed at
	<https://bugs.ruby-lang.org/issues/12142>
	with many people, especially with Yura Sokolov.

	* st.c: improve st_table.

	* include/ruby/st.h: ditto.

	* internal.h, numeric.c, hash.c (rb_dbl_long_hash): extract a function.

	* ext/-test-/st/foreach/foreach.c: catch up this change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-07 00:45:00 +00:00
nobu 4b7fd61a05 process.c: PATH env in spawn
* process.c (rb_exec_fillarg): honor the given path environment
  variable.  [ruby-core:53103] [Bug #8004]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-06 00:58:49 +00:00
nobu dfe91fcd08 numeric.c: round to nearest even
* numeric.c (flo_round, int_round): support round-to-nearest-even
  semantics of IEEE 754 to match sprintf behavior, and add `half:`
  optional keyword argument for the old behavior.
  [ruby-core:76273] [Bug #12548]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 09:49:39 +00:00
nobu a2144bd72a chomp option
* io.c (extract_getline_opts): extract chomp option.
  [Feature #12553]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 07:28:09 +00:00
nobu 9e75488ac8 internal.h: RB_OBJ_BUILTIN_TYPE
* internal.h (RB_OBJ_BUILTIN_TYPE): special-const safe
  BUILTIN_TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-28 06:58:19 +00:00
nobu 4065c38a6a class.c: rb_undef_methods_from
* class.c (rb_undef_methods_from): undefine methods defined in
  super from klass.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-24 01:49:52 +00:00
usa c2dd2d268e * internal.h (ST2FIX): new macro to convert st_index_t to Fixnum.
a hash value of Object might be Bignum, but it causes many troubles
  expecially the Object is used as a key of a hash.  so I've gave up
  to do so.

* array.c (rb_ary_hash): use above macro.

* bignum.c (rb_big_hash): ditto.

* hash.c (rb_obj_hash, rb_hash_hash): ditto.

* numeric.c (rb_dbl_hash): ditto.

* proc.c (proc_hash): ditto.

* re.c (rb_reg_hash, match_hash): ditto.

* string.c (rb_str_hash_m): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-04 16:25:01 +00:00
ngoto 16391af2e2 * internal.h (MAYBE_UNUSED): The fallback definition is needed.
Fix compile error with some non-GCC compilers such as
  Oracle Solaris Studio 12.3 on Solaris 10.
  [Bug #12767] [ruby-dev:49807]

* internal.h (WARN_UNUSED_RESULT): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-16 12:29:42 +00:00
shyouhei 2fc5210f31 * internal.h (WARN_UNUSED_RESULT): moved to configure.in, to
actually check its availability rather to check GCC's version.

	* configure.in (WARN_UNUSED_RESULT): moved to here.

	* configure.in (RUBY_FUNC_ATTRIBUTE): change function declaration
	  to return int rather than void, because it makes no sense for a
	  warn_unused_result attributed function to return void.

	  Funny thing however is that it also makes no sense for noreturn
	  attributed function to return int.  So there is a fundamental
	  conflict between them.  While I tested this, I confirmed both
	  GCC 6 and Clang 3.8 prefers int over void to correctly detect
	  necessary attributes under this setup.  Maybe subject to change
	  in future.

	* internal.h (UNINITIALIZED_VAR): renamed to MAYBE_UNUSED, then
	  moved to configure.in for the same reason we move
	  WARN_UNUSED_RESULT.

	* configure.in (MAYBE_UNUSED): moved to here.

	* internal.h (__has_attribute): deleted, because it has no use now.

	* string.c (rb_str_enumerate_lines): refactor macro rename.

	* string.c (rb_str_enumerate_bytes): ditto.

	* string.c (rb_str_enumerate_chars): ditto.

	* string.c (rb_str_enumerate_codepoints): ditto.

	* thread.c (do_select): ditto.

	* vm_backtrace.c (rb_debug_inspector_open): ditto.

	* vsnprintf.c (BSD_vfprintf): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-16 06:15:55 +00:00
nobu e6a260ecdb variable.c: rb_deprecate_constant
* variable.c (rb_deprecate_constant): new function to deprecate a
  constant by the name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09 03:02:22 +00:00
nobu 7615362d64 internal.h: fix typos
* internal.h (MEMO_V1_SET, MEMO_V2_SET): fix typos.  use the macro
  parameter, not the local variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-02 07:07:01 +00:00
nobu 6a6a4126d4 internal.h: fix r55831
* internal.h (RBASIC_CLEAR_CLASS): fix compile error and size to
  fill.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-08 05:11:51 +00:00
shyouhei 869e7809a3 * internal.h (RBASIC_CLEAR_CLASS): Reroute ANSI C's strict
aliasing rule.
  	  [ruby-core:74427][Bug #12191][ruby-core:76747][Bug #12657]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-08 04:19:58 +00:00
shyouhei 26f59b09fe hide struct internal [Feature #9916]
* include/ruby/ruby.h (struct RStruct): no longer.

	* internal.h (struct RStruct): moved here.

	* struct.c (rb_struct_ptr): a compensation function for the lack
	  of RSTRUCT_PTR.  But now that we have RSTRUCT_GET/SET, that must
	  not be used anyway.  I mark this deprecated.  Dont use it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-01 07:23:56 +00:00
ko1 e06698d257 * vm.c, internal.h: remove RubyVM::Env class and all of env objects
are imemo objects (imemo_env).

* NEWS: describe this change. I believe nobody touch these objects
  because there are no method defined.

* vm_core.h: remove the following definitions.
  * rb_cEnv decl.
  * GetEnvPtr() because Env is no longer T_DATA object.

* vm_core.h (rb_env_t): fix layout for imemo values.

* vm_core.h (vm_assert_env): added.

* vm_core.h (vm_env_new): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 19:13:26 +00:00
ko1 9f60791a04 * vm_core.h: revisit the structure of frame, block and env.
[Bug #12628]

  This patch introduce many changes.

  * Introduce concept of "Block Handler (BH)" to represent
    passed blocks.

  * move rb_control_frame_t::flag to ep[0] (as a special local
    variable). This flags represents not only frame type, but also
    env flags such as escaped.

  * rename `rb_block_t` to `struct rb_block`.

  * Make Proc, Binding and RubyVM::Env objects wb-protected.

  Check [Bug #12628] for more details.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 11:02:30 +00:00
nobu 9662ee0584 internal.h: inline Check_Type
* internal.h (Check_Type): inline check for the object type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-23 13:43:44 +00:00
nobu aa0e51b529 hash.c: rb_hash_add_new_element
* hash.c (rb_hash_add_new_element): add new element or do nothing
  if it is contained already.
* array.c (ary_add_hash, ary_add_hash_by): use
  rb_hash_add_new_element.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-20 08:35:25 +00:00
nobu 745a2aac69 math.c: Complex sqrt
* math.c (rb_math_sqrt): [EXPERIMENTAL] move Complex sqrt support
  from mathn.rb.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-12 14:13:46 +00:00
nobu 89ed4f41a3 complex.c: rb_complex prefix
* complex.c (rb_complex_plus, rb_complex_mul): rename to
  rb_complex prefix.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-12 13:17:04 +00:00
ngoto 5eff15d1bd * string.c (rb_str_change_terminator_length): New function to change
termlen and resize heap for the terminator. This is split from
  rb_str_fill_terminator (str_fill_term) because filling terminator
  and changing terminator length are different things. [Bug #12536]

* internal.h: declaration for rb_str_change_terminator_length.

* string.c (str_fill_term): Simplify only to zero-fill the terminator.
  For non-shared strings, it assumes that (capa + termlen) bytes of
  heap is allocated. This partially reverts r55557.

* encoding.c (rb_enc_associate_index): rb_str_change_terminator_length
  is used, and it should be called whenever the termlen is changed.

* string.c (str_capacity): New static function to return capacity
  of a string with the given termlen, because the termlen may
  sometimes be different from TERM_LEN(str) especially during
  changing termlen or filling terminator with specific termlen.

* string.c (rb_str_capacity): Use str_capacity.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-05 10:45:23 +00:00
nobu c071c05229 Integer unification macro
* include/ruby/ruby.h (RUBY_INTEGER_UNIFICATION): macro to tell if
  Integer is integrated.  [ruby-core:75718][Bug #12427]
* include/ruby/backward.h, internal.h (rb_cFixnum, rb_cBignum):
  fallback to rb_cInteger.
* bignum.c, numeric.c, ext/json/generator/generator.{c,h}: use the
  macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13 11:34:56 +00:00
nobu 2667d1b38f hash.c: ensure NUL-terminated for ENV
* hash.c (get_env_cstr): ensure NUL-terminated.
  [ruby-dev:49655] [Bug #12475]
* string.c (rb_str_fill_terminator): return the pointer to the
  NUL-terminated content.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10 05:48:38 +00:00
ngoto fd25eea0e4 * include/ruby/intern.h: Remove excess semicolons in PUREFUNC().
Fix failure of TestMkmf::TestConvertible on Solaris with
  Oracle Solaris Studio 12. [ruby-dev:49651] [Bug #12470]
* internal.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-08 11:36:57 +00:00
nobu 4fad63da01 transcode.c: scrub in the given encoding
* transcode.c (str_transcode0): scrub in the given encoding when
  the source encoding is given, not in the encoding of the
  receiver.  [ruby-core:75732] [Bug #12431]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-27 08:09:46 +00:00
ngoto 2b97ab88e0 Use RB_GNUC_EXTENSION_BLOCK instead of __extension__
* include/ruby/defines.h (RB_GNUC_EXTENSION, RB_GNUC_EXTENSION_BLOCK):
  macros for skipping __extension__ on non-GCC compilers.
* eval_error.c (warn_print): use RB_GNUC_EXTENSION_BLOCK instead of
  __extension__ because __extension__ is a GNU extension.
  Fix compile error on Solaris 10 with Oracle Solaris Studio 12.x.
  [Bug #12397] [ruby-dev:49629].
* internal.h (rb_fstring_cstr, rb_fstring_enc_cstr): ditto
* include/ruby/encoding.h (rb_enc_str_new, rb_enc_str_new_cstr): ditto
* include/ruby/intern.h (rb_str_new, rb_str_new_cstr,
  rb_usascii_str_new, rb_utf8_str_new, rb_tainted_str_new_cstr,
  rb_usascii_str_new_cstr, rb_utf8_str_new_cstr,
  rb_external_str_new_cstr, rb_locale_str_new_cstr,
  rb_str_buf_new_cstr, rb_str_cat_cstr, rb_exc_new_cstr): ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20 12:29:06 +00:00
nobu b7733bf6c5 exclude non-VALUE in memo from GC
* internal.h (NEW_PARTIAL_MEMO_FOR): shrink buffer array not to
  mark non-VALUE fields.  fix check_rvalue_consistency abort with
  RGENGC_CHECK_MODE=2.
* internal.h (NEW_CMP_OPT_MEMO): exclude struct cmp_opt_data from
  the valid array range.
* enum.c (slicewhen_i): exclude inverted too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20 10:48:51 +00:00
mrkn d5595a9627 Optimize enum_sum for a range from int to int
* enum.c (enum_sum): Optimize for a range from int to int.

* test/ruby/test_enum.rb (test_range_sum): Move from test_range.rb,
  and add assertions for some conditions.

* test/ruby/test_enum.rb (test_hash_sum): Move from test_hash.rb.

* test/ruby/test_hash.rb, test/ruby/test_range.rb: Remove test_sum.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 15:08:33 +00:00
naruse b207e7cd1d include/ruby/defines.h (GCC_VERSION_SINCE): moved from internal.h
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-12 18:12:47 +00:00
naruse ac11f944e1 Use HAVE_BUILTIN___BUILTIN_CONSTANT_P
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-12 18:12:46 +00:00
naruse 91e3c8b370 * configurein: use alternative keyword
to avoid macros conflicts with them.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-12 18:12:45 +00:00
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 903161e0af numeric.c: Remove prototype declarations to internal.h
* numeric.c (fix_plus): Remove rb_nucomp_add prototype
  declaration.

* numeric.c (fix_mul): Remove rb_nucomp_mul prototype
  declaration.

* internal.h (rb_nucomp_add, rb_nucomp_mul): add prototype
  declarations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-04 14:12:10 +00:00
yui-knk 5bc03ef459 * internal.h (RCOMPLEX_SET_IMAG): undef RCOMPLEX_SET_IMAG
instead of duplicated undef RCOMPLEX_SET_REAL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-03 14:12:02 +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
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 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
akr 70279a5700 Define Integer#> instead of Bignum#>.
* numeric.c (int_gt): Define Integer#>.

* bignum.c (rb_big_gt): Don't define Bignum#>.
  Renamed from big_gt.

* internal.h (rb_big_gt): Declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 10:42:06 +00:00