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

2158 Коммитов

Автор SHA1 Сообщение Дата
卜部昌平 cac1e88d75 include/ruby/backward/cxxanyargs.hpp: suppress doxygen warning
rb_cFiber is not visible from extension libraries, hence intentionally
not documented. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 9eab1e9107 include/ruby/internal/arithmetic/char.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 6e62cf46ed include/ruby/internal/arithmetic/double.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 887c1f117d include/ruby/internal/arithmetic/fixnum.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 98ab286195 include/ruby/internal/arithmetic/gid_t.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 5e1caeb15c include/ruby/internal/arithmetic/int.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 8fa82cd272 include/ruby/internal/arithmetic/intptr_t.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 6706d0216f include/ruby/internal/arithmetic/long.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 abd15ac775 include/ruby/internal/arithmetic/long_long.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 e9c423ac6c include/ruby/internal/arithmetic/mode_t.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 92150fde85 include/ruby/internal/arithmetic/off_t.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 5289552e53 include/ruby/internal/arithmetic/pid_t.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 009c6b742b include/ruby/internal/arithmetic/short.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 5c3cd09715 include/ruby/internal/arithmetic/size_t.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 86d4fe686c include/ruby/internal/arithmetic/st_data_t.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 edf1964bdf include/ruby/internal/arithmetic/uid_t.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 0ea157136f postscript about rb_mutex_sleep
Asked ko1 about the design.  [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 ce54282b75 include/ruby/internal/intern/array.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 f9a00f9ef2 include/ruby/internal/intern/bignum.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 fbe1fcd82d include/ruby/internal/intern/class.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 5f478d8ac3 include/ruby/internal/intern/compar.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 0375f1fe97 include/ruby/internal/intern/complex.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 0f3ae58882 include/ruby/internal/intern/cont.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 974a9e4fba include/ruby/internal/intern/dir.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 0a7034258f include/ruby/internal/intern/enum.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 407c4850f1 include/ruby/internal/intern/enumerator.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 d5460f1cda include/ruby/internal/intern/error.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 3fa875f88b include/ruby/internal/intern/eval.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 e3b94182a0 include/ruby/internal/intern/file.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 ba42d35dd0 include/ruby/internal/intern/gc.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 990a6c789a include/ruby/internal/intern/hash.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 398be8bc92 include/ruby/internal/intern/io.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 63aef9b177 include/ruby/internal/intern/load.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 72a43d4a4b include/ruby/internal/intern/marshal.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 14e6e122e7 include/ruby/internal/intern/numeric.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 d43accae15 include/ruby/internal/intern/object.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 4f97917474 include/ruby/internal/intern/parse.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 26b7efc51c include/ruby/internal/intern/proc.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 15255b303c include/ruby/internal/intern/process.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 357a43558e include/ruby/internal/intern/random.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 949220d9db include/ruby/internal/intern/range.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 7c8ad0a37d include/ruby/internal/intern/rational.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 06127fe4ae include/ruby/internal/intern/re.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 9d91878b79 include/ruby/internal/intern/ruby.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 4625ab88e2 include/ruby/internal/intern/select.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 29201e1ad2 include/ruby/internal/intern/select/largesize.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 20716f64e9 include/ruby/internal/intern/select/posix.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 515f8d0967 include/ruby/internal/intern/select/win32.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 65ec170618 include/ruby/internal/intern/signal.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 772ad7718b include/ruby/internal/intern/sprintf.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 091faca99c include/ruby/internal/intern/string.h: add doygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 1bdae3773f include/ruby/internal/intern/struct.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 45803af58c include/ruby/internal/intern/thread.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 a88bd246ca include/ruby/internal/intern/time.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 cbf9fc6b02 include/ruby/internal/intern/variable.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 43cac51277 include/ruby/internal/intern/vm.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 8b0dbca2f4 include/ruby/internal/core/rarray.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 a2b8f61cba include/ruby/internal/core/rbasic.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 9c4aa94a19 include/ruby/internal/core/rbignum.h: add doxgen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 7c28330ca0 include/ruby/internal/core/rclass.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 005ff5da52 include/ruby/internal/core/rdata.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 0c486c5531 include/ruby/internal/core/rfile.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 b92a9af405 include/ruby/internal/core/rhash.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 b40d74ce69 include/ruby/internal/core/rmatch.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 549e9383e4 include/ruby/internal/core/robject.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 ada4a0fdd2 include/ruby/internal/core/rregexp.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 1bd1339492 include/ruby/internal/core/rstring.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 746996e6c9 include/ruby/internal/core/rstruct.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 fdae26a5a8 include/ruby/internal/core/rtypeddata.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 1561012918 include/ruby/internal/anyargs.h: fix typo
RBIMPL_ATTR_NONNULL macro takes an argument.
2021-09-10 20:00:06 +09:00
卜部昌平 618fa0a67b include/ruby/internal/anyargs.h: fix typo
Just applied spell checker. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 cf1424d62a include/ruby/internal/cast.h: skip doxygen
This header contains nothing worth documenting. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 b5e491fb45 include/ruby/internal/compiler_is: skip doxygen
We don't want 3rd parties to use these RBIMPL_ macros.  Let's not
document them. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 924d78f87d include/ruby/internal/config.h: skip doxygen
It is definitely desirable to document them, but we need more human
resources.  Tentatively disable documenting them. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 b7cd9a3b79 include/ruby/internal/constant_p.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 538a3919d9 include/ruby/internal/ctype.h: add doxygen
Must not be a bad idea to improve documents.
2021-09-10 20:00:06 +09:00
卜部昌平 9febab7afc include/ruby/internal/dllexport.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 0d13f5aa73 include/ruby/internal/dosish.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 30f3319871 include/ruby/internal/eval.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 ee94fb44f4 include/ruby/internal/event.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 99c3328edc include/ruby/internal/error.h: name a parameter
Better document [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 891dbedd00 include/ruby/internal/error.h: refactor move contents around [ci skip] 2021-09-10 20:00:06 +09:00
卜部昌平 1b6245ccdc include/ruby/internal/error.h: add doxygen
Must not be a bad idea to improve documents.
2021-09-10 20:00:06 +09:00
卜部昌平 4881a3ed38 include/ruby/internal/fl_type.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 fbe0785a34 include/ruby/internal/glob.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 3be4adcf2b include/ruby/internal/globals.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 f83b14af24 include/ruby/internal/interpreter.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]

In fact many functions declared in the header file are already
documented more or less.  They were just copy & pasted, with applying
some style updates.
2021-09-10 20:00:06 +09:00
卜部昌平 03fd22a170 include/ruby/internal/iterator.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 4397e737c5 include/ruby/internal/memory.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 00ff6b68e4 include/ruby/internal/method.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]

