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

1347 Коммитов

Автор SHA1 Сообщение Дата
nobu be701dc57f debug.c: more enums
* debug.c (ruby_dummy_gdb_enums): add enums for RObject, RModule,
  RString, RArray.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 04:43:03 +00:00
normal 190e29f72e attempt to fix rb_alloc_tmp_buffer2 for ALLOCV_N
This is a confusing function to my arithmetic-challenged mind,
but nobu seems alright with this.  Anyways this lets me use
large values of elsize without segfaulting, and "make exam"
passes.

* include/ruby/ruby.h (rb_alloc_tmp_buffer2): attempt to fix
  [ruby-core:81388] [ruby-core:81391] [Bug #13595]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-26 07:28:23 +00:00
naruse 9cf7985893 Merge Onigmo 6.1.2
1364ae3488

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 05:38:37 +00:00
rhe 70c9bb4b81 Remove missing/strtol.c
It is never used. We don't need it anyway as it's part of C89 which is
our current minimum requirement.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 06:03:12 +00:00
nobu c483ae6572 Suppress a warning in ruby/win32.h [Fix GH-1591]
Fix a warning in ruby/win32.h which can cause failures with mkmf

The return value is implicit type casted from 'long double' to 'double', currently.
This causes a gcc warning like this:

```
In file included from C:\Ruby24-x64\include\ruby-2.4.0/ruby/defines.h:243:0,
                 from C:\Ruby24-x64\include\ruby-2.4.0/ruby/ruby.h:36,
                 from C:\Ruby24-x64\include\ruby-2.4.0/ruby.h:33,
                 from conftest.c:1:
C:\Ruby24-x64\include\ruby-2.4.0/ruby/win32.h: In function 'rb_w32_pow':
C:\Ruby24-x64\include\ruby-2.4.0/ruby/win32.h:786:12: warning: conversion to 'double' from 'long double' may alter its value [-Wfloat-conversion]
     return powl(x, y);
            ^~~~~~~~~~
```

This is fixed by the attached explicit type cast.

Moreover when CFLAGS is set to '-Wconversion', it prevents the compiler from
building. This is the case at the nokogiri gem.

The original issue arose at RubyInstaller2: 576a0eb70a

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 00:11:56 +00:00
nobu 0472578b26 ruby.h: check argc to rb_funcall
* include/ruby/ruby.h (rb_funcall): check if argc matches the
  number of variadic arguments, and replace with rb_funcallv.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-15 02:09:27 +00:00
normal 8e64799c96 fix RSTRUCT_LEN macro in public C API
rb_struct_size returns an Integer VALUE, so it must be converted
to a `long` for compatibility with previous Ruby C API versions.

* ext/-test-/struct/len.c: new
* test/-ext-/struct/test_len.rb: new
* include/ruby/ruby.h (RSTRUCT_LEN): use NUM2LONG
  [ruby-core:80692] [Bug #13439]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-15 00:46:00 +00:00
nobu cb52dda146 ruby.h: check argc to rb_yield_values
* include/ruby/ruby.h (rb_yield_values): check if argc matches the
  number of variadic arguments, and replace with rb_yield_values2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-14 08:33:08 +00:00
nobu ea7af54e73 thread.c: rb_thread_fd_close [ci skip]
* thread.c (rb_thread_fd_close): remove deprecated. a couple of
  external libraries used it.  [ruby-core:80078] [Bug #13304]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13 05:30:44 +00:00
nobu c617568c53 thread.c: rb_thread_fd_close [ci skip]
* thread.c (rb_thread_fd_close): re-define only for abi-check,
  abort if called.  [ruby-core:80078] [Bug #13304]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13 02:14:15 +00:00
shyouhei c56edb9a59 revert RB_FIXABLE related changesets [Bug #13288][Bug #13293][Bug #13294]
This commit is auto-generated using following command:

svn diff -r57807:57788 include internal.h bignum.c numeric.c compile.c insns.def object.c sprintf.c | patch -p0


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-09 02:31:23 +00:00
shyouhei b515528271 re-introduce __builtin_add_overflow
r57789 (74cdd89) was gradually "improve"d by naruse through r57793 to
r57806, resulted in reverting the efect of r57789 while retaining its
complexity.  I think the current situation is slightly worse than
before (same output complicated source code).

Here I introduce __builtin_add_overflow again, which (I think) is what
naruse wanted to do in r57793.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-08 04:50:22 +00:00
naruse 63c7ccc64b Always use old RB_FIXABLE to allow double as argument
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-07 19:48:00 +00:00
naruse 110760fa5d Revert r57803 "Avoid to cast the argument"
__builtin_add_overflow doesn't support double.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-07 17:51:35 +00:00
naruse 6c127aeae1 Avoid to cast the argument
For 32bit environment and __int128 use cases.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-07 17:46:54 +00:00
naruse ac6f08df23 Use ADD instead of MUL
* On recent CPUs, 2-operand MUL's latency is 3 cycle but ADD is 1 cycle.
* clang Optimizes `MUL rax,2` into `ADD rax,rax` but gcc7 doesn't.
* LONG2FIX is compiled into `lea r14,[r15+r15*1+0x1]`; this is 1cycle
  and run in parallel if the branch prediction is correct.
* Note that old (RB_POSFIXABLE(f) && RB_NEGFIXABLE(f)) is usually uses
  following instructions.
  * movabs rax,0x4000000000000000
  * add    rax,rdi
  * js
  It needs large immediate and Macro-Fusion is not applied.
  ADD and JO is much smaller though it is also Macro-Fusion unfriendly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-07 03:35:47 +00:00
shyouhei 74cdd893eb optimize FIXABLE macro
Looking at the source code, FIXABLE tends to be just before LOING2FIX
to check applicability of that operation.  Why not try computing first
then check for overflow, which should be optimial.

I also tried the same thing for unsigned types but resulted in slower
execution.  It seems RB_POSFIXABLE() is fast enough on modern CPUs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-06 11:14:05 +00:00
nobu 85ac60cfd1 broken mingw
* configure.in: check whether frexp and modf are broken.

* include/ruby/win32.h (frexp, modf): ignore bad declarations when
  compiling as C++.  [ruby-core:79859] [Bug #13267]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-03 04:51:34 +00:00
nobu f5faaf7b9a backward.h: RClassDeprecated
* include/ruby/backward.h (RClassDeprecated): move from
  ruby/ruby.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 14:42:02 +00:00
nobu 51de3aa2b2 backward.h: move deprecated declaration
* include/ruby/backward.h (rb_autoload): move declaration of
  deprecated function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 06:16:50 +00:00
nobu cd0426c00b variable.c: remove deprecated internal feature
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 06:16:49 +00:00
nobu f922f1cbeb error.c: remove deprecated internal features
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 06:07:22 +00:00
nobu f4c2b33eac complex.c: remove deprecated functions
* complex.c (rb_complex_set_real, rb_complex_set_imag): remove
  functions deprecated at 2.2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 06:07:21 +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 c9929d9f8c ruby.h: remove comment
* include/ruby/ruby.h (RB_GC_GUARD): remove comment unsupported by
  Solaris AS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-13 13:08:44 +00:00
nobu 9eb54f7fb4 ruby.h: RB_GC_GUARD stronger than gcc7
* include/ruby/ruby.h (RB_GC_GUARD): prevent guarded pointer from
  optimization by using as an input to inline asm.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-13 08:14:19 +00:00
naruse 6b1c6e0e55 Merge Onigmo 6.1.1
* Support absent operator https://github.com/k-takata/Onigmo/issues/82
* https://github.com/k-takata/Onigmo/blob/Onigmo-6.1.1/HISTORY

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-11 15:08:33 +00:00
nobu 257bf9c0d0 ruby.h: unused parameter
* include/ruby/ruby.h (rb_scan_args_set): remove unused parameter
  for more pedantic extension libraries.
  [ruby-core:79399] [Feature #13184]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-03 23:50:41 +00:00
naruse b5381899c8 fix typo [Bug #13091]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-01 16:42:43 +00:00
matz 110bfb7152 include/ruby/version.h: Update API version.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-25 16:53:00 +00:00
nobu 353395f969 get rid of implicit signedness conversions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-22 20:58:55 +00:00
naruse 5153260c30 suppress warning: implicit conversion changes signedness
It causes [Bug #13060]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-22 09:44:30 +00:00
nobu c0ff5f4dd7 st.c: fix st_hash* functions [Bug #13019]
Previous implementation had an issues:
- macros murmur1 assumes murmur_step takes rotation value
  as a second argument
- but murmur_step second argument is "next block"
- this makes st_hash_uint and st_hash_end to not mix high bits of
  hash value into lower bits
- this leads to pure hash behavior on doubles and mixing hashes using
  st_hash_uint.
  It didn't matter when bins amount were prime numbers, but it hurts
  when bins are powers of two.

Mistake were created cause of attempt to co-exist Murmur1 and Murmur2
in a same code.

Change it to single hash-function implementation.
- block function is in a spirit of Murmur functions,
  but handles inter-block dependency a bit better (imho).
- final block is read in bit more optimal way on CPU with unaligned word access,
- final block is mixed in simple way,
- finalizer is taken from MurmurHash3 (it makes most of magic :) )
  (64bit finalizer is taken from
  http://zimbry.blogspot.ru/2011/09/better-bit-mixing-improving-on.html)

Also remove ST_USE_FNV1: it lacks implementation of many functions,
and looks to be abandoned

Author: Sokolov Yura aka funny_falcon <funny.falcon@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-21 06:22:16 +00:00
usa 42d9712e78 declare `rb_w32_sysinit` in header.
* include/ruby/win32.h (rb_w32_sysinit): declare.
  [ruby-core:78444] [Bug #12994]

* ruby.c (ruby_sysinit): follow above change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-13 05:17:48 +00:00
naruse 2873edeafb Merge Onigmo 6.0.0
* https://github.com/k-takata/Onigmo/blob/Onigmo-6.0.0/HISTORY
* fix for ruby 2.4: https://github.com/k-takata/Onigmo/pull/78
* suppress warning: https://github.com/k-takata/Onigmo/pull/79
* include/ruby/oniguruma.h: include onigmo.h.
* template/encdb.h.tmpl: ignore duplicated definition of EUC-CN in
  enc/euc_kr.c. It is defined in enc/gb2313.c with CRuby macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10 17:47:04 +00:00
naruse 1f63c0fcb8 Suppress warning: this use of "defined" may not be portable
Use of defined() in macro expansion is considered non portable.
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01577.html

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-09 22:45:38 +00:00
nobu c047f58da6 ruby.h: add prefix
* include/ruby/ruby.h (RB_TEST, RB_NIL_P): prefix RB to get rid of
  name conflicts with other headers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-09 03:25:20 +00:00
nobu 5714a26b90 switching hash removal
* st.h (struct st_hash_type): Remove strong_hash.
  (struct st_table): Remove inside_rebuild_p and curr_hash.
* st.c (do_hash): Use type->hash instead of curr_hash.
  (make_tab_empty): Remove setting up curr_hash.
  (st_init_table_with_size): Remove setting up inside_rebuild_p.
  (rebuild_table): Remove clearing inside_rebuild_p.
  (reset_entry_hashes, HIT_THRESHOULD_FOR_STRONG_HASH): Remove code
  recognizing a denial attack and switching to strong hash.
* hash.c (rb_dbl_long_hash, rb_objid_hash, rb_ident_hash): Use
  rb_hash_start to randomize the hash.
  (str_seed): Remove.
  (any_hash): Remove strong_p and use always rb_str_hash for
  strings.
  (any_hash_weak, rb_any_hash_weak): Remove.
  (st_hash_type objhash): Remove rb_any_hash_weak.

based on the patch by Vladimir N Makarov <vmakarov@redhat.com> at
[ruby-core:78490].  [Bug #13002]

* test/ruby/test_hash.rb (test_wrapper): objects other than special
  constants should be able to be wrapped.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-06 04:43:48 +00:00
ktsj b16d1968e6 Revert changes on rb_frame_method_id_and_class()
r56593 introduced backwards incompatible changes in the API.
[ruby-core:78471] [Feature #12747]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-04 05:40:18 +00:00
usa f6f158c65a use `rb_struct_ptr` for `RSTRUCT_PTR` macro
* include/ruby/ruby.h (RSTRUCT_PTR): at r55788, `rb_struct_const_ptr` had been hidden and `rb_struct_ptr` had been implemented for backward compatiblity.  but the definition of `RSTRUCT_PTR` was not modified to use it, probably by mistake.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-24 20:51:45 +00:00
nobu 6839d47eb8 ruby.h: rb_big_sign
* include/ruby/ruby.h (RBIGNUM_SIGN): use a wrapper function to
  return the sign bit, instead of comparing with 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-19 04:32:52 +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
ktsj 9cbd6ee097 * vm_trace.c (tracepoint_attr_callee_id, rb_tracearg_callee_id):
add TracePoint#callee_id. [ruby-core:77241] [Feature #12747]

* cont.c, eval.c, gc.c, include/ruby/intern.h, insns.def, thread.c,
  vm.c, vm_backtrace.c, vm_core.h, vm_eval.c, vm_insnhelper.c, vm_trace.c: ditto.

* test/ruby/test_settracefunc.rb: tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 13:15:27 +00:00
nobu 8998c06461 ruby/ruby.h: optimize rb_integer_type_p
* include/ruby/ruby.h (rb_integer_type_p): turn into macro to help
  clang based on old gcc to eliminate CSE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-27 14:28:14 +00:00
nobu de2773a3ce ruby.h: use prefixed macro
* include/ruby/ruby.h (rb_intern): use prefixed version macro
  RUBY_CONST_ID_CACHE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-26 08:10:00 +00:00
nobu 2639eaebfc encoding.h: include ruby/ruby.h
* include/ruby/encoding.h: include "ruby/ruby.h" explicitly for
  enum ruby_fl_type and VALUE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-23 02:41:43 +00:00
kazu 787e878863 Add prefix to FIX2LONG in include/ruby/ruby.h
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-03 12:18:33 +00:00
nobu 432a075035 ruby.h: add prefix
* include/ruby/ruby.h (RB_INT2FIX, RB_LONG2FIX): prefix RB to
  global symbols to get rid of name conflicts with other headers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-01 23:22:30 +00:00
nobu 68aa1d81cf gc.c: rb_gc_adjust_memory_usage
* gc.c (rb_gc_adjust_memory_usage): notify memory usage to the GC
  engine by extension libraries, to trigger GC.  [Feature #12690]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-20 07:52:25 +00:00
nobu b22b725c5d util.h: POSIX-noncompliant setenv
* include/ruby/util.h (setenv): remove POSIX-noncompliant
  definition with 2 arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 08:50:39 +00:00