aboutsummaryrefslogtreecommitdiffstats
path: root/internal
Commit message (Collapse)AuthorAgeFilesLines
* Separate objspace argument for rb_gc_disable and rb_gc_enableNobuyoshi Nakada2020-02-091-0/+3
|
* Extract a function, ruby_reset_timezone().Tanaka Akira2020-01-281-0/+1
| | | | | Initial implementation of ruby_reset_timezone() assigns ruby_tz_uptodate_p to false.
* Added rb_warn_deprecated_to_removeNobuyoshi Nakada2020-01-231-0/+1
| | | | | Warn the deprecation and future removal, with obeying the warning flag.
* internal/rational.h: insert assertions in RATIONAL_SET_{NUM,DEN}Kenta Murata2020-01-172-0/+17
|
* Make RATIONAL_SET_{NUM,DEN} static inline functionsKenta Murata2020-01-171-2/+16
|
* add missing #include卜部昌平2020-01-101-0/+1
|
* avoid undefined behaviour when n==0卜部昌平2020-01-101-7/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ISO/IEC 9899:1999 section 6.5.7 states that "If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined". So we have to take care of such situations. This has not been a problem because contemporary C compilers are extraordinary smart to compile the series of shifts into a single ROTLQ/ROTRQ machine instruction. In contrast to what C says those instructions have fully defined behaviour for all possible inputs. Hence it has been quite difficult to observe the undefined-ness of such situations. But undefined is undefined. We should not rely on such target-specific assumptions. We are fixing the situation by carefully avoiding shifts with out-of- range values. At least GCC since 4.6.3 and Clang since 8.0 can issue the exact same instructions like before the changeset. Also in case of Intel processors, there supposedly be intrinsics named _rotr/_rotl that do exactly what we need. They, in practice, are absent on Clang before 9.x so we cannot blindly use. But we can at least save MSVC. See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57157 https://bugs.llvm.org/show_bug.cgi?id=17332
* more use of MSC_VERSION_SINCE卜部昌平2020-01-101-16/+18
| | | | | | Replaces `#ifdef _MSC_VER` with more accurate version checks. Also, `defined(_WIN64) && defined(__AVX2__)` is redundant because there is no such tihng like a 32bit AVX2 machine.
* fix Windows breakage卜部昌平2020-01-101-2/+2
| | | | | | Fixing typo revealed that _BitScanReverse is BSR, which behaves differently than LZCNT. What we want here is LZCNT so we have to emulate.
* fix typos卜部昌平2020-01-101-3/+3
|
* Fully separate positional arguments and keyword argumentsJeremy Evans2020-01-021-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This removes the warnings added in 2.7, and changes the behavior so that a final positional hash is not treated as keywords or vice-versa. To handle the arg_setup_block splat case correctly with keyword arguments, we need to check if we are taking a keyword hash. That case didn't have a test, but it affects real-world code, so add a test for it. This removes rb_empty_keyword_given_p() and related code, as that is not needed in Ruby 3. The empty keyword case is the same as the no keyword case in Ruby 3. This changes rb_scan_args to implement keyword argument separation for C functions when the : character is used. For backwards compatibility, it returns a duped hash. This is a bad idea for performance, but not duping the hash breaks at least Enumerator::ArithmeticSequence#inspect. Instead of having RB_PASS_CALLED_KEYWORDS be a number, simplify the code by just making it be rb_keyword_given_p().
* move internal/debug.h definitions to internal.hKoichi Sasada2020-01-031-39/+0
| | | | Debug utilities should be accessible from any internal code.
* Introduce BIGNUM_EMBED_P to check BIGNUM_EMBED_FLAG (#2802)Kenta Murata2019-12-311-2/+10
| | | | | | * bignum.h: Add BIGNUM_EMBED_P * bignum.c: Use macros for handling BIGNUM_EMBED_FLAG
* Fixed an unavailable sanitizer featureNobuyoshi Nakada2019-12-291-1/+1
|
* reroute macro conflicts on OpenBSD卜部昌平2019-12-271-6/+18
| | | | | | | OpenBSD's <sys/endian.h> has its own swap32() etc. We have to avoid name conflicts. See also https://rubyci.org/logs/rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20191226T210011Z.log.html.gz#miniruby
* Try to fix error on SolarisKazuhiro NISHIYAMA2019-12-271-1/+1
|
* internal/stdbool.h rework卜部昌平2019-12-261-1/+15
| | | | | | Noticed that internal/stdbool.h and addr2line.c are the only two place where missing/stdbool.h is included. Why not delete the file so that we can merge internal/stdbool.h and missing/stdbool.h into one.
* decouple internal.h headers卜部昌平2019-12-2613-20/+67
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* other minior internal header tweaks卜部昌平2019-12-2624-29/+73
| | | | | | | | These headers need no rewrite. Just add some minor tweaks, like addition of #include lines. Mainly cosmetic. TIMET_MAX_PLUS_ONE was deleted because the macro was used from only one place (directly write expression there).
* internal/vm.h rework卜部昌平2019-12-261-71/+100
| | | | | Rearranged contents, then added MJIT_FUNC_EXPORTED function declarations.
* internal/thread.h rework卜部昌平2019-12-261-0/+8
| | | | Rather trivial, added missed MJIT_FUNC_EXPORTED function declaration.
* internal/symbol.h rework卜部昌平2019-12-262-17/+17
| | | | | Some declatations are moved from internal/parse.h, to reflect the fact that they are defined in symbol.c.
* internal/string.h rework卜部昌平2019-12-262-40/+85
| | | | | Reduced the number of macros defined in the file. Also made it explicit for MJIT_FUNC_EXPORTTED functions to be so.
* internal/range.h rework卜部昌平2019-12-261-3/+22
| | | | Eliminate macros for better readability.
* internal/process.h rework卜部昌平2019-12-261-17/+38
| | | | Eliminated the macro to convert into an inline function.
* internal/proc.h rework卜部昌平2019-12-262-4/+10
| | | | | | Annotated MJIT_FUNC_EXPORTED functions as such. Declaration of rb_sym_to_proc is moved into this file because the function is defined in proc.c rather than string.c.
* internal/object.h rework卜部昌平2019-12-261-18/+33
| | | | | | Eliminated macros. As a side effect struct RBasicRaw is no longer required because we can now define anonymous structs inside of inline functions.
* internal/gc.h rework卜部昌平2019-12-262-53/+106
| | | | | | Improved readability by reducing the use of macros. Also moved some part of internal/compilers.h into this file, because it seems to be the right place for them.
* internal/sanitizers.h rework卜部昌平2019-12-261-32/+44
| | | | Rearrange macro orders for better readability.
* internal/error.h rework卜部昌平2019-12-262-44/+92
| | | | | | Reduce macros for readability. Also transplanted some part of internal/file.h into here because the delcared functions are in fact defined in error.c.
* internal/compile.h rework卜部昌平2019-12-261-3/+13
| | | | | | This file containes other materials than in compile.c. I could perhaps split them into files, but felt overkill. Just add comments that describe the situations.
* internal/array.h rework卜部昌平2019-12-261-42/+55
| | | | | Rearrange contents for better readability, reduce macros for the same reason, and mark MJIT_FUNC_EXPORTED functions as such.
* internal/variable.h rework卜部昌平2019-12-261-15/+48
| | | | | Eliminated macros. Also marked MJIT_FUNC_EXPORTED functions as such. Some of them are declared in constant.h so edited that file also.
* internal/imemo.h rework卜部昌平2019-12-261-97/+122
| | | | | | Arrange contents and eliminate macros, to make them readable. Macro IFUNC_NEW was deleted because there was only one usage.
* internal/class.h rework卜部昌平2019-12-261-34/+46
| | | | | | | | This file has almost nothing to do. Added some #ifdef lines and rearranged file contents. Those macros are unable to translate into inline functions, because they are used as lvalues of assignments.
* internal/struct.h rework卜部昌平2019-12-261-32/+82
| | | | | Replace macros with inline functions of equivalent contents, for much improved readability.
* internal/hash.h rework卜部昌平2019-12-261-79/+164
| | | | | | | | Reduce macros to make them inline functions, as well as mark MJIT_FUNC_EXPORTED functions explicitly as such. Definition of ar_hint_t is simplified. This has been the only possible definition so far.
* internal/numeric.h rework卜部昌平2019-12-261-34/+61
| | | | | Marked MJIT_FUNC_EXPORTED functions as such. Other changes are rather cosmetic.
* internal/bingnum.h rework卜部昌平2019-12-261-35/+106
| | | | | Turn macros into inline functions for better readability. Also add rb_int128t2big delcaration, which was missing.
* internal/fixnum.h rework卜部昌平2019-12-263-14/+56
| | | | Add #include lines, move FIXNUM_POSITIVE_P etc. from numeric.h.
* internal/static_assert.h rework卜部昌平2019-12-261-6/+13
| | | | | ISO/IEC 9899:2011 section 7.2 states that <assert.h> must define static_assert. Use it when available.
* internal/warnings.h rework卜部昌平2019-12-261-30/+29
| | | | Not a big rewrite. Just to make those macros readable.
* internal/bits.h rework卜部昌平2019-12-262-186/+439
| | | | | | Improving readability by converting some macros into inline functions. Also improved support for recent x86_64 processors, which have better instructions for the purposes.
* add several __has_something macro卜部昌平2019-12-262-7/+94
| | | | | | | With these macros implemented we can write codes just like we can assume the compiler being clang. MSC_VERSION_SINCE is defined to implement those macros, but turned out to be handy for other places. The -fdeclspec compiler flag is necessary for clang to properly handle __has_declspec().
* assume C99卜部昌平2019-12-261-15/+7
| | | | | | | | | | | Now that we no longer support old compilers, we can safely delete several obsolete #ifdef gurads. Also because (as of writing) it is impossible to compile the program using C++ compilers, lets just entirely prohibit __cplusplus to reduce # of LOCs. Note however that we still cannot eliminate __STDC_VERSION__ checks, because MSVC does not define it, saying its C99 support is partial. See also https://social.msdn.microsoft.com/Forums/vstudio/en-US/53a4fd75-9f97-48b2-aa63-2e2e5a15efa3
* split internal.h into files卜部昌平2019-12-2653-0/+3390
One day, I could not resist the way it was written. I finally started to make the code clean. This changeset is the beginning of a series of housekeeping commits. It is a simple refactoring; split internal.h into files, so that we can divide and concur in the upcoming commits. No lines of codes are either added or removed, except the obvious file headers/footers. The generated binary is identical to the one before.