aboutsummaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a hook before fork() for getaddrinfo_a()Masaki Matsushita2020-12-041-0/+2
| | | | | | | | | 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]
* Fix typos [ci skip]Kazuhiro NISHIYAMA2020-12-041-3/+3
|
* include/ruby/internal/xmalloc.h: add doxygen卜部昌平2020-12-031-0/+160
| | | | Thought it was not a bad idea to document these CAPI. [ci skip]
* Fix docs about movement for rb_gc_register_mark_object()Alan Wu2020-12-011-4/+2
| | | | This API in fact pins objects passed to it. See vm.c:2546.
* rb_ext_ractor_safe() to declare ractor-safe extKoichi Sasada2020-12-011-0/+4
| | | | | | | | | | | 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]
* ractor local storage C-APIKoichi Sasada2020-12-011-0/+19
| | | | | | | | | | | | | | | | | | | | | | 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.
* Keep references of memory-view-exported objects (#3816)Kenta Murata2020-11-301-0/+4
| | | | | | | | | * 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
* Use opaque struct pointer than voidNobuyoshi Nakada2020-11-271-2/+3
|
* Move the declaration into the functionKazuhiro NISHIYAMA2020-11-181-2/+2
| | | | instead of 'do not call it directly.' comment.
* fix public interfaceKoichi Sasada2020-11-182-0/+62
| | | | | | | | | | | | | | | | | | 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)
* Expose the rb_interned_str_* family of functionsJean Boussier2020-11-172-0/+5
| | | | Fixes [Feature #13381]
* Add docs for some C extension GC APIsAlan Wu2020-11-061-4/+28
|
* Add warning for str_new_static functionsAlan Wu2020-10-301-3/+8
| | | | | | | 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()
* Ractor.make_shareable(obj)Koichi Sasada2020-10-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Feature #16812: Allow slicing arrays with ArithmeticSequence (#3241)Kenta Murata2020-10-211-0/+1
| | | | | | | | | | | | | | | | | * 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]
* remove rb_obj_iv_index_tblKoichi Sasada2020-10-171-17/+0
| | | | | (1) nobody uses it (gem-codesearch) (2) the data strucuture will be changed.
* Revert "Don't export rb_callable_receiver"Nobuyoshi Nakada2020-10-071-2/+0
| | | | | This reverts commit c839168b1141db53bedef771d1bc78908b6ac782. `rb_callable_receiver` does not need to be exposed under include.
* Don't export rb_callable_receiverChris Seaton2020-10-061-0/+2
|
* include/ruby/memory_view.h: annotate functions卜部昌平2020-10-061-0/+5
|
* rb_memory_view_is_contiguous: convert into an inline function卜部昌平2020-10-061-4/+14
|
* memory_view.h: use bool卜部昌平2020-10-061-5/+5
| | | | | Because `bool` is already used in the header there is no reason to hesitate.
* RB_RANDOM_DATA_INIT_PARENT: convert into an inline function卜部昌平2020-10-061-3/+12
| | | | Bit readable to me.
* rb_rand_if: convert into an inline function卜部昌平2020-10-061-3/+12
| | | | This adds more room for assertions.
* include/ruby/random.h: eliminate extern "C"卜部昌平2020-10-061-17/+2
| | | | cf: https://github.com/ruby/ruby/pull/2991/commits/99add258571bf103c6d942bf0e4d510763b73918
* Moved rb_callable_receiver internalNobuyoshi Nakada2020-10-061-1/+0
|
* memory_view.c: Use ssize_t for ndim in memory_view (#3615)Kenta Murata2020-10-021-2/+2
| | | | | * memory_view.c: Use ssize_t for ndim in memory_view * include/ruby/memory_view.h: Fix the type of item_size argument
* fix typo [ci skip]卜部昌平2020-09-291-1/+1
| | | | Reported by Mau Magnaguagno See: https://github.com/ruby/ruby/pull/3570#discussion_r495465903
* Add rb_category_warn{,ing} for warning messages with categoriesJeremy Evans2020-09-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the following C-API functions that can be used to emit warnings with categories included: ```c void rb_category_warn(const char *, const char*, ...) void rb_category_warning(const char*, const char*, ...) ``` Internally in error.c, there is an rb_warn_category function that will call Warning.warn with the string and the category keyword if it doesn't have an arity of 1, and will call Warning.warn with just the string if it has an arity of 1. This refactors the rb_warn_deprecated{,_to_remove} functions to use rb_warn_category. This makes Kernel#warn accept a category keyword and pass it to Warning.warn, so that Ruby methods can more easily emit warnings with categories. rb_warn_category makes sure that the passed category is a already defined category symbol before calling Warning.warn. The only currently defined warning category is :deprecated, since that is what is already used. More categories can be added in later commits.
* RBIMPL_ALIGNAS: reorder #ifdef blocks卜部昌平2020-09-261-5/+5
| | | | | | | | | | | Since r63443, `-std=gnu99 -D_XOPEN_SOUCE=x00` is added to Solaris' `CPPFLAGS`. `CPPFLAGS` is shared among `CC` / `CXX`. This results in both `__STDC_VERSION__` and `__cplusplus` to be defined at the same time for a C++ compilation, only on Solaris. It seems the `CPPFLAGS` addition is intentional. We sould not touch that part. Instead we need to reroute this by always check for `__cplusplus` first.
* memory_view.h: brush up the description in the commentKenta Murata2020-09-251-2/+7
|
* Buffer protocol proposal (#3261)Kenta Murata2020-09-251-0/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add buffer protocol * Modify for some review comments * Per-object buffer availability * Rename to MemoryView from Buffer and make compilable * Support integral repeat count in memory view format * Support 'x' for padding bytes * Add rb_memory_view_parse_item_format * Check type in rb_memory_view_register * Update dependencies in common.mk * Add test of MemoryView * Add test of rb_memory_view_init_as_byte_array * Add native size format test * Add MemoryView test utilities * Add test of rb_memory_view_fill_contiguous_strides * Skip spaces in format string * Support endianness specifiers * Update documentation * Support alignment * Use RUBY_ALIGNOF * Fix format parser to follow the pack format * Support the _ modifier * Parse count specifiers in get_format_size function. * Use STRUCT_ALIGNOF * Fix test * Fix test * Fix total size for the case with tail padding * Fix rb_memory_view_get_item_pointer * Fix rb_memory_view_parse_item_format again
* should not check taint flag on rubyspec.Koichi Sasada2020-09-251-0/+1
| | | | | Now taint flag is obsolete and it is used fro shareaable flag. So we should not check this flag.
* enrich comment卜部昌平2020-09-251-4/+13
| | | | Added description and URL about nested flexible array member.
* RBIMPL_ALIGNOF: do not use constexpr卜部昌平2020-09-251-16/+8
| | | | Was definitely a bad idea to use constexpr. It is not ubiquitous.
* ALLOCA_N: do not use RUBY_ALIGNOF卜部昌平2020-09-251-11/+1
| | | | | | Now that RUBY_ALIGNOF behaves like C11's _Alignof. This is not necessarily the best stack arrangement. We can just give up using __builtin_alloca_with_align(), and let alloca choose what is optimal.
* RBIMPL_ALIGNOF: do not use __alignof__卜部昌平2020-09-251-41/+49
| | | | | | | | | | | | | It is reported that on a system of i386 System V ABI, GCC returns 8 for __alignof__(double). OTOH the ABI defines alignments of double to be 4, and ISO/IEC 9899:2011 reads that _Alignof(double) shall return 4 on such machine. What we want in ruby is 4 instead of 8 there. We cannot use __alignof__. Additionally, both old GCC / old clang return 8 for _Alignof(double) on such platforms. They are their bugs, and already fixed in recent versions. But we have to support older compilers for a while. Shall check sanity of _Alignof.
* Removed rb_find_file_ext_safe and rb_find_file_safeHiroshi SHIBATA2020-09-231-2/+0
|
* Warn on a finalizer that captures the object to be finalizedChris Seaton2020-09-161-0/+1
| | | | | Also improve specs and documentation for finalizers and more clearly recommend a safe code pattern to use them.
* Rework console to use `rb_io_wait`.Samuel Williams2020-09-141-2/+2
|
* Add support for hooking `IO#read`.Samuel Williams2020-09-141-0/+2
|
* Standardised scheduler interface.Samuel Williams2020-09-141-3/+6
|
* Simplify bitmasks for IO events.Samuel Williams2020-09-141-0/+6
|
* Add RB_ prefix to `GetOpenFile` and `MakeOpenFile`.Samuel Williams2020-09-141-2/+4
|
* Added `rb_random_base_init`Nobuyoshi Nakada2020-09-071-0/+1
| | | | To enclose the initialization of Random::Base part.
* Added WITH_REAL macrosNobuyoshi Nakada2020-09-071-4/+10
| | | | | | Added `WITH_REAL` versions to `RB_RANDOM_INTERFACE` macros. Also these macros including "without real" versions no longer contain the terminator (semicolon and comma).
* Added `get_real` interfaceNobuyoshi Nakada2020-09-071-0/+2
|
* Added rb_int_pair_to_realNobuyoshi Nakada2020-09-071-2/+1
|
* separate rb_random_tNobuyoshi Nakada2020-09-071-0/+80
| | | | | | | | | | | | * random.c: separate abstract rb_random_t and rb_random_mt_t for Mersenne Twister implementation. * include/ruby/random.h: the interface for extensions of Random class. * DLL imported symbol reference is not constant on Windows. * check if properly initialized.
* Add `RB_` prefix for size_t to number conversion.Samuel Williams2020-09-061-12/+17
|
* Introduce Ractor mechanism for parallel executionKoichi Sasada2020-09-031-0/+1
| | | | | | | | | | | | | | | | This commit introduces Ractor mechanism to run Ruby program in parallel. See doc/ractor.md for more details about Ractor. See ticket [Feature #17100] to see the implementation details and discussions. [Feature #17100] This commit does not complete the implementation. You can find many bugs on using Ractor. Also the specification will be changed so that this feature is experimental. You will see a warning when you make the first Ractor with `Ractor.new`. I hope this feature can help programmers from thread-safety issues.