aboutsummaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #2422 from jeremyevans/rb_keyword_given_pJeremy Evans2019-09-031-0/+1
| | | Add rb_keyword_given_p to the C-API
* Disable method definition type checks on Cygwin tood0 (Daisuke Fujimura)2019-09-032-2/+2
| | | | [Bug #16134]
* fix CI failures in x64-mingw32卜部昌平2019-08-312-29/+2
| | | | | For insatnce https://ci.appveyor.com/project/ruby/ruby/builds/27086475/job/mb9whkiygemlfy93
* Workaround for https://reviews.llvm.org/D25824卜部昌平2019-08-302-7/+7
| | | | This changeset make it possible to use very old clang.
* Rule out gcc on Windows卜部昌平2019-08-292-0/+27
| | | | | | | | It seems the combination fails at the moment. Don't know exactly why but I suspect there can be issues in resolving weak references. Let's rule them out for now. https://ci.appveyor.com/project/ruby/ruby/builds/27036383/job/x3c5d54839aacoyt
* drop-in type check for rb_define_singleton_method卜部昌平2019-08-291-0/+41
| | | | | | We can check the function pointer passed to rb_define_singleton_method like how we do so in rb_define_method. Doing so revealed many arity mismatches.
* drop-in type check for rb_define_private_method卜部昌平2019-08-291-0/+41
| | | | | | | We can check the function pointer passed to rb_define_private_method like how we do so in rb_define_method. Doing so revealed some problematic usages of rb_obj_dummy. They had to be split according to their arity.
* drop-in type check for rb_define_protected_method卜部昌平2019-08-291-0/+41
| | | | | | We can check the function pointer passed to rb_define_protected_method like how we do so in rb_define_method. This changeset revealed no prototypes mismatches.
* drop-in type check for rb_define_method_id卜部昌平2019-08-291-0/+45
| | | | | | We can check the function pointer passed to rb_define_method_id like how we do so in rb_define_method. This method is relatively rarely used so there are less problems found than the other APIs.
* drop-in type check for rb_define_global_function卜部昌平2019-08-291-0/+41
| | | | | | We can check the function pointer passed to rb_define_global_function like we do so in rb_define_method. It turns out that almost anybody is misunderstanding the API.
* drop-in type check for rb_define_module_function卜部昌平2019-08-291-0/+41
| | | | | | We can check the function pointer passed to rb_define_module_function like how we do so in rb_define_method. The difference is that this changeset reveales lots of atiry mismatches.
* drop-in type check for rb_define_method卜部昌平2019-08-292-2/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rb_define_method function takes a pointer to ANYARGS-ed functions, which in fact varies 18 different prototypes. We still need to preserve ANYARGS for storages but why not check the consistencies if possible. Q&As: Q: Where did the magic number "18" came from in the description above? A: Count the case branch of vm_method.c:call_cfunc_invoker_func(). Note also that the 18 branches has lasted for at least 25 years. See also 200e0ee2fd3c1c006c528874a88f684447215524. Q: What is this __weakref__ thing? A: That is a kind of function overloading mechanism that GCC provides. In this case for instance rb_define_method0 is an alias of rb_define_method, with a strong type. Q: What is this __transparent_union__ thing? A: That is another kind of function overloading mechanism that GCC provides. In this case the attributed function pointer is either VALUE(*)(int,VALUE*,VALUE) or VALUE(*)(int,const VALUE*,VALUE). This is better than void* or ANYARGS because we can reject all other possibilities than the two. Q: What does this rb_define_method macro mean? A: It selects appropriate alias of the rb_define_method function, depending on the arity. Q: Why the prototype change of rb_f_notimplement? A: Function pointer to rb_f_notimplement is special cased in vm_method.c:rb_add_method_cfunc(). That should be handled by the __builtin_choose_expr chain inside of rb_define_method macro expansion. In order to do so, comparison like (func == rb_f_notimplement) is inappropriate for __builtin_choose_expr's expression (which must be a compile-time integer constant but the address of rb_f_notimplement is not fixed until the linker). So instead we are using __builtin_types_compatible_p, and in doing so we need to distinguish rb_f_notimplement from others, by type.
* rb_ivar_foreach now free from ANYARGS卜部昌平2019-08-271-1/+1
| | | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit adds a function prototype for rb_ivar_foreach. Luckily this change revealed no problematic usage of the function.
* rb_hash_foreach now free from ANYARGS卜部昌平2019-08-271-2/+2
| | | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit adds function prototypes for rb_hash_foreach / st_foreach_safe. Also fixes some prototype mismatches.
* rb_define_hooked_variable now free from ANYARGS卜部昌平2019-08-272-17/+15
| | | | | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit uses rb_gvar_getter_t / rb_gvar_setter_t for rb_define_hooked_variable / rb_define_virtual_variable which revealed lots of function prototype inconsistencies. Some of them were literally decades old, going back to dda5dc00cff334cac373096d444a0fd59e716124.
* struct st_hash_type now free from ANYARGS卜部昌平2019-08-271-2/+2
| | | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit adds function prototypes for struct st_hash_type. Honestly I don't understand why they were commented out at the first place.
* st_foreach now free from ANYARGS卜部昌平2019-08-271-3/+5
| | | | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from st_foreach. I strongly believe that this commit should have had come with b0af0592fdd9e9d4e4b863fde006d67ccefeac21, which added extra parameter to st_foreach callbacks.
* rb_thread_create now free from ANYARGS卜部昌平2019-08-271-1/+1
| | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from rb_thread_create, which seems very safe to do.
* rb_proc_new / rb_fiber_new now free from ANYARGS卜部昌平2019-08-271-2/+2
| | | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from rb_proc_new / rb_fiber_new, and applies RB_BLOCK_CALL_FUNC_ARGLIST wherever necessary.
* rb_catch now free from ANYARGS卜部昌平2019-08-271-2/+2
| | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from rb_catch, and fixes some bugs revealed by that.
* rb_ensure now free from ANYARGS卜部昌平2019-08-271-1/+1
| | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from rb_ensure, which also revealed many arity / type mismatches.
* rb_rescue / rb_rescue2 now free from ANYARGS卜部昌平2019-08-271-2/+2
| | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from rb_rescue / rb_rescue2, which revealed many arity / type mismatches.
* rb_iterate now takes rb_block_call_func_t卜部昌平2019-08-271-1/+1
| | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit makes rb_iterate free from ANYARGS.
* #define RB_BLOCK_CALL_FUNC_STRICT 1卜部昌平2019-08-271-5/+1
| | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. Let's start from making rb_block_call_func_t strict, and apply RB_BLOCK_CALL_FUNC_ARGLIST liberally.
* Fix FL_USER19Nobuyoshi Nakada2019-08-191-1/+1
| | | | | * include/ruby/ruby.h: cast via `unsigned int` explicitly, to get rid of signed extension by implicit integer promotion.
* io.c: export rb_io_extract_modeencNobuyoshi Nakada2019-08-141-0/+3
| | | | | | * include/ruby/io.h (rb_io_enc_t): add typedef. * io.c (rb_io_extract_modeenc): export.
* Renamed ruby_finalize_{0,1}Nobuyoshi Nakada2019-08-132-3/+10
| | | | And pass rb_execution_context_t as an argument.
* Rename rb_gc_mark_no_pin -> rb_gc_mark_movableAaron Patterson2019-08-121-1/+1
| | | | | | Renaming this function. "No pin" leaks some implementation details. We just want users to know that if they mark this object, the reference may move and they'll need to update the reference accordingly.
* rb_trap_exec has been removed since 1.9Nobuyoshi Nakada2019-08-121-1/+0
|
* The value of rb_scan_args_verify is never usedNobuyoshi Nakada2019-08-061-5/+5
|
* Distinguish bad scan format from no argument variablesNobuyoshi Nakada2019-08-061-2/+2
|
* Use negative-sized array instead of zero-divisionNobuyoshi Nakada2019-08-051-21/+7
|
* Unused macro argument `varc`Nobuyoshi Nakada2019-08-051-23/+23
|
* Revert "Always evaluate the expression RUBY_ASSERT_MESG_WHEN just once"Nobuyoshi Nakada2019-08-051-1/+1
| | | | | | | It caused a significant benchmark fall. Some assertions seem to use expressions with side-effects which cannot be inlined. This reverts commit b452c03a14f943ae25338547bd680fce67399d85.
* Fix errno at seeking socket/pipe on WindowsNobuyoshi Nakada2019-07-251-1/+2
| | | | [Bug #12230]
* constify again.Koichi Sasada2019-07-221-3/+3
| | | | | | | | | | | | | | | | | | | | Same as last commit, make some fields `const`. include/ruby/ruby.h: * Rasic::klass * RArray::heap::aux::shared_root * RRegexp::src internal.h: * rb_classext_struct::origin_, redefined_class * vm_svar::cref_or_me, lastline, backref, others * vm_throw_data::throw_obj * vm_ifunc::data * MEMO::v1, v2, u3::value While modifying this patch, I found write-barrier miss on rb_classext_struct::redefined_class. Also vm_throw_data::throw_state is only `int` so change the type.
* * expand tabs.git2019-07-191-1/+1
|
* fix shared array terminology.Koichi Sasada2019-07-191-1/+1
| | | | | | | | | | | | | | | | | | Shared arrays created by Array#dup and so on points a shared_root object to manage lifetime of Array buffer. However, sometimes shared_root is called only shared so it is confusing. So I fixed these wording "shared" to "shared_root". * RArray::heap::aux::shared -> RArray::heap::aux::shared_root * ARY_SHARED() -> ARY_SHARED_ROOT() * ARY_SHARED_NUM() -> ARY_SHARED_ROOT_REFCNT() Also, add some debug_counters to count shared array objects. * ary_shared_create: shared ary by Array#dup and so on. * ary_shared: finished in shard. * ary_shared_root_occupied: shared_root but has only 1 refcnt. The number (ary_shared - ary_shared_root_occupied) is meaningful.
* Always evaluate the expression RUBY_ASSERT_MESG_WHEN just onceNobuyoshi Nakada2019-07-151-1/+1
|
* Enable RUBY_ASSERT_MESG_WHEN when RUBY_DEBUG is turned onNobuyoshi Nakada2019-07-151-3/+4
|
* introduce RUBY_ASSERT_ALWAYS(expr).Koichi Sasada2019-07-151-0/+1
| | | | | RUBY_ASSERT_ALWAYS(expr) ignores NDEBUG (we cannot remove this assertion).
* Introduce RUBY_DEBUG flag macroNobuyoshi Nakada2019-07-141-1/+4
| | | | | When RUBY_DEBUG is turned on, all RUBY_ASSERT() macros will be enabled regardless RUBY_NDEBUG.
* Include ruby/assert.h in ruby/ruby.h so that assertions can be thereNobuyoshi Nakada2019-07-141-0/+1
|
* * expand tabs.git2019-07-141-3/+3
|
* Split RUBY_ASSERT and so on under include/rubyNobuyoshi Nakada2019-07-141-0/+49
|
* Remove IA64 support.Samuel Williams2019-06-192-10/+0
|
* Revert "marshal.c: new functions for extensions"Nobuyoshi Nakada2019-06-041-2/+0
| | | | This reverts a commit miss, 24a96a0228ccf355826644a9daad69e11b67b53b.
* marshal.c: new functions for extensionsNobuyoshi Nakada2019-06-041-0/+2
| | | | | | | | * marshal.c (rb_marshal_dump_limited): new function for extension libraries to dump object with limited nest level. * marshal.c (rb_marshal_load_with_proc): new function for extension libraries to load object with hook proc.
* Added missing predicate macrosNobuyoshi Nakada2019-05-281-0/+3
|
* remove obsolete rb_gc_finalize_deferred().Koichi Sasada2019-05-281-1/+0
| | | | | | | rb_gc_finalize_deferred() is remained for compatibility with C-extensions. However, this function is no longer working from Ruby 2.4 (crash with SEGV immediately). So remove it completely.