aboutsummaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Improve branch missesnobu2018-07-121-1/+1
| | | | | | | | | | | 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
* Fix compile error on debian8 and gentookazu2018-07-121-1/+4
| | | | | | | | | | | | 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
* Use "diagnose_if" attribute for clangnaruse2018-07-101-11/+24
| | | | | | | 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
* rb_enc_aliasnobu2018-06-281-0/+1
| | | | | | | `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
* check enc_capable.ko12018-06-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | * 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
* use the prefixed macronobu2018-06-271-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Introduce `USE_GC_MALLOC_OBJ_INFO_DETAILS`. [Feature #14857]ko12018-06-201-6/+83
| | | | | | | | | | | * 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
* intern.h: suppress warningsnobu2018-06-111-1/+9
| | | | | | | * 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
* include/ruby/missing.h: defined(__cplusplus) before using __cplusplusngoto2018-06-051-2/+2
| | | | | | | | | * 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
* `int isnan(double)` is a POSIXismshyouhei2018-06-051-0/+6
| | | | | | | | | | | | | | | | | | - `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
* export rb_hash_bulk_insertnaruse2018-05-221-0/+2
| | | | | | | 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
* Prefer alignof() over _Alignof()shyouhei2018-04-091-0/+3
| | | | | | | 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
* Signature of rb_uint2inum and rb_int2inumnobu2018-02-201-2/+2
| | | | | | | * 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
* Signature of rb_uint2big and rb_int2bignobu2018-02-201-2/+2
| | | | | | | | * 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
* Export some missing symbols for MJITk0kubun2018-02-081-1/+3
| | | | | | | | | | | | | | | 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
* mjit_compile.c: merge initial JIT compilerk0kubun2018-02-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* backward.h: adjusted NORETURN declarationnobu2018-02-031-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* backward.h: rb_mod_const_missing is internal functionnobu2018-02-022-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.h: relax rb_funcall(obj, id, 0, 0) case onlynobu2018-02-011-4/+6
| | | | | | | | | * 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
* ruby.h: relax rb_funcall check on extra args for clangnormal2018-01-301-0/+2
| | | | | | | | | | | | | | | 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
* Fix duplicated HAVE_NANkazu2018-01-271-1/+3
| | | | | | | 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
* need to declare the prototype of nan() if missingusa2018-01-261-0/+4
| | | | | | | | * 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
* ruby/ruby.h: remove unnecessary exports from C-APInormal2018-01-241-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* there is no guarantee that mode_t is as wide as intshyouhei2018-01-191-0/+4
| | | | | | | | | 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
* INFINITY is float. That of double is HUGE_VAL.shyouhei2018-01-191-0/+4
| | | | | | | | | | 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
* export transcode exceptionsshyouhei2018-01-181-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* export rb_mProcGID, rb_mProcUid, rb_mProcID_Syscallshyouhei2018-01-181-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* export rb_mFConstshyouhei2018-01-181-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* export ruby_mWarningshyouhei2018-01-181-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* export rb_cLazyshyouhei2018-01-181-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* sort linesshyouhei2018-01-181-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix macro argument names inconsistencyngoto2018-01-161-2/+2
| | | | | | | | | | | * 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
* ruby_aligned_char no longer needed.shyouhei2018-01-151-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* take alignof instead of sizeofshyouhei2018-01-151-2/+2
| | | | | | | | 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
* also blacklist gcc 4.9 for __builtin_alloca_with_alignshyouhei2018-01-151-3/+3
| | | | | | | 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
* disable __builtin_alloca_with_align for GCC 4.8shyouhei2018-01-151-0/+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
* give up RSTRING_PTR() being VALUE-alignedshyouhei2018-01-151-3/+3
| | | | | | | | | 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
* __declspec(align(#)) does not take sizeof()shyouhei2018-01-151-3/+3
| | | | | | | Use compile-time constant expression instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* more support for NORETURNshyouhei2018-01-151-4/+11
| | | | | | | | 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
* __builtin_alloca_with_align for optimal memory accessshyouhei2018-01-151-0/+8
| | | | | | | | | 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
* __alignof__ to take alignment of a typeshyouhei2018-01-151-0/+10
| | | | | | 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
* __attibute__((__aligned__)) for RSTRING_PTR()shyouhei2018-01-152-9/+12
| | | | | | | | | | | | | | | | 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
* Include ruby/{io,encoding}.h before internal.hkazu2018-01-092-0/+8
| | | | | | because of r61712 and r61713 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* wrap statement expression with __extension__nobu2018-01-091-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* statement experssion is a GCCismshyouhei2018-01-021-6/+6
| | | | | | should mark as such. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* __VA_ARGS__ is a C99ismshyouhei2018-01-021-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* version.h (RUBY_VERSION): 2.6.0 development has started.matz2017-12-251-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P on GCC 4.8naruse2017-12-232-2/+15
| | | | | | | | | | | | | 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
* force hash values fixableusa2017-12-221-0/+4
| | | | | | | | | | * 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
* compile.c: add a RUBY_EVENT_COVERAGE_LINE event for line coveragemame2017-12-201-1/+1
| | | | | | | | | | | | | | | | | | | 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