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

1626 Коммитов

Автор SHA1 Сообщение Дата
nobu 868ad2104c ruby.h: removed internal macros
* include/ruby/ruby.h (RCOMPLEX_SET_REAL, RCOMPLEX_SET_IMAG): removed
  macros for internal use, which have been exposed by accident.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-04 12:30:34 +00:00
nobu 1cf2bb4b20 use mingw ANSI stdio
[Bug #13496]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-04 08:39:14 +00:00
nobu c115b39e03 Declare as gnu_printf on mingw
[Bug #13496]

From: MSP-Greg <MSP-Greg@users.noreply.github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-03 08:20:41 +00:00
nobu 762f44cf49 configure.ac: printf prifix for int64_t
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 05:39:09 +00:00
kazu 842b735979 add 'x' mode character for O_EXCL
[Feature #11258]
Patch by cremno (cremno phobia)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-09 08:49:09 +00:00
kazu 14892a26a5 use https:// instead of http://
[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-28 10:00:27 +00:00
mame ffb09d8e87 eval.c: rename "rb_frozen_class_p" to "rb_class_modify_check"
Just refactoring.  Despite its name, the function does NOT return a
boolean but raises an exception when the class given is frozen.
I don't think the new name "rb_class_modify_check" is the best, but
it follows the precedeint "rb_ary_modify_check", and is definitely
better than "*_p".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-27 13:57:14 +00:00
nobu 97e05dad7f UNREACHABLE_RETURN
* include/ruby/ruby.h (UNREACHABLE_RETURN): UNREACHABLE at the end
  of non-void functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24 05:38:07 +00:00
nobu cb5598a419 Improve branch misses
Improve branch misses on frozen object predicate checks negatively
affecting performance of most setters as most objects are not frozen.

[Fix GH-1913]

From: Lourens Naudé <lourens@bearmetal.eu>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-12 05:01:04 +00:00
kazu bcf8ce8494 Fix compile error on debian8 and gentoo
https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian8/ruby-trunk/log/20180711T213004Z.log.html.gz#miniruby
https://rubyci.org/logs/rubyci.s3.amazonaws.com/gentoo/ruby-trunk/log/20180711T213003Z.log.html.gz#miniruby
```
./include/ruby/ruby.h:2213:49: error: missing binary operator before token "("
 # if defined(__has_attribute) && __has_attribute(diagnose_if)
                                                 ^
```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-12 03:59:13 +00:00
naruse 4b2f2225e4 Use "diagnose_if" attribute for clang
Before this patch, clang shows many "division by zero is undefined" errors
if a files has syntax error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-10 16:10:57 +00:00
nobu c69b33c468 rb_enc_alias
`rb_encdb`-prefixed functions are only for internal use.
use rb_enc_alias instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-28 23:46:59 +00:00
ko1 d0fb73a0f0 check enc_capable.
* encoding.c (rb_enc_capable): make it extern to check enc_capable.
  enc_index can be set to limited types such as T_STRING, T_REGEX
  and so on. This function check an object is this kind of types.

* include/ruby/encoding.h: ditto.

* encoding.c (enc_set_index): check a given object is enc_capable.

* include/ruby/encoding.h (PUREFUNC):

* marshal.c (encoding_name): check `rb_enc_capable` first.

* marshal.c (r_ivar): ditto. If it is not enc_capable, it should be
  malformed data.

* spec/ruby/optional/capi/encoding_spec.rb: remove tests depending
  on the wrong feature: all objects can set enc_index.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-28 08:35:48 +00:00
nobu 8f6b3ef184 use the prefixed macro
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27 14:00:34 +00:00
ko1 07a5e55f11 Introduce `USE_GC_MALLOC_OBJ_INFO_DETAILS`. [Feature #14857]
* include/ruby/defines.h: introduce `USE_GC_MALLOC_OBJ_INFO_DETAILS`
  to show malloc statistics by replace ruby_xmalloc() and so on with
  macros.

* gc.c (struct malloc_obj_info): introduced to save per-malloc information.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-20 07:53:29 +00:00
nobu c9b8a361be intern.h: suppress warnings
* include/ruby/intern.h (rb_fd_select): turned into an inline
  function, to suppress -Waddress warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-11 23:34:11 +00:00
ngoto b7595f2c2e include/ruby/missing.h: defined(__cplusplus) before using __cplusplus
* include/ruby/missing.h (isinf, isnan): For non-C++ programs,
  defined(__cplusplus) may be needed before using __cplusplus.
  [Bug #14816]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-05 14:16:50 +00:00
shyouhei b5d6db65b4 `int isnan(double)` is a POSIXism
- `isnan` is something relatively new.  We need to provide one for
  those systems without it.  However:
- X/Open defines `int isnan(double)`. Note the `int`.
- C99 defines `isnan(x)` to be a macro.
- C++11 nukes them all, undefines all the "masking macro"s, and
  defines its own `bool isnan(double)`.  Note the `bool`.
- In C++, `int isnan(double)` and `bool isnan(double)` are
  incompatible.
- So the mess.

[Bug #14816][ruby-core:87364]
further reading: https://developers.redhat.com/blog/2016/02/29/why-cstdlib-is-more-complicated-than-you-might-think/


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-05 06:50:20 +00:00
naruse bcdf08dd83 export rb_hash_bulk_insert
msgpack-ruby requests this function public because they want to
create a hash with bulk key value pairs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-22 07:31:36 +00:00
shyouhei 9930481a23 Prefer alignof() over _Alignof()
to allow C++ programs include <ruby.h>. [Bug #14668]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-09 02:40:12 +00:00
nobu b2033b8b84 Signature of rb_uint2inum and rb_int2inum
* include/ruby/ruby.h (rb_int2inum, rb_uint2inum): adjust
  declarations.  [ruby-core:83424] [Bug #14036]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-20 09:38:55 +00:00
nobu d77e8a7da5 Signature of rb_uint2big and rb_int2big
* include/ruby/ruby.h (rb_uint2big, rb_int2big): declare with
  uintptr_t and intptr_t instead of VALUE and SIGNED_VALUE
  respectively.  [ruby-core:83424] [Bug #14036]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-20 08:01:44 +00:00
k0kubun 288b44328d Export some missing symbols for MJIT
tool/ruby_vm/views/_insn_name_info.erb: on Linux, rb_vm_insn_name_offset
was needed to compile with --jit-debug (Usually --jit-debug requires
more symbols than the situation without --jit-debug because -O2 skips
some functions to compile).

vm.c: when running transform_mjit_header.rb with --jit-wait,
rb_source_location_cstr was repoted to be missing.

string.c: ditto, for rb_str_eql
numeric.c: ditto, for rb_float_eql

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-08 13:54:37 +00:00
k0kubun ed935aa5be mjit_compile.c: merge initial JIT compiler
which has been developed by Takashi Kokubun <takashikkbn@gmail> as
YARV-MJIT. Many of its bugs are fixed by wanabe <s.wanabe@gmail.com>.

This JIT compiler is designed to be a safe migration path to introduce
JIT compiler to MRI. So this commit does not include any bytecode
changes or dynamic instruction modifications, which are done in original
MJIT.

This commit even strips off some aggressive optimizations from
YARV-MJIT, and thus it's slower than YARV-MJIT too. But it's still
fairly faster than Ruby 2.5 in some benchmarks (attached below).

Note that this JIT compiler passes `make test`, `make test-all`, `make
test-spec` without JIT, and even with JIT. Not only it's perfectly safe
with JIT disabled because it does not replace VM instructions unlike
MJIT, but also with JIT enabled it stably runs Ruby applications
including Rails applications.

I'm expecting this version as just "initial" JIT compiler. I have many
optimization ideas which are skipped for initial merging, and you may
easily replace this JIT compiler with a faster one by just replacing
mjit_compile.c. `mjit_compile` interface is designed for the purpose.

common.mk: update dependencies for mjit_compile.c.

internal.h: declare `rb_vm_insn_addr2insn` for MJIT.

vm.c: exclude some definitions if `-DMJIT_HEADER` is provided to
compiler. This avoids to include some functions which take a long time
to compile, e.g. vm_exec_core. Some of the purpose is achieved in
transform_mjit_header.rb (see `IGNORED_FUNCTIONS`) but others are
manually resolved for now. Load mjit_helper.h for MJIT header.
mjit_helper.h: New. This is a file used only by JIT-ed code. I'll
refactor `mjit_call_cfunc` later.
vm_eval.c: add some #ifdef switches to skip compiling some functions
like Init_vm_eval.

win32/mkexports.rb: export thread/ec functions, which are used by MJIT.

include/ruby/defines.h: add MJIT_FUNC_EXPORTED macro alis to clarify
that a function is exported only for MJIT.

array.c: export a function used by MJIT.
bignum.c: ditto.
class.c: ditto.
compile.c: ditto.
error.c: ditto.
gc.c: ditto.
hash.c: ditto.
iseq.c: ditto.
numeric.c: ditto.
object.c: ditto.
proc.c: ditto.
re.c: ditto.
st.c: ditto.
string.c: ditto.
thread.c: ditto.
variable.c: ditto.
vm_backtrace.c: ditto.
vm_insnhelper.c: ditto.
vm_method.c: ditto.

I would like to improve maintainability of function exports, but I
believe this way is acceptable as initial merging if we clarify the
new exports are for MJIT (so that we can use them as TODO list to fix)
and add unit tests to detect unresolved symbols.
I'll add unit tests of JIT compilations in succeeding commits.

Author: Takashi Kokubun <takashikkbn@gmail.com>
Contributor: wanabe <s.wanabe@gmail.com>

Part of [Feature #14235]

---

* Known issues
  * Code generated by gcc is faster than clang. The benchmark may be worse
    in macOS. Following benchmark result is provided by gcc w/ Linux.
  * Performance is decreased when Google Chrome is running
  * JIT can work on MinGW, but it doesn't improve performance at least
    in short running benchmark.
  * Currently it doesn't perform well with Rails. We'll try to fix this
    before release.

---

* Benchmark reslts

Benchmarked with:
Intel 4.0GHz i7-4790K with 16GB memory under x86-64 Ubuntu 8 Cores

- 2.0.0-p0: Ruby 2.0.0-p0
- r62186: Ruby trunk (early 2.6.0), before MJIT changes
- JIT off: On this commit, but without `--jit` option
- JIT on: On this commit, and with `--jit` option

** Optcarrot fps

Benchmark: https://github.com/mame/optcarrot

|         |2.0.0-p0 |r62186   |JIT off  |JIT on   |
|:--------|:--------|:--------|:--------|:--------|
|fps      |37.32    |51.46    |51.31    |58.88    |
|vs 2.0.0 |1.00x    |1.38x    |1.37x    |1.58x    |

** MJIT benchmarks

Benchmark: https://github.com/benchmark-driver/mjit-benchmarks
(Original: https://github.com/vnmakarov/ruby/tree/rtl_mjit_branch/MJIT-benchmarks)

|           |2.0.0-p0 |r62186   |JIT off  |JIT on   |
|:----------|:--------|:--------|:--------|:--------|
|aread      |1.00     |1.09     |1.07     |2.19     |
|aref       |1.00     |1.13     |1.11     |2.22     |
|aset       |1.00     |1.50     |1.45     |2.64     |
|awrite     |1.00     |1.17     |1.13     |2.20     |
|call       |1.00     |1.29     |1.26     |2.02     |
|const2     |1.00     |1.10     |1.10     |2.19     |
|const      |1.00     |1.11     |1.10     |2.19     |
|fannk      |1.00     |1.04     |1.02     |1.00     |
|fib        |1.00     |1.32     |1.31     |1.84     |
|ivread     |1.00     |1.13     |1.12     |2.43     |
|ivwrite    |1.00     |1.23     |1.21     |2.40     |
|mandelbrot |1.00     |1.13     |1.16     |1.28     |
|meteor     |1.00     |2.97     |2.92     |3.17     |
|nbody      |1.00     |1.17     |1.15     |1.49     |
|nest-ntimes|1.00     |1.22     |1.20     |1.39     |
|nest-while |1.00     |1.10     |1.10     |1.37     |
|norm       |1.00     |1.18     |1.16     |1.24     |
|nsvb       |1.00     |1.16     |1.16     |1.17     |
|red-black  |1.00     |1.02     |0.99     |1.12     |
|sieve      |1.00     |1.30     |1.28     |1.62     |
|trees      |1.00     |1.14     |1.13     |1.19     |
|while      |1.00     |1.12     |1.11     |2.41     |

** Discourse's script/bench.rb

Benchmark: https://github.com/discourse/discourse/blob/v1.8.7/script/bench.rb

NOTE: Rails performance was somehow a little degraded with JIT for now.
We should fix this.
(At least I know opt_aref is performing badly in JIT and I have an idea
 to fix it. Please wait for the fix.)

*** JIT off
Your Results: (note for timings- percentile is first, duration is second in millisecs)

categories_admin:
  50: 17
  75: 18
  90: 22
  99: 29
home_admin:
  50: 21
  75: 21
  90: 27
  99: 40
topic_admin:
  50: 17
  75: 18
  90: 22
  99: 32
categories:
  50: 35
  75: 41
  90: 43
  99: 77
home:
  50: 39
  75: 46
  90: 49
  99: 95
topic:
  50: 46
  75: 52
  90: 56
  99: 101

*** JIT on
Your Results: (note for timings- percentile is first, duration is second in millisecs)

categories_admin:
  50: 19
  75: 21
  90: 25
  99: 33
home_admin:
  50: 24
  75: 26
  90: 30
  99: 35
topic_admin:
  50: 19
  75: 20
  90: 25
  99: 30
categories:
  50: 40
  75: 44
  90: 48
  99: 76
home:
  50: 42
  75: 48
  90: 51
  99: 89
topic:
  50: 49
  75: 55
  90: 58
  99: 99

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04 11:22:28 +00:00
nobu eaf301d2be backward.h: adjusted NORETURN declaration
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-03 01:57:00 +00:00
nobu 4c577c4a45 backward.h: rb_mod_const_missing is internal function
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-02 16:02:03 +00:00
nobu 6eeb0f7ef4 ruby.h: relax rb_funcall(obj, id, 0, 0) case only
* include/ruby/ruby.h (rb_varargs_argc_valid_p): relax rb_funcall
  check on extra args only if argc == 0, for the compatibility
  with wrong code which is probably confused with rb_funcallv.
  [Bug #14425]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-01 03:55:55 +00:00
normal 3ce9a14040 ruby.h: relax rb_funcall check on extra args for clang
clang 5.+ (tested clang 7.0.0) seems to be attempting division-by-zero
and giving a very large number for static args to rb_funcall.

* include/ruby/ruby.h (rb_varargs_bad_length): relax check for clang
* ext/-test-/funcall/funcall.c: renamed from passing_block.c
  define extra_args_name function
* test/-ext-/funcall/test_funcall.rb: new test
  [ruby-core:85266] [Bug #14425]

From: Eric Wong <e@80x24.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-30 23:55:49 +00:00
kazu ef83b306e2 Fix duplicated HAVE_NAN
And remove redundant `HAVE_*` macros,
and use `USE_RB_*` macros instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-27 04:14:26 +00:00
usa d2bd7d7b98 need to declare the prototype of nan() if missing
* include/ruby/missing.h (nan): need to declare the prototype of nan() if
  missing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-26 16:38:38 +00:00
normal 7e669f40be ruby/ruby.h: remove unnecessary exports from C-API
Needlessly exporting can reduce performance locally and increase
binary size.

Increasing the footprint of our C-API larger is also detrimental
to our development as it encourages tighter coupling with our
internals; making it harder for us to preserve compatibility.

If some parts of the core codebase needs access to globals,
internal.h should be used instead of anything in include/ruby/*.

"Urabe, Shyouhei" <shyouhei@ruby-lang.org> wrote:
> On Thu, Jan 18, 2018 at 7:33 PM, Eric Wong <normalperson@yhbt.net> wrote:
> > shyouhei@ruby-lang.org wrote:
> >>   https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61908
> >>
> >>     export rb_mFConst
> >
> > Why are we exporting all these and making the public C-API bigger?
> > If anything, we should make these static.  Thanks.
>
> No concrete reason, except they have already been externed in 2.5.
> These variables had lacked declarations so far, which resulted in their
> visibility to be that of extern. The commit is just confirming the status quo.
>
> I'm not against to turn them into static.

This reverts changes from r61910, r61909, r61908, r61907, and r61906.

* transcode.c (rb_eUndefinedConversionError): make static
  (rb_eInvalidByteSequenceError): ditto
  (rb_eConverterNotFoundError): ditto
* process.c (rb_mProcGID, rb_mProcUid, rb_mProcID_Syscall): ditto
* file.c (rb_mFConst): ditto
* error.c (rb_mWarning, rb_cWarningBuffer): ditto
* enumerator.c (rb_cLazy): ditto
  [Misc #14381]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-24 21:07:14 +00:00
shyouhei de9d264026 there is no guarantee that mode_t is as wide as int
POSIX only defines mode_t to be "an integer typea", and in fact
MacOS defines it to be uint16_t.  We didn't have NUM2USHORT before
so it did not make sense but now that we have it.  Why not check
apptopriately.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-19 09:12:06 +00:00
shyouhei 3ca0948f68 INFINITY is float. That of double is HUGE_VAL.
It seems HUGE_VAL is already used. Why not eliminate INTINITY.
NAN is also float. That of double is called nan(). This is also
fixed.

Signed-off-by: Urabe, Shyouhei <shyouhei@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-19 01:45:36 +00:00
shyouhei 8fc054fdff export transcode exceptions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-18 09:44:35 +00:00
shyouhei 2950cb0637 export rb_mProcGID, rb_mProcUid, rb_mProcID_Syscall
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-18 09:44:34 +00:00
shyouhei f64c6997be export rb_mFConst
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-18 09:44:34 +00:00
shyouhei 3cc4559c48 export ruby_mWarning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-18 09:44:33 +00:00
shyouhei 8dc9ecfef6 export rb_cLazy
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-18 09:44:32 +00:00
shyouhei 585a21318f sort lines
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-18 09:44:32 +00:00
ngoto f62a2fd1eb fix macro argument names inconsistency
* include/ruby/defines.h (RUBY_ALIGNAS): Fix macro definition.
  Fix compile error with Fujitsu C Compiler (fcc) on Solaris.

* include/ruby/defines.h (RUBY_ALIGNOF): Fix macro argument name.
  Fix compile error with fcc and Oracle Solaris Studio 12.4 on Solaris.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-16 05:49:01 +00:00
shyouhei 8a52dbdb2a ruby_aligned_char no longer needed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 07:30:43 +00:00
shyouhei 8699a7a006 take alignof instead of sizeof
win32ole.c includes ALLOCA_N(struct myCPINFOEX, 1).  On such case
it is not a wise idea to align to the size of that struct.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 06:47:56 +00:00
shyouhei 369aca64cf also blacklist gcc 4.9 for __builtin_alloca_with_align
Reports show that gcc (Raspbian 4.9.2-10) 4.9.2 fails here.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 05:51:46 +00:00
shyouhei 39ee36f63d disable __builtin_alloca_with_align for GCC 4.8
It seems to be a false positive that the configure detects this
undocumented function to be available on the compiler.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 04:36:09 +00:00
shyouhei e41b4a45a4 give up RSTRING_PTR() being VALUE-aligned
rb_setup_fake_str() can take arbitrary char* address, typicalluy
C string literals.  These arguments have no guarantee of
alignment at all.  It was not a wise idea for me to think
RSTRING_PTR can be aligned.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 04:36:09 +00:00
shyouhei cabc3b6516 __declspec(align(#)) does not take sizeof()
Use compile-time constant expression instead.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:59:18 +00:00
shyouhei 8f745a2fab more support for NORETURN
Before this NORETURN was checked only for __attribute__ or __declspec,
but nowadays other ways are there to tell compilers that a function
never returns.  Take them into account.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:35:20 +00:00
shyouhei df9a70900a __builtin_alloca_with_align for optimal memory access
ALLOCA_N takes type arugment.  It is natural that the returned
value to be used as an array of type, thus type-aligned.
Luckily GCC has a builtin to tell compiler such alignment info.
This should generate beter instructions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:35:19 +00:00
shyouhei 21429b1488 __alignof__ to take alignment of a type
C11 and C++11 has this feature so why not use it when available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:35:17 +00:00
shyouhei f089a52865 __attibute__((__aligned__)) for RSTRING_PTR()
For instance array.c:rb_ary_product() uses RSTRING_PTR() as an
array of int. So to avoid misaligned memory access RSTRING_PTR()
must at least be sizeof(int)-aligned.  However the type of
RSTRING_PTR() is char*, which of course can expect alignment as
much as 1.  This is a problem.

The reality is, there is no misaligned memory access because the
memory region behind RSTRING_PTR() is allocated using malloc().
Memory regions returned from malloc() are always aligned
appropriately.  So let's tell the compiler about this information.
It seems GCC, clang, and MSVC have such feature.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:35:16 +00:00
kazu 51edb30042 Include ruby/{io,encoding}.h before internal.h
because of r61712 and r61713

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09 12:35:12 +00:00
nobu f651ff638d wrap statement expression with __extension__
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09 00:25:27 +00:00
shyouhei a6b50f379d statement experssion is a GCCism
should mark as such.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02 06:41:53 +00:00
shyouhei 67b547d06a __VA_ARGS__ is a C99ism
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02 06:41:45 +00:00
matz 0af050993e version.h (RUBY_VERSION): 2.6.0 development has started.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-25 14:05:59 +00:00
naruse 98bddfefc1 undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P on GCC 4.8
GCC 4.8 with optimization causes error if it compiles following code.
[Bug #14221]

```c
__builtin_choose_expr(__builtin_constant_p(b),0,1)
```

https://github.com/ruby/ruby/pull/1778

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-23 16:17:57 +00:00
usa 52220154a8 force hash values fixable
* include/ruby/ruby.h (RB_ST2FIX): force fixable on LLP64 environment.

* hash.c (any_hash): ditto.
  [ruby-core:84395] [Bug #14218]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-22 08:52:11 +00:00
mame c08e8886ba compile.c: add a RUBY_EVENT_COVERAGE_LINE event for line coverage
2.5's line coverage measurement was about two times slower than 2.4
because of two reasons; (1) vm_trace uses rb_iseq_event_flags (which
takes O(n) currently where n is the length of iseq) to get an event
type, and (2) RUBY_EVENT_LINE uses setjmp to call an event hook.

This change adds a special event for line coverage,
RUBY_EVENT_COVERAGE_LINE, and adds `tracecoverage` instructions where
the event occurs in iseq.
`tracecoverage` instruction calls an event hook without vm_trace.
And, RUBY_EVENT_COVERAGE_LINE is an internal event which does not
use setjmp.

This change also cancells lineno change due to the deletion of trace
instructions [Feature #14104].  So fixes [Bug #14191].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-20 04:24:14 +00:00
naruse 027b576b31 suppress warning: 'const' attribute on function returning 'void'
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-18 09:03:59 +00:00
shyouhei b57915eddc Add FrozenError as a subclass of RuntimeError
FrozenError will be used instead of RuntimeError for exceptions
raised when there is an attempt to modify a frozen object. The
reason for this change is to differentiate exceptions related
to frozen objects from generic exceptions such as those generated
by Kernel#raise without an exception class.

From: Jeremy Evans <code@jeremyevans.net>
Signed-off-by: Urabe Shyouhei <shyouhei@ruby-lang.org>


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 00:46:34 +00:00
usa f623428d1a undef previous definition of `SIZEOF_STRUCT_STAT_ST_INO`
trying to solve build problem of MinGW.  see [Bug #14165]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-11 16:06:41 +00:00
naruse 189ecfd2eb extern rb_time_utc_offset to get utc offset
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-11 12:09:47 +00:00
usa 91de3d6539 support 128bit ino on Windows (if available)
* win32/win32.c, include/ruby/win32.h (stati128, rb_{,u,l,ul}stati128): rename
  from stati64ns, change the type of st_ino to 64bit and added st_inohigh.

* dir.c, file.c (stat, lstat): follow above changes.

* file.c (rb_stat_ino): support 128bit ino.

* win32/win32.c (rb_{,u,l,ul}stati128): ditto.
  [Feature #13731]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-10 17:26:58 +00:00
mame 55f93cb63f vm_core.h (RUBY_EVENT_COVERAGE_BRANCH): renamed
This change moves RUBY_EVENT_COVERAGE from include/ruby/ruby.h to
vm_core.h and renames it to RUBY_EVENT_COVERAGE_BRANCH.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 07:19:17 +00:00
mame 9be95d2a71 Remove RUBY_EVENT_SPECIFIED_LINE
Follow up of r61044

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 07:19:16 +00:00
usa ce7c1c0577 support nanosec file timestamp on newer Windows
Support nanosec file timestamp on Windows 8 or later.
Original patches are written by kubo (Kubo Takehiro).
Windows 7 and earlier also supports nanosec file timestamp, but it's too
accurate than system time.  so, this feature is disabled on such versions.
[Feature #13726]

this change also includes [Misc #13702]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-04 10:48:30 +00:00
naruse 31796f17d3 Update to Onigmo 6.1.3-669ac9997619954c298da971fcfacccf36909d05.
[Bug #13892]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-01 13:50:13 +00:00
k0kubun 857827e3ee vm.c: partially revert r60558
because it was actually used in
https://github.com/tmm1/rbtrace/blob/v0.4.8/ext/rbtrace.c#L329
and deprecated in r60579 AFTER removal in r60558.

ko1 agreed that we should keep just deprecated in Ruby 2.5 and remove it
later, and I'm commiting this because I want to make rbtrace.gem
installation successful.

backward.h: modify r60579 to make rb_frame_method_id_and_class()
compilable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-01 12:26:40 +00:00
nobu cea5a91163 util.h: remove my_getcwd
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-26 01:36:33 +00:00
ko1 aaa43037c2 export rb_tracearg_callee_id().
* include/ruby/debug.h (rb_tracearg_callee_id): export.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 07:41:33 +00:00
nobu b6946d31fc backward.h: rb_frame_method_id_and_class
* include/ruby/backward.h (rb_frame_method_id_and_class): moved
  a deprecated declaration from intern.h, for r60558.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-30 05:45:21 +00:00
sonots 47dd9bf7d8 Add doxygen comments
* include/ruby/ruby.h (enum ruby_value_type): add doxygen comments
* internal.h (enum imemo_type, struct vm_svar): add doxygen comments
* method.h (rb_method_type_t, rb_method_iseq_t): add doxygen comments

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:31:21 +00:00
nobu 41910c0d0e defines.h: warn EXTERN
* include/ruby/defines.h (EXTERN): warn as deprecated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-13 08:29:52 +00:00
nobu 65b87de350 ruby.h: unnormalized Fixnum value
* include/ruby/ruby.h (ST2FIX): fix unnormalized Fixnum value bug
  on mingw/mswin.  [ruby-core:82687] [Bug #13877]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-07 03:24:08 +00:00
nobu 17b3441ac4 non-keywords hash
* class.c (rb_scan_args), include/ruby/ruby.h (rb_scan_args_set):
  return non-keywords elements only in the last hash when keyword
  arguments are extracted from it, as well as methods defined in
  ruby level.  [ruby-core:82427] [Bug #13830]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-20 06:08:25 +00:00
nobu 3632bd45f5 ruby.h: fix rb_scan_args_trail_idx
* include/ruby/ruby.h (rb_scan_args_trail_idx): fix the case both
  of optional and rest arguments are defined.
  [ruby-core:82427] [Bug #13830]

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-19 23:39:03 +00:00
nobu 1ebd2b3702 ruby.h: NULL as empty array
* include/ruby/ruby.h (rb_yield_values, rb_funcall): call with
  NULL when no arguments, for clang which defines static array
  when an empty array is used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-03 08:09:24 +00:00
ko1 fb29a4dcda should not copy promoted flags.
* include/ruby/ruby.h (rb_clone_setup): should not copy some flags
  (FL_PROMOTED0|FL_PROMOTED1|FL_FINALIZE).
  [Bug #13775]

* test/ruby/test_object.rb: add a test (note that this test will fail
  only when RGENGC_CHECK_MODE >= 2).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-01 02:10:19 +00:00
yugui 7b19e6f3fd Add documents
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-22 06:30:53 +00:00
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
ngoto 4e062d14d2 * include/ruby/defines.h (ALWAYS_INLINE): Add alternative definition.
Fix compile error with compilers that do not have force inline
  attribute, including old version of fcc on Solaris 10.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-24 11:08:30 +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
nobu 7475d44308 ruby.h: use __extension__
* include/ruby/ruby.h (ruby_fl_type): use __extension__ to get rid
  of pedantic warning against RUBY_FL_USER19.
  https://github.com/skylightio/skylight-ruby/issues/64
* include/ruby/ruby.h (rb_mul_size_overflow): ditto for use of
  int128.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 06:05:14 +00:00
duerst 6ed393ad89 * regenc.h/c, include/ruby/oniguruma.h, enc/ascii.c, big5.c, cp949.c,
emacs_mule.c, euc_jp.c, euc_kr.c, euc_tw.c, gb18030.c, gbk.c,
  iso_8859_1|2|3|4|5|6|7|8|9|10|11|13|14|15|16.c, koi8_r.c, koi8_u.c,
  shift_jis.c, unicode.c, us_ascii.c, utf_16|32be|le.c, utf_8.c,
  windows_1250|51|52|53|54|57.c, windows_31j.c, unicode.c:
  Remove conditional compilation macro ONIG_CASE_MAPPING. [Feature #12386].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-24 07:33:15 +00:00
nobu c29ad01850 ruby.h: use prefixed name
* include/ruby/ruby.h (RTEST, NIL_P): use RUBY prefixed name in
  macros.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-22 19:06:07 +00:00
nobu 3674064bf2 RUBY_USE_SETJMPEX
* configure.in, include/ruby/defines.h (RUBY_USE_SETJMPEX):
  include setjmpex.h only when using setjmpex() for RUBY_SETJMP.
  the header of mingw32 overrides setjmp() by setjmpex().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 15:22:04 +00:00
nobu 5bddb94492 remove backward macros
* include/ruby/backward.h (rb_cFixnum, rb_cBignum): remove the
  backward compatibility macros, to fail incompatible extension
  libraries earily.  [Bug #12427]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 14:43:02 +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
ngoto 8a8d3e2ed4 * include/ruby/defines.h (GCC_VERSION_SINCE): Fix logic error by
adding parentheses. Fix failures of TestMkmf::TestConvertible
  with GCC 3.4.3 on Solaris 10. [Bug #12479] [ruby-dev:49660]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10 16:47:05 +00:00
duerst f0fc6ec872 * string.c: New static function rb_str_ascii_casemap; special-casing
:ascii option in rb_str_upcase_bang and rb_str_downcase_bang.
* regenc.c: Fix a bug (wrong use of unnecessary slack at end of string).
* regenc.h -> include/ruby/oniguruma.h: Move declaration of
  onigenc_ascii_only_case_map so that it is visible in string.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-08 12:28:42 +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 81d55195cf ruby.h: reduce repeated calcuations
* include/ruby/ruby.h (rb_scan_args_{hash,block}_idx): reduce
  repeated index calcuations.

* include/ruby/ruby.h (rb_scan_args_end_idx): unused right now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-02 01:54:17 +00:00
hsbt 2bd2001d16 * addr2line.c: drop to support ATARI ST platform. It was discontinued
more than two decades ago. [fix GH-1350] Patch by @cremno
* include/ruby/ruby.h: ditto.
* io.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 01:46:27 +00:00
nobu be1ceb2723 fix non-static rb_scan_args
* include/ruby/ruby.h (rb_scan_args): remove nul padding which
  caused syntax error if fmt is not a string literal.
* include/ruby/ruby.h (rb_scan_args_verify): suppress array-bounds
  warnings by old clang.
* include/ruby/ruby.h (rb_scan_args0): make extractor macros
  inline functions, which do not varidate the format and are
  unnecessary to be expanded.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-27 06:07:34 +00:00
nobu d92b58d537 ruby.h: fix parameter name
* include/ruby/ruby.h (rb_scan_args): fix macro parameter name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-27 05:44:52 +00:00
nobu 08fefd70e5 ruby.h: fix for old clang
* include/ruby/ruby.h (rb_scan_args): add nul padding here to
  apply to all references.

* include/ruby/ruby.h (rb_scan_args_verify): move length mismatch
  check outside conditional operators.

Since old clang cannot optimize away string literal dereference by
an immediate index, e.g., ""[0], and both of true and false side
expressions are compiled and warned unintentionally.  With such
old compilers, the check in rb_scan_args() does not work but may
result unpredictable value if the format is wrong.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-26 15:39:43 +00:00
nobu ef10b81c78 ruby.h: suppress warnings
* include/ruby/ruby.h (rb_scan_args_count): add filler nul bytes
  to suppress array-bounds warnings by old clang.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-26 05:16:04 +00:00
nobu be44af047a ruby.h: count and verify
* include/ruby/ruby.h (rb_scan_args_count): verify length with
  counting variables together.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-26 05:13:54 +00:00
nobu 374513ce82 revert r55171
Revert r55171, "ruby.h: fix clang warnings", it did fix
array-bounds warnings, but caused string-plus-int warnings
instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-26 05:11:07 +00:00
nobu 43079283a8 ruby.h: fix clang warnings
* include/ruby/ruby.h (rb_scan_args0): use pointer dereference
  forms instead of array forms, to get rid of warnings by clang.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-26 01:30:31 +00:00
nobu c7bc778dde ruby.h: rb_scan_args_validate
* include/ruby/ruby.h (rb_scan_args_validate): move failed
  condition to the terminal.  [ruby-core:75714] [Bug #12426]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 08:11:36 +00:00
nobu b3d3d52cd6 ruby.h: optimize rb_scan_args_set
* include/ruby/ruby.h (rb_scan_args_set): check the arity after
  adjusting argc for an option hash, for optimization in simpler
  cases.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 15:23:06 +00:00
nobu eb15df1f89 ruby.h: rb_scan_args_verify
* include/ruby/ruby.h (rb_scan_args_verify): verify the format to
  scan if no invalid chars and variable argument length matching,
  at the compile time if possible.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 09:52:14 +00:00
nobu 6a787c68bc defines.h: fallback ERRORFUNC and WARNINGFUNC
* include/ruby/defines.h (ERRORFUNC, WARNINGFUNC): add fallback
  definitions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 08:18:47 +00:00
nobu 88cc25f96d missing.h: isfinite
* include/ruby/missing.h (isfinite): move from numeric.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 12:33:39 +00:00
nobu 2d9d6caabd revert error attributes
* include/ruby/ruby.h (rb_scan_args0): revert error attributes,
  which may not be optimized away in readline extension library.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 10:45:13 +00:00
nobu a6144809eb make compile error if possible
* include/ruby/ruby.h (rb_scan_args0): make compile error if the
  format is wrong or does not match with the variable argument
  length if possible.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 04:19:43 +00:00
nobu 14c43e2be6 fatal error if variable argument length mismatch
* include/ruby/ruby.h (rb_scan_args0): raise fatal error if
  variable argument length does not match, it is a bug in the code
  which uses rb_scan_args, not a runtime error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 03:47:11 +00:00
duerst 78c5ca7074 * include/ruby/oniguruma.h: Extend OnigEncodingTypeDefine to define a
new encoding primitive 'case_map' for case mapping
* enc/utf-8.c, utf_16be/le.c, utf_32be/le.c:
  add onigenc_unicode_case_map as case_map primitive
* enc/ascii.c, big5.c, cp949.c, emacs_mule.c, euc_jp/kr/tw.c, gb18030.c,
  gbk.c, iso_8859_1/2/3/4/5/6/7/8/9/10/11/13/14/15/16.c, koi8_r/u.c,
  shift_jis.c, us_ascii.c, windows_1250/1251/1252.c:
  add onigenc_not_support_case_map as case_map primitive


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 05:57:44 +00:00
naruse cadbde584a * include/ruby/ruby.h (rb_scan_args): use original rb_scan_args
when fmt is dynamic.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 03:31:22 +00:00
naruse 75307ce858 * class.c (rb_scan_args): moved to bottom of the file to make the
effect of `#undef rb_scan_args` the minimum.

* include/ruby/ruby.h (rb_scan_args): overwrite only if GCC and
  optimized. Visual C++ 14 or later can compile it but make it
  conservative.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 02:44:54 +00:00
naruse 8becb1e465 Revert r50102
This reverts "* include/ruby/ruby.h (rb_scan_args): don't use ALWAYS_INLINE with"
This rb_scan_args macro is GCCism.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 14:01:23 +00:00
usa 3caa177668 * include/ruby/ruby.h (rb_scan_args): don't use ALWAYS_INLINE with
`inline`.  if gcc needs this duplication, do in ALWAYS_INLINE macro.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 13:47:06 +00:00
naruse cc41066002 * include/ruby/ruby.h (rb_scan_args): use __VA_ARGS__ instead of
va_arg to allow compilers optimize more aggressive.
  https://gustedt.wordpress.com/2011/07/10/avoid-writing-va_arg-functions/
  rb_scan_args is now expected to be statically resolved.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 13:24:33 +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 4a9705d6e3 ruby.h: RB_INTEGER_TYPE_P
* include/ruby/ruby.h (RB_INTEGER_TYPE_P): new macro and
  underlying inline function to check if the object is an
  Integer (Fixnum or Bignum).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 01:17:43 +00:00
akr f9727c12cc [Feature #12005] Unify Fixnum and Bignum into Integer
* [Feature #12005] Unify Fixnum and Bignum into Integer

* include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums.

* insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from
  FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG.

* vm_core.h: Ditto.

* vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead
  of FIXNUM_REDEFINED_OP_FLAG.

* vm.c (vm_redefinition_check_flag): Use rb_cInteger instead of
  rb_cFixnum and rb_cBignum.
  (C): Use Integer instead of Fixnum and Bignum.

* numeric.c (fix_succ): Removed.
  (Init_Numeric): Define Fixnum as Integer.

* bignum.c (bignew): Use rb_cInteger instead of Rb_cBignum.
  (rb_int_coerce): replaced from rb_big_coerce and return fixnums
  as-is.
  (Init_Bignum): Define Bignum as Integer.
  Don't define ===.

* error.c (builtin_class_name): Return "Integer" for fixnums.

* sprintf.c (ruby__sfvextra): Use rb_cInteger instead of rb_cFixnum.

* ext/-test-/testutil: New directory to test.
  Currently it provides utilities for fixnum and bignum.

* ext/json/generator/generator.c: Define mInteger_to_json.

* lib/mathn.rb (Fixnum#/): Redefinition removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 06:53:48 +00:00
duerst 65db16de9f * include/ruby/oniguruma.h: Introducing ONIG_CASE_MAPPING compilation
switch
* include/ruby/oniguruma.h, enc/unicode.h: Using ONIG_CASE_MAPPING
  compilation switch


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-16 10:46:32 +00:00
nobu 3bdf613a45 defines.h: avoid redefinition
* include/ruby/defines.h (GCC_VERSION_SINCE): get rid of
  re-definition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-12 23:35:20 +00:00
naruse 4e080d26f2 fix typo in r54988
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-12 18:27:05 +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
usa 2cb362b51f * include/ruby/{defines,ruby}.h: need to define function attributes
alternatives in defines.h instead of ruby.h, because they are used
  in oniguruma.h and the header used without including ruby.h at
  encoding library sources.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08 22:20:05 +00:00
usa a8e1070d9d * include/ruby/ruby.h (CONSTFUNC, PUREFUNC): fixed build errors on
non-gcc build environments introduced at r54952.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08 21:31:23 +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
nobu 65bbd0884c intern.h: suppress warnings
* include/ruby/intern.h (rb_disable_super, rb_enable_super):
  remove NORETURN.  these do nothing but just return.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08 03:21:28 +00:00
naruse a6c8e8d15b * configure.in: add -Wsuggest-attribute=noreturn and suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08 00:55:28 +00:00
usa 3e5dc499a8 * win32/win32.c, include/ruby/win32.h (rb_w32_utruncate): implements new
truncate alternative which accepts UTF-8 path.

* file.c (truncate): use above function.
  [Bug #12340]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-02 14:05:19 +00:00
naruse b888ee25ff revert UNALIGNED_WORD_ACCESS for GCC6
Released GCC 6.0 fixed the issue.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69291
[ruby-core:72211] [Bug #11831] [Bug #11979]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 15:39:03 +00:00
naruse 973ba3e8e2 * include/ruby/ruby.h (rb_mul_size_overflow): use UNLIKELY
by user side to improve generallity.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23 07:15:26 +00:00
naruse 5587badf24 * include/ruby/ruby.h (RB_LIKELY): use prefix in ruby.h.
* intern.h (LIKELY): define with RB_LIKELY.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23 07:15:25 +00:00
naruse fac42e6c76 * include/ruby/ruby.h (rb_mul_size_overflow): added to handle
mul overflow efficiently.

* include/ruby/ruby.h (rb_alloc_tmp_buffer2): use rb_mul_size_overflow
  and avoid division where it can define DSIZE_T.

* gc.c (xmalloc2_size): moved from ruby.h and use rb_mul_size_overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22 11:42:31 +00:00
naruse 3738fe3333 * variable.c: use uint32_t instead of long to avoid confusion about
the type of ivtbl->numiv.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22 09:47:34 +00:00
naruse feaa82a42b * gc.c (rb_alloc_tmp_buffer_with_count): added like xmalloc2 to
avoid duplicated check of size.

* gc.c (ruby_xmalloc2): added to keep separate layers.

* include/ruby/ruby.h (rb_alloc_tmp_buffer2): added to check
  the size more statically.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-21 20:59:40 +00:00
naruse 54c1f47930 * include/ruby/ruby.h (LIKELY): moved from internal.h.
* include/ruby/ruby.h (UNLIKELY): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-21 20:59:39 +00:00
naruse fe120ac1f1 * gc.c (objspace_malloc_prepare): remove size check because it is
used by objspace_xmalloc and objspace_xcalloc.
  objspace_xmalloc introduces its own check in this commit.
  objspace_xcalloc checks with xmalloc2_size (ruby_xmalloc2_size).

* gc.c (objspace_xmalloc0): common xmalloc function.

* gc.c (objspace_xmalloc): introduce its own size check.

* gc.c (objspace_xmalloc2): separated from ruby_xmalloc2 to clarify
  the layer who has the responsibility to check the size.

* gc.c (objspace_xrealloc): remove duplicated size check.

* gc.c (ruby_xmalloc2): use objspace_xmalloc2.

* include/ruby/ruby.h (ruby_xmalloc2_size): follow the size limit
  as SSIZE_MAX. Note that ISO C says size_t is unsigned integer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-21 20:59:39 +00:00
nobu d2e214736f rb_check_arity returns argc now
* include/ruby/intern.h (rb_check_arity): returns argc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-02 06:24:19 +00:00
naruse 723241fcb9 * include/ruby/ruby.h (rb_isupper, rb_islower, rb_isalpha, rb_isdigit,
rb_isalnum, rb_isxdigit, rb_isblank, rb_isspace, rb_isblank,
  rb_iscntrl, rb_isprint, rb_ispunct, rb_isgraph,
  rb_tolower, rb_toupper): use inline function to avoid function call.

* include/ruby/ruby.h (rb_isascii): use inline function to clarify
  the logic.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-29 10:24:05 +00:00
duerst 2f455ceca4 * include/ruby/oniguruma.h: Additional flag for characters that are titlecase.
* enc/unicode/case-folding.rb, casefold.h: Using above flag in data.
* enc/unicode.c: Marking capitalized character as unmodified if it is
  already titlecase.
* test/ruby/enc/test_case_mapping.rb: Tests for above functionality.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-22 12:08:30 +00:00
mrkn fa860a9497 * include/ruby/intern.h (rb_big_odd_p, rb_big_even_p): move to
internal.h so that they are exported only for ruby itself.

* internal.h (rb_big_odd_p, rb_big_even_p): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-19 16:08:52 +00:00
mrkn 2897eb11a0 * include/ruby/intern.h (rb_big_hash): Move to internal.h.
* internal.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 13:33:42 +00:00
mrkn f8e79c84a9 * bignum.c (rb_big_hash): make it public function to be available in
other source files, and remove documentation comment for Bignum#hash.

* bignum.c (Bignum#hash): remove its definition because it is unified
  with Object#hash.

* include/ruby/intern.h (rb_big_hash): add a prototype declaration.

* hash.c (any_hash): treat Bignum values directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 01:22:38 +00:00
mrkn a3c9cda6d7 * bignum.c (rb_big_even_p, rb_big_odd_p): make them public functions
to be available in other source files.

* include/ruby/intern.h (rb_big_even_p, rb_big_odd_p): add prototype
  declarations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 17:07:29 +00:00
nobu 37153c03f8 ruby.h: remove RB_GC_GUARD_PTR
* include/ruby/ruby.h (RB_GC_GUARD_PTR): remove intermediate
  macro, and expand for each RB_GC_GUARD.  [Fix GH-1293]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 13:21:36 +00:00
duerst 4b15b54d68 * include/ruby/oniguruma.h, enc/unicode.c: Adjusting flag assignments
and macros to work with unified CaseMappingSpecials array.
  (with Kimihito Matsui)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-14 09:39:54 +00:00
nobu e13db770f4 win32.h: fix O_SHARE_DELETE
* include/ruby/win32.h (O_SHARE_DELETE): change to fit Fixnum
  limit.  [ruby-core:74285] [Bug #12171]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-13 00:43:25 +00:00
nobu 8e1a0856ed internal.h: functions for class internals
* internal.h: move function declarations for class internals from
  include/ruby/intern.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-07 04:28:32 +00:00
svn 35f40f5347 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-24 13:32:02 +00:00
duerst f1f48e6103 * include/ruby/oniguruma.h: Rearranging flag assignments and making
space for titlecase indices; adding additional macros to add or
  extract titlecase index; adding comments for better documentation.
* enc/unicode.c: Moving some macros to include/ruby/oniguruma.h;
  activating use of titlecase indices.
  (with Kimihito Matsui)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-24 13:32:01 +00:00
nobu 383555fe44 encoding.h: rb_enc_asciicompat_inline
* include/ruby/encoding.h (rb_enc_asciicompat): turn into an
  inline function to get rid of evalucating the argument twice.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-04 03:16:50 +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 fd7b490fc3 disable unaligned word access
* include/ruby/defines.h, st.c: disable unaligned word access with
  gcc 6 or later.  [Bug #11831]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-15 13:15:39 +00:00
duerst eb86cd6b7b include/ruby/oniguruma.h: Added flags needed for upcase/downcase
Unicode addition (with Kimihito Matsui)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-11 12:28:55 +00:00
nobu d138a11095 io.h: remove old macros
* include/ruby/io.h (RB_IO_BUFFER_INIT, RB_IO_FPTR_NEW): remove
  old macros only for internal use and obsolete since 2.2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-11 00:01:12 +00:00
nobu 09bdb7913c missing.h: remove explicit_bzero_by_memset_s
* include/ruby/missing.h (explicit_bzero_by_memset_s): remove
  inline implementation by memset_s, which needs a macro before
  including headers and can cause problems in extension libraries
  by the order of the macro and headers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-10 06:45:36 +00:00
mrkn 98e565ec78 * ruby.h: undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
and HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P on C++.
  [ruby-core:72736] [Bug #11962]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-07 13:35:32 +00:00
nobu 7aab062ef3 version.c: no exit in ruby_show_copyright
* include/ruby/backward.h (ruby_show_copyright_to_die): for source
  code backward compatibility.
* ruby.c (process_options): return Qtrue to exit the process
  successfully.
* version.c (ruby_show_copyright): no longer exit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-07 02:34:33 +00:00
matz fe2123f3ec version.h (RUBY_VERSION): 2.4.0 development has started.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-25 12:40:38 +00:00
duerst 0ab9e70625 doc/CangeLog-2.3.0, ext/tk/lib/txextlib/SUPPORT_STATUS,
include/ruby/version.h: minor grammar fixes [ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-25 05:12:16 +00:00
nobu 22d8481f08 fix common misspelling [ci skip]
* compile.c, cont.c, doc, man: fix common misspelling.
  [ruby-core:72466] [Bug #11870]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-24 23:23:46 +00:00
nobu 94090b0502 deprecate exposed internal functions
* error.c (rb_compile_error_with_enc, rb_compile_error),
  (rb_compile_bug): deprecate internal functions.
* parse.y (parser_yyerror): construct exception message with
  source code and carret.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-24 09:43:22 +00:00
nobu f9adadc5e6 rb_readwrite_syserr_fail
* io.c (rb_readwrite_syserr_fail): works with the given errno than
  thread local errno.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-23 14:58:47 +00:00
normal a2e025a7d0 introduce rb_autoload_str to replace rb_autoload
rb_autoload_str may be safer by preventing premature GC.  It
can also be more efficient by passing a pre-frozen string that
can be deduped using rb_fstring.  Common autoload callers (e.g.
rubygems, rdoc) already use string literals as the file
argument.

There seems to be no reason to expose rb_autoload_str to the
public C API since autoload is not performance-critical.
Applications may declare autoloads in Ruby code or via
rb_funcall; so merely deprecate rb_autoload without exposing
rb_autoload_str to new users.

Running: valgrind -v ruby -rrdoc -rubygems -e exit
shows a minor memory reduction (32-bit userspace)

before:

  in use at exit: 1,600,621 bytes in 28,819 blocks
total heap usage: 55,786 allocs, 26,967 frees, 6,693,790 bytes allocated

after:

  in use at exit: 1,599,778 bytes in 28,789 blocks
total heap usage: 55,739 allocs, 26,950 frees, 6,692,973 bytes allocated

* include/ruby/intern.h (rb_autoload): deprecate
* internal.h (rb_autoload_str): declare
* load.c (rb_mod_autoload): use rb_autoload_str
* variable.c (rb_autoload): become compatibility wrapper
  (rb_autoload_str): hoisted out from old rb_autoload
  [ruby-core:71369] [Feature #11664]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-06 12:28:09 +00:00
ngoto bc9ac3ab7f * include/ruby/ruby.h (RB_OBJ_TAINT): follow-up of r52881.
Turn into void expression not to use unexpected result.
  Fix "operands have incompatible types" error with
  Oracle Solaris Studio 12.x on Solaris.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-04 15:59:10 +00:00
nobu 7eb6942dbb ruby.h: make flag setting macros void
* include/ruby/ruby.h (RB_FL_{SET,UNSET,REVERSE,INFECT,FREEZE}):
  turn into void expressions not to use unexpected results.  these
  macros were statements till 2.2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-04 07:32:05 +00:00
nobu bc6e31eebf missing.h: __STDC_WANT_LIB_EXT1__
* include/ruby/missing.h: get rid of redefinition of
  __STDC_WANT_LIB_EXT1__.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02 09:17:42 +00:00
nobu 4a7dedf7f0 missing.h: __STDC_WANT_LIB_EXT1__
* include/ruby/missing.h: __STDC_WANT_LIB_EXT1__ is necessary for
  memset_s.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02 01:50:34 +00:00
nobu 24dcb1285d explicit_bzero.c: needs windows.h
* missing/explicit_bzero.c, random.c (explicit_bzero):
  SecureZeroMemory() needs windows.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-01 03:52:20 +00:00
nobu e84000fcba missing.h: explicit_bzero by SecureZeroMemory
* include/ruby/missing.h (explicit_bzero): use SecureZeroMemory on
  Windows.  assume Windows XP or later at compile time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-01 01:39:24 +00:00
nobu 10bb9e6fab missing.h: explicit_bzero by memset_s
* include/ruby/missing.h (explicit_bzero_by_memset_s): call
  memset_s directly if available.

* missing/explicit_bzero.c: optimization is not a matter if
  memset_s is available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-01 01:24:23 +00:00
nobu ff113d52f7 configure.in: FUNC_UNOPTIMIZED
* configure.in: check if optimize pragma is supported.

* include/ruby/defines.h (FUNC_UNOPTIMIZED): fallback definition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-01 01:05:48 +00:00
kosaki 86caaefc1f * include/ruby/util.h: remove a warning suppression C4723
(potential divide by zero) for VisualC++. It's meaningless.
  Before r26197, there is ruby_div0() in this place and it
  actually made divide by zero. But now it's just garbage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:27:52 +00:00
kosaki dea685c783 * missing/explicit_bzero.c: new file. define explicit_bzero.
* common.mk: add a rule for explicit.o.
* configure.in: detect explicit_bzero and memset_s.
* include/ruby/missing.h: add explicit_bzero.
* random.c (init_randomseed): use explicit_bzero() instead of
  memset(). memset could be eliminated by compiler optimization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:26:13 +00:00
nobu 13a935b0ba Drop support for BeOS
* beos: Drop support for BeOS now that Haiku is stable.
  [Fix GH-1112]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24 00:17:11 +00:00
nobu e29c109d2a Haiku now best effort support
* configure.in: remove obsolete workarounds for Haiku.
* dln.c, file.c, io.c: remove obsolete Haiku workarounds.
* thread_pthread.c: add stack bounds detection for Haiku.
* signal.c: get stack pointer from signal context on Haiku.
  [ruby-core:67923] [Bug #10811] [Fix GH-1109]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 03:54:42 +00:00
naruse f1df08e76d * time.c (rb_timespec_now): added.
* time.c (rb_time_timespec_new): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-10 02:59:47 +00:00
ko1 92861a1163 * include/ruby/ruby.h (RSTRUCT_PTR): need a close parenthese.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-06 18:35:29 +00:00
ngoto fcf63d1e54 * include/ruby/ruby.h (rb_array_const_ptr, rb_struct_const_ptr):
Suppress pointer type mismatch warnings occurred with old version
  of Fujitsu C Compiler (fcc) on Solaris 10. The warnings cause
  failure of TestMkmf::TestConvertible. [Bug #11644] [ruby-dev:49326]
* include/ruby/ruby.h (FIX_CONST_VALUE_PTR): macro for the above,
  only effective with fcc.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-06 09:19:14 +00:00
normal 2f418fb363 include/ruby/ruby.h (struct RObject): hide iv_index_tbl type
This is an implementation detail and should not be exposed to
C extension users.  We may change this to id_table soon; and
id_table should not be exposed as a public API.

It is highly unlikely any existing C extensions require this;
so the risk of breakage is very low.  Ideally, all of RObject
could be hidden.

[ruby-core:71306] [Feature #11647]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-03 21:16:48 +00:00
ko1 ffa87b4057 * gc.c: introduce rb_wb_unprotected_newobj_of() and
rb_wb_protected_newobj_of(), pass the WB_PROTECTED
  information explicitly.

* internal.h: use introduced functions by NEWOBJ_OF().
  `flag' is immediate value, so that C compilers can
  solve them at compile time.

* include/ruby/ruby.h: add a commnent about that.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29 07:26:44 +00:00
nobu 96003bc9ac missing.h: fix condition
* include/ruby/missing.h (bytesequence4_or_float): define by
  configured result.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-20 07:15:16 +00:00
nobu 603cdc2710 check INFINITY and NAN without C99 option
* configure.in: check INFINITY and NAN without an option for C99
  so that rb_infinity and rb_nan are respectively available
  regardless that option if they may be used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-19 16:29:31 +00:00
nobu 4eba615a0b disable warnings unless optimized
* include/ruby/ruby.h (rb_data_object_{wrap,get}): move
  declarations inside ifdef too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 10:21:35 +00:00
nobu 6094ac4ce8 disable warnings unless optimized
* include/ruby/ruby.h (rb_data_object_{wrap,get,make}): warn only
  if optimized, as __builtin_choose_expr() does not work fine
  unless optimized.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 05:53:26 +00:00
kosaki 0bdf13a104 * include/ruby/backward/util.h: Good-by Borland-C.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 05:41:34 +00:00
kosaki 3a48e12607 * numeric.c: Good-by Borland-C.
* include/ruby/backward/rubyio.h: ditto.
* include/ruby/backward/st.h: ditto.
* include/ruby/backward/util.h: ditto.
* include/ruby/backward/rubysig.h: ditto.
* include/ruby/backward/classext.h: ditto.
* dln.c: ditto.
* gc.c: ditto.
* win32/resource.rb: ditto.
* win32/dir.h: ditto.
* ext/tk/tcltklib.c: ditto.
* NEWS: announce that Borland-C is no longer supported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 02:10:34 +00:00
kosaki 4ad2057f27 * ChangeLog: Good-bye OS/2.
* common.mk: ditto.
* configure.in: ditto.
* dln_find.c: ditto.
* ext/Setup.emx: ditto.
* ext/extmk.rb: ditto.
* ext/socket/extconf.rb: ditto.
* ext/zlib/extconf.rb: ditto.
* file.c: ditto.
* include/ruby/defines.h: ditto.
* io.c: ditto.
* lib/mkmf.rb: ditto.
* missing/os2.c: ditto.
* process.c: ditto.
* ruby.c: ditto.
* NEWS: announce OS/2 is no longer supported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 01:18:34 +00:00
kosaki 6803c4e2a8 * include/ruby/defines.h (DOSISH): add comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 01:17:50 +00:00
nobu d250a33062 ruby.h: RB_OBJ_FROZEN_RAW
* include/ruby/ruby.h (RB_OBJ_FROZEN_RAW): split from
  RB_OBJ_FROZEN.  valid only for non-special-const objects.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-07 12:40:34 +00:00
nobu 334710c155 ruby.h: inlines
* include/ruby/ruby.h: turn function macros into inline functions,
  for debuggers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06 04:56:16 +00:00
nobu fd89a96837 ruby.h: enums
* include/ruby/ruby.h: turn constant macros into enums, for
  debuggers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06 04:54:10 +00:00
nobu 077e2037eb ruby.h: RUBY_FL_PROMOTED
* include/ruby/ruby.h (ruby_fl_type): revive RUBY_FL_PROMOTED for
  .gdbinit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-16 08:15:58 +00:00
nobu 1e3a1bbb66 ruby.h: add prefix
* include/ruby/ruby.h: prefix RUBY or RB to global symbols to get
  rid of name conflicts with other headers.
* include/ruby/encoding.h, include/ruby/intern.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-13 02:03:31 +00:00
nobu f150a381db win32.c: more fcntl
* win32/win32.c (fcntl): implement F_GETFD, F_SETFD, and
  F_DUPFD_CLOEXEC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-12 05:23:22 +00:00
nobu 5e57dc0fae ruby.h: eval ASSUME argument
* include/ruby/ruby.h (ASSUME): evaluate the argument just once
  everywhere.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-05 23:14:18 +00:00
nobu 141ff8e6a0 win32.h: fix macro name
* include/ruby/win32.h: fix macro name for VC runtime version,
  RT_VER is only in Makefile.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-04 14:26:24 +00:00
nobu 8b9ad9d6f0 oniguruma.h: constify
* include/ruby/oniguruma.h (OnigEncodingTypeST): constify
  property_name_to_ctype arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-27 19:49:45 +00:00
nobu 2e5c105ff2 win32.c: symlink
* win32/win32.c (w32_symlink): implement symlink().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-24 21:34:45 +00:00
ko1 3af5298e8c * include/ruby/ruby.h, cont.c, vm_trace.c: add a new event
fiber_switch. We need more discussion about this feature
  so that I don't write it on NEWS.
  [Feature #11348]
* test/ruby/test_settracefunc.rb: add tests.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-21 09:51:01 +00:00
nobu 0eca22904b ruby.h: define RClass only in C
* include/ruby/ruby.h (RClass): define only in C, `__attribute__`
  between `struct` and the name can't compile with g++.
  [ruby-core:70297] [Bug #11426]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-18 07:16:24 +00:00
nobu 49389fe59d ruby.h: adjust for g++
* include/ruby/ruby.h (RClass): move `__attribute__` after the
  keyword `struct` for g++.  [ruby-core:70297] [Bug #11426]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-18 02:40:55 +00:00