In fact many functions declared in the header file are already
documented more or less.  They were just copy & pasted, with applying
some style updates.
2021-09-10 20:00:06 +09:00
卜部昌平 9ba9dbf168 include/ruby/internal/module.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]

In fact many functions declared in the header file are already
documented more or less.  They were just copy & pasted, with applying
some style updates.
2021-09-10 20:00:06 +09:00
卜部昌平 1f66d8a77b include/ruby/internal/newobj.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 c3c0bf6823 include/ruby/internal/rgengc.h: add dosygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 2061dadb0a include/ruby/internal/scan_args.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 b0a7c0dfd0 include/ruby/internal/special_consts.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 818fabfcd9 include/ruby/internal/stdalign.h: add doxygen
Unlike other "add doxygen" commits this one adds a preprocessor branch
that doxygen would process.  This prevents it from parsing other parts
of the file.
2021-09-10 20:00:06 +09:00
卜部昌平 73d2bf97c1 include/ruby/internal/symbol.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 178ce74597 include/ruby/internal/value.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 e2a441bdd4 include/ruby/internal/value_type.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 3341e178ef include/ruby/internal/variable.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 13be4c0342 include/ruby/internal/warning_push.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 28b7b0e13e include/ruby/internal/xmalloc.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 a300133b4a include/ruby/internal/xmalloc.h: fix typo [ci skip] 2021-09-10 20:00:06 +09:00
卜部昌平 b6469c3aaf template/Doxyfile.tmpl: add alias
This enables me to write `@shyouhei` in C comments without complained by
doxygen that @shyouhei is an unknown special command. [ci skip]
2021-09-10 20:00:06 +09:00
卜部昌平 94e5953b48 sed -i 's/. They/. They/'
Truly editorial fix for comments.  This works better with Emacs'
set-justification-full function. [ci skip]
2021-09-10 20:00:06 +09:00
Kenta Murata f8bb2d9b27
memory_view.c: Rename private to private_data for C++ (#4812)
* memory_view.c: Rename private to private_data for C++

* doc/memory_view.md: Update document

* Fix doc/memory_view.md

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
2021-09-06 16:01:52 +09:00
Nobuyoshi Nakada 80c1faf076
Use C99-defined signbit macro 2021-08-27 12:42:23 +09:00
Nobuyoshi Nakada 04be8e84db
Use C99-defined macros to classify a floating-point number 2021-08-27 12:41:30 +09:00
Peter Zhu c08d4067be [Feature #18045] Remove T_PAYLOAD
This commit removes T_PAYLOAD since the new VWA implementation no longer
requires T_PAYLOAD types.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-25 09:28:21 -04:00
Nobuyoshi Nakada d9f084ed14 Moved rb_deprecate_constant declaration [Feature #18051] 2021-08-24 10:37:41 +09:00
Nobuyoshi Nakada 5d99800d01 Moved rb_int_positive_pow declaration [Feature #18051] 2021-08-24 10:37:41 +09:00
Nobuyoshi Nakada c38c2d8ee2 Moved exported symbols in internal/util.h to ruby/util.h
[Feature #18051]
2021-08-24 10:37:41 +09:00
Peter Zhu eddd369e73 Revert "[Feature #18045] Implement size classes for GC"
This reverts commits 48ff7a9f3e
and b2e2cf2ded because it is causing
crashes in SPARC solaris and i386 debian.
2021-08-23 10:54:53 -04:00
Peter Zhu 48ff7a9f3e [Feature #18045] Remove T_PAYLOAD
This commit removes T_PAYLOAD since the new VWA implementation no longer
requires T_PAYLOAD types.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-23 09:15:42 -04:00
Kazuki Tsujimoto 4568ba0711
Show verbose error messages when single pattern match fails
[0] => [0, *, a]
    #=> [0] length mismatch (given 1, expected 2+) (NoMatchingPatternError)

Ignore test failures of typeprof caused by this change for now.
2021-08-15 09:38:24 +09:00
Nobuyoshi Nakada edd27e120e A comment for typed data in `rb_check_type` [ci skip] 2021-08-14 23:11:58 +09:00
Nobuyoshi Nakada d58620e0a1 Rename labels in `Check_Type` more descriptive 2021-08-14 23:11:58 +09:00
Nobuyoshi Nakada 611da9faef
Mark `rb_unexpected_type` as "cold" [Bug #18062]
So that it will not interfere the fast path in `Check_Type`.
2021-08-13 13:29:15 +09:00
Nobuyoshi Nakada 573eef7c89
Indicate the slow path of `Check_Type` never return [Bug #18062]
Though this call to `rb_check_type` is just to raise an exception
and never return actually, it can return at least formally.  That
means a caller function looks like it will access `flags` even in
the special-const cases, and some optimizers may unify the access
with the same access just following the call, and re-order it
before the guard.
2021-08-13 13:29:15 +09:00
卜部昌平 1cdc75104d RBIMPL_ATTR_DEPRECATED: enable for GCC 10.3+
They fixed the bug.
2021-08-12 11:29:08 +09:00
Nobuyoshi Nakada 9ed196e487
VC warns the same attribute used more than once 2021-08-09 19:25:18 +09:00
Nobuyoshi Nakada 93ddff4802
Rename rb_iterate to get rid of name clash on Sun C 2021-08-09 17:36:21 +09:00
Nobuyoshi Nakada 4fb8a12adc Deprecate rb_iterate in C++ 2021-08-09 11:21:56 +09:00
Nobuyoshi Nakada 733ffa74cd Suppress deprecated rb_iterate declaration warnings in C++ 2021-08-09 11:21:56 +09:00
Nobuyoshi Nakada a14671a6b6 Suppress warnings in C++2a
* bitwise operation between different enumeration types
  ('ruby_value_type' and 'ruby_fl_type') is deprecated
  [-Wdeprecated-enum-enum-conversion]

* volatile-qualified parameter type 'volatile int' is deprecated
  [-Wdeprecated-volatile]
2021-08-09 11:21:56 +09:00
Nobuyoshi Nakada 605421f4eb
gcc 10.3.0 says "__VA_OPT__ is not available until C++2a" 2021-08-01 09:54:36 +09:00
Nobuyoshi Nakada 3b52230452
Define functions using rb_wait_for_single_fd [Bug #18046] 2021-08-01 06:49:07 +09:00
Benoit Daloze fd0df9c4fb Emit deprecatation warnings for rb_iterate()
* It is obsolete since 1.9, see
  https://github.com/ruby/ruby/blob/master/doc/extension.rdoc#label-Control+Structure
  and [Misc #18025]
2021-07-16 12:11:24 +02:00
卜部昌平 3ce2bf4d90 rb_interned_id_p: does not exist
This declaration was added at commit 0ee5a49dd4
without its implementation.  Must be a mistake.

Note also that we ended up having this exct same functionality
implemented under a name of rb_check_id().
2021-07-15 16:54:59 +09:00
卜部昌平 2d9aacf644 rb_enc_casefold: does not exist
This declaration was added at commit 0ee5a49dd4
without its implementation.  Must be a mistake.
2021-07-15 16:54:59 +09:00
xtkoba 29f6f79e73 Get `ruby_nonempty_memcpy` to have C linkage
Fixes [Bug #17788]
2021-07-13 22:55:17 +09:00
Samuel Williams 9df712a0e2 Expose `rb_obj_is_fiber`. 2021-07-13 19:28:40 +12:00
Yusuke Endoh 457a4913be Disable RBIMPL_ATTR_DEPRECATED for Coverity Scan build
Coverity Scan emulates gcc but seems not to support this attribute
correctly.
2021-06-26 02:30:23 +09:00
Nobuyoshi Nakada 8f16a715e1
Revert deprecations for now 2021-06-23 12:41:54 +09:00
Samuel Williams 45e65f302b Deprecate and rework old (fd) centric functions. 2021-06-22 22:48:57 +12:00
Samuel Williams 3deb5d7113 Direct io for accept, send, sendmsg, recvfrom, and related methods. 2021-06-22 22:17:53 +12:00
eileencodes b91b3bc771 Add a cache for class variables
Redo of 34a2acdac788602c14bf05fb616215187badd504 and
931138b00696419945dc03e10f033b1f53cd50f3 which were reverted.

GitHub PR #4340.

This change implements a cache for class variables. Previously there was
no cache for cvars. Cvar access is slow due to needing to travel all the
way up th ancestor tree before returning the cvar value. The deeper the
ancestor tree the slower cvar access will be.

The benefits of the cache are more visible with a higher number of
included modules due to the way Ruby looks up class variables. The
benchmark here includes 26 modules and shows with the cache, this branch
is 6.5x faster when accessing class variables.

```
compare-ruby: ruby 3.1.0dev (2021-03-15T06:22:34Z master 9e5105c) [x86_64-darwin19]
built-ruby: ruby 3.1.0dev (2021-03-15T12:12:44Z add-cache-for-clas.. c6be009) [x86_64-darwin19]

|         |compare-ruby|built-ruby|
|:--------|-----------:|---------:|
|vm_cvar  |      5.681M|   36.980M|
|         |           -|     6.51x|
```

Benchmark.ips calling `ActiveRecord::Base.logger` from within a Rails
application. ActiveRecord::Base.logger has 71 ancestors. The more
ancestors a tree has, the more clear the speed increase. IE if Base had
only one ancestor we'd see no improvement. This benchmark is run on a
vanilla Rails application.

Benchmark code:

```ruby
require "benchmark/ips"
require_relative "config/environment"

Benchmark.ips do |x|
  x.report "logger" do
    ActiveRecord::Base.logger
  end
end
```

Ruby 3.0 master / Rails 6.1:

```
Warming up --------------------------------------
              logger   155.251k i/100ms
Calculating -------------------------------------
```

Ruby 3.0 with cvar cache /  Rails 6.1:

```
Warming up --------------------------------------
              logger     1.546M i/100ms
Calculating -------------------------------------
              logger     14.857M (± 4.8%) i/s -     74.198M in   5.006202s
```

Lastly we ran a benchmark to demonstate the difference between master
and our cache when the number of modules increases. This benchmark
measures 1 ancestor, 30 ancestors, and 100 ancestors.

Ruby 3.0 master:

```
Warming up --------------------------------------
            1 module     1.231M i/100ms
          30 modules   432.020k i/100ms
         100 modules   145.399k i/100ms
Calculating -------------------------------------
            1 module     12.210M (± 2.1%) i/s -     61.553M in   5.043400s
          30 modules      4.354M (± 2.7%) i/s -     22.033M in   5.063839s
         100 modules      1.434M (± 2.9%) i/s -      7.270M in   5.072531s

Comparison:
            1 module: 12209958.3 i/s
          30 modules:  4354217.8 i/s - 2.80x  (± 0.00) slower
         100 modules:  1434447.3 i/s - 8.51x  (± 0.00) slower
```

Ruby 3.0 with cvar cache:

```
Warming up --------------------------------------
            1 module     1.641M i/100ms
          30 modules     1.655M i/100ms
         100 modules     1.620M i/100ms
Calculating -------------------------------------
            1 module     16.279M (± 3.8%) i/s -     82.038M in   5.046923s
          30 modules     15.891M (± 3.9%) i/s -     79.459M in   5.007958s
         100 modules     16.087M (± 3.6%) i/s -     81.005M in   5.041931s

Comparison:
            1 module: 16279458.0 i/s
         100 modules: 16087484.6 i/s - same-ish: difference falls within error
          30 modules: 15891406.2 i/s - same-ish: difference falls within error
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-06-18 10:02:44 -07:00
Nobuyoshi Nakada e4f891ce8d
Adjust styles [ci skip]
* --braces-after-func-def-line
* --dont-cuddle-else
* --procnames-start-lines
* --space-after-for
* --space-after-if
* --space-after-while
2021-06-17 10:13:40 +09:00
Samuel Williams 2792acc8f2
Add scheduler hook `Addrinfo.getaddrinfo`. (#4375)
Co-authored-by: Bruno Sutic <code@brunosutic.com>
2021-06-14 16:21:08 +12:00
Samuel Williams dc25412042 Expose `rb_fiber_transfer` and `rb_fiber_transfer_kw`. 2021-06-03 20:47:31 +12:00
Aaron Patterson 07f055bb13
Revert "Filling cache values on cvar write"
This reverts commit 08de37f9fa.
This reverts commit e8ae922b62.
2021-05-11 13:31:00 -07:00
eileencodes e8ae922b62 Add a cache for class variables
This change implements a cache for class variables. Previously there was
no cache for cvars. Cvar access is slow due to needing to travel all the
way up th ancestor tree before returning the cvar value. The deeper the
ancestor tree the slower cvar access will be.

The benefits of the cache are more visible with a higher number of
included modules due to the way Ruby looks up class variables. The
benchmark here includes 26 modules and shows with the cache, this branch
is 6.5x faster when accessing class variables.

```
compare-ruby: ruby 3.1.0dev (2021-03-15T06:22:34Z master 9e5105ca45) [x86_64-darwin19]
built-ruby: ruby 3.1.0dev (2021-03-15T12:12:44Z add-cache-for-clas.. c6be0093ae) [x86_64-darwin19]

|         |compare-ruby|built-ruby|
|:--------|-----------:|---------:|
|vm_cvar  |      5.681M|   36.980M|
|         |           -|     6.51x|
```

Benchmark.ips calling `ActiveRecord::Base.logger` from within a Rails
application. ActiveRecord::Base.logger has 71 ancestors. The more
ancestors a tree has, the more clear the speed increase. IE if Base had
only one ancestor we'd see no improvement. This benchmark is run on a
vanilla Rails application.

Benchmark code:

```ruby
require "benchmark/ips"
require_relative "config/environment"

Benchmark.ips do |x|
  x.report "logger" do
    ActiveRecord::Base.logger
  end
end
```

Ruby 3.0 master / Rails 6.1:

```
Warming up --------------------------------------
              logger   155.251k i/100ms
Calculating -------------------------------------
```

Ruby 3.0 with cvar cache /  Rails 6.1:

```
Warming up --------------------------------------
              logger     1.546M i/100ms
Calculating -------------------------------------
              logger     14.857M (± 4.8%) i/s -     74.198M in   5.006202s
```

Lastly we ran a benchmark to demonstate the difference between master
and our cache when the number of modules increases. This benchmark
measures 1 ancestor, 30 ancestors, and 100 ancestors.

Ruby 3.0 master:

```
Warming up --------------------------------------
            1 module     1.231M i/100ms
          30 modules   432.020k i/100ms
         100 modules   145.399k i/100ms
Calculating -------------------------------------
            1 module     12.210M (± 2.1%) i/s -     61.553M in   5.043400s
          30 modules      4.354M (± 2.7%) i/s -     22.033M in   5.063839s
         100 modules      1.434M (± 2.9%) i/s -      7.270M in   5.072531s

Comparison:
            1 module: 12209958.3 i/s
          30 modules:  4354217.8 i/s - 2.80x  (± 0.00) slower
         100 modules:  1434447.3 i/s - 8.51x  (± 0.00) slower
```

Ruby 3.0 with cvar cache:

```
Warming up --------------------------------------
            1 module     1.641M i/100ms
          30 modules     1.655M i/100ms
         100 modules     1.620M i/100ms
Calculating -------------------------------------
            1 module     16.279M (± 3.8%) i/s -     82.038M in   5.046923s
          30 modules     15.891M (± 3.9%) i/s -     79.459M in   5.007958s
         100 modules     16.087M (± 3.6%) i/s -     81.005M in   5.041931s

Comparison:
            1 module: 16279458.0 i/s
         100 modules: 16087484.6 i/s - same-ish: difference falls within error
          30 modules: 15891406.2 i/s - same-ish: difference falls within error
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-05-11 12:04:27 -07:00
Nobuyoshi Nakada 2d67027448 Removed missing/dup2.c
This function should be always available, as POSIX-compliant or
Windows platform are required since 1.9.  Also the code in this
file is MT-unsafe.
2021-05-10 15:59:23 +09:00
卜部昌平 043ac94db6 rb_fiber_new_kw: doesn't exist
Not against having such thing but currently we lack one.
2021-05-10 11:18:14 +09:00
Nobuyoshi Nakada 0bbab1e515
Protoized old pre-ANSI K&R style declarations and definitions 2021-05-07 00:04:36 +09:00
Matt Valentine-House 8bbd319806 Allow newobj_of0 and newobj_slowpath to allocate into multiple heap slots 2021-05-06 09:18:17 -04:00
Peter Zhu b57c7be6a9 Fix compilation errors for c99
ENUM_OVER_INT is sometimes not defined. Use #ifdef instead if #if.
2021-05-04 20:38:03 -04:00
Benoit Daloze d09988502e Fix -Wundef warnings for RBIMPL_HAS_BUILTIN
* See [Feature #17752]
* Defining explicitly to 0 seems the best solution, see https://github.com/ruby/ruby/pull/4428
* For example:
./include/ruby/internal/has/builtin.h:49:33: error: "RBIMPL_HAS_BUILTIN___builtin_assume" is not defined, evaluates to 0 [-Werror=undef]
   49 | # define RBIMPL_HAS_BUILTIN(_) (RBIMPL_HAS_BUILTIN_ ## _)
      |                                 ^~~~~~~~~~~~~~~~~~~
./include/ruby/internal/assume.h:75:7: note: in expansion of macro ‘RBIMPL_HAS_BUILTIN’
   75 | #elif RBIMPL_HAS_BUILTIN(__builtin_assume)
      |       ^~~~~~~~~~~~~~~~~~
2021-05-04 14:56:55 +02:00
Benoit Daloze f108bc32af HAVE_* macros should not be defined with value 0
* See [Feature #17752]
2021-05-04 14:56:55 +02:00
Benoit Daloze f1dcc3da5d Add RBIMPL_RVALUE_EMBED_LEN_MAX neeeded by internal/bignum.h
* It evaluated to 0 before, revealed by -Wundef
* See [Feature #17752]

Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
2021-05-04 14:56:55 +02:00
Benoit Daloze 68d6bd0873 Fix trivial -Wundef warnings
* See [Feature #17752]

Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
2021-05-04 14:56:55 +02:00
Ryuta Kamizono 33f2ff3bab Fix some typos by spell checker 2021-04-26 10:07:41 +09:00
卜部昌平 97cee1cba6 rb_hash_free(): has never existed.
This is just a hoax.  Nobody have ever implemented a function named as
such.  Also the functionality implied by the name must not be a public
API if any.
2021-04-16 14:41:35 +09:00
Nobuyoshi Nakada 393923b50d
Inline LONG_LONG conversions
Not only NUM2LL, also LL2NUM, ULL2NUM and NUM2ULL.
2021-04-13 14:50:13 +09:00
卜部昌平 f8e1bf283d workaround MSVC error
Previous code failed to compile on MSVC. Log:
https://github.com/ruby/ruby/pull/4371/checks?check_run_id=2304484466

This is possibly due to the fact that:

1. `Data_Wrap_Struct(...)` appears in a source code
2. which expands to `rb_data_object_wrap(...)`
3. which expands to `RUBY_MACRO_SELECT(rb_data_object_wrap_, RUBY_UNTYPED_DATA_WARNING)`
4. which expands to `rb_data_object_wrap_0`
5. which expands to `rb_data_object_wrap`, so far so good, but
6. this is a recursive macro expansion (see step 2).  Everybody stops expanding...
    - in step 4 for MSVC, and
    - in step 5 for GCC etc.

I have no idea why but this proposed changeset prevents MSVC from
stopping at step 4.
2021-04-13 14:30:21 +09:00
卜部昌平 6413dc27dc dependency updates 2021-04-13 14:30:21 +09:00
卜部昌平 f411fcd145 get rid of #pragma GCC diagnostic ignored "-Wundef"
Use of TOKEN_PASTE was a bad idea at the first place.  Just use ##
everywhere.  Nobody practically lacks token pasting.
2021-04-13 14:30:21 +09:00
Samuel Williams 836da24e97 Fix symbol export. 2021-04-10 09:10:08 +12:00
Samuel Williams 3d32c21758 Disable public interface for now. 2021-03-30 18:38:42 +13:00
Samuel Williams 09c865d541 Fix native implementation.
# Conflicts:
#	scheduler.c
2021-03-30 18:38:42 +13:00
Samuel Williams 4c53dc970b Add hook for `Timeout.timeout`. 2021-03-30 18:38:42 +13:00
Nobuyoshi Nakada 1f08b0d18d
Removed dln_a_out
a.out format is considered extinct nowadays.
2021-03-24 20:13:55 +09:00
Kenichi Kamiya 37abe1a220 [Doc] Standardize wording s/sweeped/swept/ 2021-03-23 01:30:27 +09:00
Kenichi Kamiya 2d6617d327
Fix typos in rhash.h (#4292) 2021-03-19 19:12:03 -07:00
Nobuyoshi Nakada 1d1b9e02d2
Removed a typo in a comment [ci skip] 2021-03-07 10:21:03 +09:00
卜部昌平 45b3a5f7de rb_sym_interned_p: doesn't exist
Deleted decades ago in commit 6e0fed271c

Note also that we eventually ended up reinventing this exact same
functionality.  It is called rb_check_id() now.
2021-03-05 17:37:16 +09:00
卜部昌平 294c244ac8 rb_random_int: ended before it begins
It existed since f3d022543e until
9676023607.  No official releases included
the actual function.  The declaration shall be deleted.
2021-02-25 16:26:54 +09:00
Marvin Schmidt dbeddfb0b2
Make global ruby namespace usage explicit
If the use of the ruby namespace isn't prepended by `::` to make it
explicit that the global ruby namespace is referenced here, it can
clash with other non-global namespace named ruby, e.g.

```
  // declaration
  namespace myproject {
  namespace ruby {
    // my ruby classes
  }
  }

  // implementation
  using namespace myproject;

  [...]

  rb_define_method(...);

  [...]
```

leads to the following error:

```
../ruby/choice.cc: In function 'void {anonymous}::do_register_choice()':
../ruby/choice.cc:342:9: error: reference to 'ruby' is ambiguous
  342 |         rb_define_method(c_choices, "each", RUBY_FUNC_CAST(&choices_each), 0);
      |         ^~~~~~~~~~~~~~~~
In file included from ../ruby/choice.cc:20:
../ruby/paludis_ruby.hh:53:15: note: candidates are: 'namespace paludis::ruby { }'
   53 |     namespace ruby
      |               ^~~~
In file included from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/backward/2/stdalign.h:23,
                 from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/defines.h:77,
                 from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/ruby.h:23,
                 from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby.h:38,
                 from ../ruby/paludis_ruby.hh:44,
                 from ../ruby/choice.cc:20:
/usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/internal/stdalign.h:92:11: note:                 'namespace ruby { }'
   92 | namespace ruby {
      |           ^~~~
In file included from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/internal/anyargs.h:83,
                 from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/ruby.h:24,
                 from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby.h:38,
                 from ../ruby/paludis_ruby.hh:44,
                 from ../ruby/choice.cc:20:
../ruby/choice.cc:342:9: error: '::define' has not been declared
  342 |         rb_define_method(c_choices, "each", RUBY_FUNC_CAST(&choices_each), 0);
      |         ^~~~~~~~~~~~~~~~
../ruby/choice.cc:344:9: error: reference to 'ruby' is ambiguous
  344 |         rb_define_method(c_choices, "find_by_name_with_prefix", RUBY_FUNC_CAST(&choices_find_by_name_with_prefix), 1);
      |         ^~~~~~~~~~~~~~~~
```
2021-02-14 22:12:32 +09:00
Nobuyoshi Nakada 96441b91a6
Define macro for fiber/scheduler.h 2021-02-09 17:15:29 +09:00
Nobuyoshi Nakada e7416b4c7e
Updated pre-prototype declarations 2021-02-09 17:11:14 +09:00
Samuel Williams 5f69a7f604
Expose scheduler as public interface & bug fixes. (#3945)
* Rename `rb_scheduler` to `rb_fiber_scheduler`.

* Use public interface if available.

* Use `rb_check_funcall` where possible.

* Don't use `unblock` unless the fiber was non-blocking.
2021-02-09 19:39:56 +13:00
卜部昌平 b0d6563f13 rb_clear_method_cache_by_class: no longer exist
It is questionable whether we can change a public API but this function
does not exist today.  No way.
2021-02-04 12:34:19 +09:00
卜部昌平 a67afaaa05 Update include/ruby/internal/fl_type.h
https://github.com/ruby/ruby/pull/4100#pullrequestreview-576059827

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-01-27 09:30:15 +09:00
卜部昌平 d205370b96 include/ruby/internal/fl_type.h: refactor hoist out #if conditions
cf: https://github.com/ruby/ruby/pull/4100#pullrequestreview-575952836
2021-01-27 09:30:15 +09:00
卜部昌平 f8a117f858 kill CLONESETUP and DUPSETUP
They are no longer how Object#clone/Object#dup are defined.  In fact
DUPSETUP is not used from anywhere.  CLONESETUP has only one usage.
Let's not expose them to extension libraries.

cf https://github.com/ruby/ruby/pull/4100#discussion_r563481718
2021-01-27 09:30:15 +09:00
卜部昌平 3f4f10bb60 attributes on enumerators are GCC6-ism
See also https://gcc.gnu.org/gcc-6/changes.html

Clang has this feature when __has_extension(enumerator_attributes) is
set.

MSVC has #pragma deprecated instead.
2021-01-27 09:30:15 +09:00
卜部昌平 c7d1387721 warnings on use of RUBY_FL_TAINT
matz said in [ruby-core:94979]:
> 3.0:
>  * taint/trust/untaint/untrust non-verbose warning when called

This is it, for C extensions.
2021-01-27 09:30:15 +09:00
卜部昌平 0300dec32b kill OBJ_TAINT etc.
Now that RUBY_FL_TAINT is recycled to become new RUBY_FL_SHAREABLE.
Setting/clearing this flag from extension libraries break Ractor.
Especially problematic one is OBJ_INFECT, which would make non-shareable
objects travel across Ractor boundaries.

Such operations should just be prohibited.
2021-01-27 09:30:15 +09:00
卜部昌平 7ccdad7be8 fix OBJ_UNTRUST etc.
It seems I broke them in commit 9e6e39c351
Sorry!
2021-01-27 09:30:15 +09:00
Alan Wu 216e6605a4 Add compaction notes for class/module creation C APIs 2021-01-26 16:24:01 -08:00
Gannon McGibbon 9e0075a3d9 Replace "iff" with "if and only if"
iff means if and only if, but readers without that knowledge might
assume this to be a spelling mistake. To me, this seems like
exclusionary language that is unnecessary. Simply using "if and only if"
instead should suffice.
2021-01-19 12:06:45 -08:00
Nobuyoshi Nakada 66a844fd07 Define printf qualifier prefix fallbacks 2021-01-11 21:13:45 +09:00
Tee KOBAYASHI 0bb62dccf4
Fixed a typo [Bug #17522] 2021-01-09 13:37:41 +09:00
Koichi Sasada d968829afa expose some C-APIs for ractor
expose some C-APIs to try to make ractor utilities on external gems.

* add
  * rb_ractor_local_storage_value_lookup() to check availability
* expose
  * rb_ractor_make_shareable()
  * rb_ractor_make_shareable_copy()
  * rb_proc_isolate() (not public)
  * rb_proc_isolate_bang() (not public)
  * rb_proc_ractor_make_shareable() (not public)
2021-01-06 16:03:09 +09:00
Nobuyoshi Nakada f690eb34e2
Fixed dangling imemo_tmpbuf
The count of rb_alloc_tmp_buffer_with_count is the allocation size
counted in VALUE size but not in the requested element size.

Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Co-authored-by: Koichi Sasada <ko1@atdot.net>
2021-01-02 12:11:52 +09:00
Nobuyoshi Nakada 62450e0acf
Fixed missing NORETURN on rb_mod_const_missing 2020-12-31 12:30:13 +09:00
Nobuyoshi Nakada 4b4dc0fac7
Defined RBIMPL_ATTR_DEPRECATED_INTERNAL
Get rid of duplicate attributes, which may be warned or ignored
except for the first.
2020-12-31 12:23:29 +09:00
Nobuyoshi Nakada 0284e7ca62
Replaced deprecation macros
* DECLARE_DEPRECATED_FEATURE with RBIMPL_ATTR_DEPRECATED_SINCE
* DECLARE_DEPRECATED_INTERNAL_FEATURE with RBIMPL_ATTR_INTERNAL
And moved function declarations outside both.
2020-12-30 23:11:09 +09:00
Nobuyoshi Nakada 90dd482061
win32: Declared wait and fixed the return type 2020-12-27 16:49:27 +09:00
Kenta Murata 7a4b8d8700
[memory_view] Fix a comment
A consumer of a MemoryView no longer guards the original object.
[ci skip]
2020-12-25 20:11:01 +09:00
Yukihiro "Matz" Matsumoto c591ab11ce
Development of 3.1.0 started. 2020-12-25 17:09:16 +09:00
Nobuyoshi Nakada b343d54792
Use RBIMPL_COMPILER_{SINCE,BEFORE} for MSVC
Pointed out by @shyouhei.

NOTE: Already we have dropped the support for older MSVCs,
probably prior to 1300 or 1400.  Remove the conditional code,
especially in win32/Makefile.sub.
2020-12-24 16:22:50 +09:00
Koichi Sasada 6f29716f9f shareable_constant_value: experimental_copy
"experimental_everything" makes the assigned value, it means
the assignment change the state of assigned value.
"experimental_copy" tries to make a deep copy and make copyied object
sharable.
2020-12-24 14:28:47 +09:00
Nobuyoshi Nakada 6ed6b85ece Expose atomic operation macros with RUBY prefix
Now we need atomic operations, which are lighter than mutex, more
widely for extension libraries because of Ractor.
2020-12-24 11:43:21 +09:00
Kenta Murata 05a756b332
[memory_view] Fix some grammar issues in a comment 2020-12-24 09:32:54 +09:00
Kenta Murata 01ab29cc28
[memory_view] Make some rb_memroy_view_t members const 2020-12-23 09:24:55 +09:00
Kenta Murata 74652e640a
[memory_view][fiddle] Rename len to byte_size in rb_memory_view_t 2020-12-23 09:24:53 +09:00
Kenta Murata 05014dcb88
[memory_view][fiddle] Use bool for boolean return value 2020-12-23 09:05:07 +09:00
卜部昌平 7898bc9225 rb_cCont: no longer exists
Deleted well over a decade ago in commit 977d66ec99.
2020-12-22 15:25:03 +09:00
Nobuyoshi Nakada 8918a9cf6c Removed rb_cData entity
* Use the wrapper of rb_cObject instead of data access
* Replaced rest of extentions
* Updated the version guard for Data
* Added the version guard of rb_cData
2020-12-22 02:51:49 +09:00
卜部昌平 c30f03d328 Data: delete
Has been deprecated since 684bdf6171.

Matz says in [ruby-core:83954] that Data should be an alias of Object.
Because rb_cData has not been deprecated, let us deprecate the constant
to make it a C-level synonym of rb_cObject.
2020-12-22 02:51:49 +09:00
卜部昌平 fe60480947 include/ruby/internal/xmalloc.h: document rb_eNoMemError
It was my bad, the exception that actually raises is rb_eNoMemError.
[ci skip]
2020-12-21 11:01:01 +09:00
卜部昌平 11656d15e2 include/ruby/internal/xmalloc.h: doxygen tag
`@exception` is an alias of `@throw`.  It might suite Ruby's document
because ruby uses `raise` terminology instead of `throw`. [ci skip]
2020-12-21 11:01:01 +09:00
Nobuyoshi Nakada 37987d9994 win32: Deprecate file CP version functions 2020-12-20 18:34:04 +09:00
Nobuyoshi Nakada 5b98b2ce39 win32: Use UTF-8 as filesystem encoding [Feature #12654]
Co-Authored-By: Dāvis Mosāns <davispuh@gmail.com>
2020-12-20 18:34:04 +09:00
Nobuyoshi Nakada a139318538
Added macros for headers which are not included by ruby.h 2020-12-19 16:38:17 +09:00
Jeremy Evans 7e2dbbda35 Use category: :experimental in warnings that are related to experimental features
This adds rb_category_compile_warn in order to emit compiler warnings
with categories.  Note that Ripper currently ignores the category
for these warnings, but by default it ignores the warnings completely,
so this shouldn't matter.
2020-12-18 09:54:11 -08:00
Jeremy Evans 52fb696ee7 Switch rb_category_warn{,ing} to accept an rb_warning_category_t
Since we decided to only allowing specific warning categories,
there is no reason to have an API that accepts a general string,
as it is more error-prone.  Switch to only allowing the specific
warning categories.

As rb_category_warn{,ing} are public API, this requires making
rb_warning_category_t public API as well.
2020-12-18 09:54:11 -08:00
卜部昌平 aa82b067cb ruby_set_stack_size: no longer exists
Deleted since fc3c60f608
2020-12-18 11:18:09 +09:00
Koichi Sasada b29c0fadec add HAVE_RB_EXT_RACTOR_SAFE macro
define HAVE_RB_EXT_RACTOR_SAFE to check rb_ext_ractor_safe() is
available or not.
2020-12-17 00:29:48 +09:00
Nobuyoshi Nakada ddb93c3d64 Made LARGEFILE_SUPPORT mandatory 2020-12-16 19:10:37 +09:00
Nobuyoshi Nakada 5193fbb6d0 Removed stale declaration
rb_w32_pipe_exec was removed in 1.9.3, at
commit:7ac32d7a16734ea66de15319bcff2fd429abae7f.
2020-12-16 19:10:37 +09:00
Nobuyoshi Nakada 0df67a4695 Signal handler type should be void 2020-12-12 17:02:42 +09:00
Nobuyoshi Nakada 21c5726418 Omit checks for C89 standard or later
Now we require C99, these features available of course.

* prototypes
* stdarg prototypes
* token pasting
* stringization
* string literal concatenation
2020-12-12 17:02:42 +09:00
Nobuyoshi Nakada 68af523529
Added parentheses to silence sizeof-array-div warnings [Bug #17385]
As well as 2366c68116.
2020-12-12 14:25:30 +09:00
Kenta Murata 73db60bdda
include/ruby/memory_view.h: fix the return type of rb_memory_view_prepare_item_desc 2020-12-10 21:41:47 +09:00
Kenta Murata 0fcd478a4e
include/ruby/memory_view.h: fix typo 2020-12-10 21:35:53 +09:00
Kenta Murata bb489aca58
memory_view.c: Add rb_memory_view_get_item and rb_memory_view_prepare_item_desc (#3871) 2020-12-10 00:24:36 +09:00
Nobuyoshi Nakada b419f90a8b
Tweaked `Process::Status.wait`
* revert `rb_last_status_set`
* renamed the new function as `rb_process_status_new`
* `rb_process_status_new` always freezes the return value
* marked `Process::Status.wait` as EXPERIMENTAL, as it has not
  been discussed totally yet.
2020-12-09 11:51:57 +09:00
Nobuyoshi Nakada 4f907a80f0
Removed declaration of non-existent symbol 2020-12-09 11:32:18 +09:00
Samuel Williams 2553c5f94a Add support for non-blocking `Process.wait`. 2020-12-09 08:55:35 +13:00
Kenta Murata 7e69296a2b
memory_view.c: Add rb_memory_view_extract_item_members (#3855) 2020-12-08 02:01:31 +09:00
Lars Kanis ca76337a00
Windows: Read ENV names and values as UTF-8 encoded Strings (#3818)
* Windows: Read ENV names and values as UTF-8 encoded Strings

Implements issue #12650: fix https://bugs.ruby-lang.org/issues/12650

This also removes the special encoding for ENV['PATH'] and some
complexity in the code that is unnecessary now.

* Windows: Improve readablity of getenv() encoding

getenv() did use the expected codepage as an implicit parameter of the macro.
This is mis-leading since include/ruby/win32.h has a different definition.
Using the "cp" variable explicit (like the other function calls) makes it
more readable and consistent.

* Windows: Change external C-API macros getenv() and execv() to use UTF-8

They used to process and return strings with locale encoding,
but since all ruby-internal spawn and environment functions use UTF-8,
it makes sense to change the C-API equally.
2020-12-08 02:00:39 +09:00
Nobuyoshi Nakada 7817a438eb Removed deprecated Time#succ 2020-12-07 18:38:59 +09:00
卜部昌平 cc36e499f9 Doxygen terminology update [ci skip]
Follow N2328 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2328.pdf
2020-12-07 14:20:44 +09:00
Masaki Matsushita 5d8bcc4870 Revert getaddrinfo_a()
getaddrinfo_a() gets stuck after fork().
To avoid this, we need 1 second sleep to wait for internal
worker threads of getaddrinfo_a() to be finished, but that is unacceptable.

[Bug #17220] [Feature #17134] [Feature #17187]
2020-12-07 13:33:53 +09:00
Kenta Murata 60eabb1aa7
Revert "memory_view.c: Add rb_memory_view_extract_item_members"
This reverts the following three commits.

- ce707079c1
- 1a76bb56b0
- 51500eedef
2020-12-07 00:38:19 +09:00
Kenta Murata 1a76bb56b0
memory_view.c: Fix the argument type of rb_memory_view_extract_item_members 2020-12-06 23:24:45 +09:00
Kenta Murata 51500eedef
memory_view.c: Add rb_memory_view_extract_item_members 2020-12-06 22:46:06 +09:00
Masaki Matsushita 76439eee68 Call cleanup function for getaddrinfo_a(3) only before fork()
Previously, rb_getaddrinfo_a_before_exec() is called from before_exec().
However, the function needs to be called only before fork().
The change moves it to before_fork().
2020-12-06 01:32:43 +09:00
Masaki Matsushita 94d49ed31c Add a hook before fork() for getaddrinfo_a()
We need stop worker threads in getaddrinfo_a() before fork().
This change adds a hook before fork() that cancel all outstanding requests
and wait for all ongoing requests. Then, it waits for all worker
threads to be finished.

Fixes [Bug #17220]
2020-12-04 23:31:51 +09:00
Kazuhiro NISHIYAMA 94b2323a68
Fix typos [ci skip] 2020-12-04 10:37:58 +09:00
卜部昌平 84eb2bfab9 include/ruby/internal/xmalloc.h: add doxygen
Thought it was not a bad idea to document these CAPI. [ci skip]
2020-12-03 12:07:56 +09:00
Alan Wu 56141d38a3 Fix docs about movement for rb_gc_register_mark_object()
This API in fact pins objects passed to it. See vm.c:2546.
2020-12-01 15:23:09 -05:00
Koichi Sasada 182fb73c40 rb_ext_ractor_safe() to declare ractor-safe ext
C extensions can violate the ractor-safety, so only ractor-safe
C extensions (C methods) can run on non-main ractors.
rb_ext_ractor_safe(true) declares that the successive
defined methods are ractor-safe. Otherwiwze, defined methods
checked they are invoked in main ractor and raise an error
if invoked at non-main ractors.

[Feature #17307]
2020-12-01 15:44:18 +09:00
Koichi Sasada 67693d8d80 ractor local storage C-API
To manage ractor-local data for C extension, the following APIs
are defined.

* rb_ractor_local_storage_value_newkey
* rb_ractor_local_storage_value
* rb_ractor_local_storage_value_set
* rb_ractor_local_storage_ptr_newkey
* rb_ractor_local_storage_ptr
* rb_ractor_local_storage_ptr_set

At first, you need to create a key of storage by
rb_ractor_local_(value|ptr)_newkey().
For ptr storage, it accepts the type of storage,
how to mark and how to free with ractor's lifetime.

rb_ractor_local_storage_value/set are used to access a VALUE
and rb_ractor_local_storage_ptr/set are used to access a pointer.

random.c uses this API.
2020-12-01 09:39:30 +09:00
Kenta Murata 73a337e214
Keep references of memory-view-exported objects (#3816)
* memory_view.c: remove a reference in view->obj at rb_memory_view_release

* memory_view.c: keep references of memory-view-exported objects

* Update common.mk

* memory_view.c: Use st_update
2020-11-30 14:53:13 +09:00
Nobuyoshi Nakada 039ba387aa
Use opaque struct pointer than void 2020-11-27 21:38:08 +09:00
Kazuhiro NISHIYAMA a776032ef1
Move the declaration into the function
instead of 'do not call it directly.' comment.
2020-11-18 10:52:56 +09:00
Koichi Sasada 5e3259ea74 fix public interface
To make some kind of Ractor related extensions, some functions
should be exposed.

* include/ruby/thread_native.h
  * rb_native_mutex_*
  * rb_native_cond_*
* include/ruby/ractor.h
  * RB_OBJ_SHAREABLE_P(obj)
  * rb_ractor_shareable_p(obj)
  * rb_ractor_std*()
  * rb_cRactor

and rm ractor_pub.h
and rename srcdir/ractor.h to srcdir/ractor_core.h
    (to avoid conflict with include/ruby/ractor.h)
2020-11-18 03:52:41 +09:00
Jean Boussier ef19fb111a Expose the rb_interned_str_* family of functions
Fixes [Feature #13381]
2020-11-17 09:39:25 +09:00
Alan Wu f234f2740d Add docs for some C extension GC APIs 2020-11-06 09:55:26 -08:00
Alan Wu 670e288d65 Add warning for str_new_static functions
Many functions in string.c assume that capa + termlen to be readable
memory. Add comment in header to communicate this to extension authors.

See also: comment in str_fill_term()
2020-10-30 19:47:14 -04:00
Koichi Sasada 2f50936cb9 Ractor.make_shareable(obj)
Introduce new method Ractor.make_shareable(obj) which tries to make
obj shareable object. Protocol is here.

(1) If obj is shareable, it is shareable.
(2) If obj is not a shareable object and if obj can be shareable
    object if it is frozen, then freeze obj. If obj has reachable
    objects (rs), do rs.each{|o| Ractor.make_shareable(o)}
    recursively (recursion is not Ruby-level, but C-level).
(3) Otherwise, raise Ractor::Error. Now T_DATA is not a shareable
    object even if the object is frozen.

If the method finished without error, given obj is marked as
a sharable object.

To allow makng a shareable frozen T_DATA object, then set
`RUBY_TYPED_FROZEN_SHAREABLE` as type->flags. On default,
this flag is not set. It means user defined T_DATA objects are
not allowed to become shareable objects when it is frozen.

You can make any object  shareable by setting FL_SHAREABLE flag,
so if you know that the T_DATA object is shareable (== thread-safe),
set this flag, at creation time for example. `Ractor` object is one
example, which is not a frozen, but a shareable object.
2020-10-21 07:59:24 +09:00
Kenta Murata a6a8576e87
Feature #16812: Allow slicing arrays with ArithmeticSequence (#3241)
* Support ArithmeticSequence in Array#slice

* Extract rb_range_component_beg_len

* Use rb_range_values to check Range object

* Fix ary_make_partial_step

* Fix for negative step cases

* range.c: Describe the role of err argument in rb_range_component_beg_len

* Raise a RangeError when an arithmetic sequence refers the outside of an array

[Feature #16812]
2020-10-21 02:40:18 +09:00
Koichi Sasada 91ec5f9e39 remove rb_obj_iv_index_tbl
(1) nobody uses it (gem-codesearch)
(2) the data strucuture will be changed.
2020-10-17 08:18:04 +09:00
Nobuyoshi Nakada 62abdbadf2
Revert "Don't export rb_callable_receiver"
This reverts commit c839168b11.
`rb_callable_receiver` does not need to be exposed under include.
2020-10-07 11:27:30 +09:00
Chris Seaton c839168b11 Don't export rb_callable_receiver 2020-10-06 15:41:47 -07:00
卜部昌平 2d20e68fb7 include/ruby/memory_view.h: annotate functions 2020-10-06 14:20:10 +09:00
卜部昌平 62ddbfe2b9 rb_memory_view_is_contiguous: convert into an inline function 2020-10-06 14:20:10 +09:00