summaryrefslogtreecommitdiff
path: root/eval.c
AgeCommit message (Collapse)Author
2022-05-23Remove unnecessary module flag, add module assertions to other module flagsJemma Issroff
Notes: Merged: https://github.com/ruby/ruby/pull/5930
2022-03-24Add ISEQ_BODY macroPeter Zhu
Use ISEQ_BODY macro to get the rb_iseq_constant_body of the ISeq. Using this macro will make it easier for us to change the allocation strategy of rb_iseq_constant_body when using Variable Width Allocation. Notes: Merged: https://github.com/ruby/ruby/pull/5698
2022-03-18A positional Hash is not keyword arguments [Bug #18632]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5676
2022-01-05Remove Refinement#{extend_object,append_features,prepend_features}Jeremy Evans
Also make include, prepend, and extend raise a TypeError if one of the modules is a refinement. Implements [Feature #18270] Notes: Merged: https://github.com/ruby/ruby/pull/5358
2022-01-05Add Module#refinements and Refinement#refined_class [Feature #12737]Shugo Maeda
2022-01-05Add Module.used_refinementsShugo Maeda
2021-12-26Remove Refinement#include and Refinement#prependNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5348
2021-12-24Add docs for Refinement classzverok
Notes: Merged: https://github.com/ruby/ruby/pull/5272
2021-12-06Clarify the error message when trying to import C methods [Bug #18385]Shugo Maeda
2021-10-21Deprecate include/prepend in refinements and add Refinement#import_methods ↵Shugo Maeda
instead Refinement#import_methods imports methods from modules. Unlike Module#include, it copies methods and adds them into the refinement, so the refinement is activated in the imported methods. [Bug #17429] [ruby-core:101639]
2021-09-24Consider modified modules initialized [Bug #18185]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4883
2021-09-10include/ruby/internal/intern/eval.h: add doxygen卜部昌平
Must not be a bad idea to improve documents. [ci skip] Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-10include/ruby/internal/intern/proc.h: add doxygen卜部昌平
Must not be a bad idea to improve documents. [ci skip] Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-10include/ruby/internal/error.h: add doxygen卜部昌平
Must not be a bad idea to improve documents. Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-10include/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. Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-10include/ruby/internal/iterator.h: add doxygen卜部昌平
Must not be a bad idea to improve documents. [ci skip] Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-10include/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. Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-08-10Remove root_jmpbuf in rb_thread_structNobuyoshi Nakada
It has not been used since 1b82c877dfa72e8505ded149fd0e3ba956529d3f. Notes: Merged: https://github.com/ruby/ruby/pull/4725
2021-08-09Suppress a clobbered warningNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4720
2021-08-09Suppress warnings in C++2aNobuyoshi Nakada
* 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] Notes: Merged: https://github.com/ruby/ruby/pull/4720
2021-07-01Replace copy coroutine with pthread implementation.Samuel Williams
2021-04-04Refactor rb_obj_call_init and rb_obj_call_init_kw (#4351)S.H
Notes: Merged-By: nobu <nobu@ruby-lang.org>
2021-03-27Add rb_exc_exception functionS.H
`rb_exc_raise` and `rb_fatal` func have similar code(in `eval.c`). I think that better cut out and replace these code like `rb_exc_exception` function. Notes: Merged: https://github.com/ruby/ruby/pull/4319 Merged-By: nobu <nobu@ruby-lang.org>
2021-03-18Make a few functions staticAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/4285
2021-02-09Expose scheduler as public interface & bug fixes. (#3945)Samuel Williams
* 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. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2021-02-09Copy va_list of exception classesNobuyoshi Nakada
The list is reused when an exception raised again after retrying in the rescue procedure. Notes: Merged: https://github.com/ruby/ruby/pull/4159
2021-02-09Also `eclass` loop can raise in `rb_obj_is_kind_of`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4159
2021-02-09Assign TAG_NONE to ruby_tag_type instead of 0Nobuyoshi Nakada
2021-01-05[DOC] Fix grammar: "is same as" -> "is the same as"Marcus Stollsteimer
2020-11-22Remove obsoleted internal/mjit.h inclusionTakashi Kokubun
:bow:
2020-11-18fix public interfaceKoichi Sasada
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) Notes: Merged: https://github.com/ruby/ruby/pull/3775
2020-11-07Rename to `Fiber#set_scheduler`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3742
2020-10-20Some global variables can be accessed from ractorsKoichi Sasada
Some global variables should be used from non-main Ractors. [Bug #17268] ```ruby # ractor-local (derived from created ractor): debug '$DEBUG' => $DEBUG, '$-d' => $-d, # ractor-local (derived from created ractor): verbose '$VERBOSE' => $VERBOSE, '$-w' => $-w, '$-W' => $-W, '$-v' => $-v, # process-local (readonly): other commandline parameters '$-p' => $-p, '$-l' => $-l, '$-a' => $-a, # process-local (readonly): getpid '$$' => $$, # thread local: process result '$?' => $?, # scope local: match '$~' => $~.inspect, '$&' => $&, '$`' => $`, '$\'' => $', '$+' => $+, '$1' => $1, # scope local: last line '$_' => $_, # scope local: last backtrace '$@' => $@, '$!' => $!, # ractor local: stdin, out, err '$stdin' => $stdin.inspect, '$stdout' => $stdout.inspect, '$stderr' => $stderr.inspect, ``` Notes: Merged: https://github.com/ruby/ruby/pull/3670
2020-10-01Rework `rb_ec_scheduler_finalize` to ensure exceptions are printed.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3610
2020-09-30Fix order of operations during `rb_ec_finalize`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3605
2020-09-21When setting current thread scheduler to nil, invoke `#close`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3557
2020-09-03Introduce Ractor mechanism for parallel executionKoichi Sasada
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. Notes: Merged: https://github.com/ruby/ruby/pull/3365
2020-08-17Remove write barrier exemption for T_ICLASSAlan Wu
Before this commit, iclasses were "shady", or not protected by write barriers. Because of that, the GC needs to spend more time marking these objects than otherwise. Applications that make heavy use of modules should see reduction in GC time as they have a significant number of live iclasses on the heap. - Put logic for iclass method table ownership into a function - Remove calls to WB_UNPROTECT and insert write barriers for iclasses This commit relies on the following invariant: for any non oirigin iclass `I`, `RCLASS_M_TBL(I) == RCLASS_M_TBL(RBasic(I)->klass)`. This invariant did not hold prior to 98286e9 for classes and modules that have prepended modules. [Feature #16984] Notes: Merged: https://github.com/ruby/ruby/pull/3410
2020-07-22Lazily insert origins on prepend to save memoryAlan Wu
98286e9850936e27e8ae5e4f20858cc9c13d2dde made it so that `Module#include` allocates an origin iclass on each use. Since `include` is widely used, the extra allocation can contribute significantly to memory usage. Instead of always allocating in anticipation of prepend, this change takes a different approach. The new setup inserts a origin iclass into the super chains of all the children of the module when prepend happens for the first time. rb_ensure_origin is made static again since now that adding an origin now means walking over all usages, we want to limit the number of places where we do it. Notes: Merged: https://github.com/ruby/ruby/pull/3331
2020-06-29rb_class_modify_check: add UNREACHABLE卜部昌平
(I was not aware of this because I use clang, but) it seems gcc cannot detect reachablility of this point. It renders an unused variable warning, which is a false positive. Let us suppress the compiler. https://github.com/ruby/ruby/runs/816997191#step:9:62
2020-06-29make_exception: early return卜部昌平
The rb_exc_new3() result is already ready to be returned. No need to fall through the switch. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29make_exception: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29setup_exception: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29rb_class_modify_check: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-03Ensure origins for all included, prepended, and refined modulesJeremy Evans
This fixes various issues when a module is included in or prepended to a module or class, and then refined, or refined and then included or prepended to a module or class. Implement by renaming ensure_origin to rb_ensure_origin, making it non-static, and calling it when refining a module. Fix Module#initialize_copy to handle origins correctly. Previously, Module#initialize_copy did not handle origins correctly. For example, this code: ```ruby module B; end class A def b; 2 end prepend B end a = A.dup.new class A def b; 1 end end p a.b ``` Printed 1 instead of 2. This is because the super chain for a.singleton_class was: ``` a.singleton_class A.dup B(iclass) B(iclass origin) A(origin) # not A.dup(origin) ``` The B iclasses would not be modified, so the includer entry would be still be set to A and not A.dup. This modifies things so that if the class/module has an origin, all iclasses between the class/module and the origin are duplicated and have the correct includer entry set, and the correct origin is created. This requires other changes to make sure all tests still pass: * rb_undef_methods_from doesn't automatically handle classes with origins, so pass it the origin for Comparable when undefing methods in Complex. This fixed a failure in the Complex tests. * When adding a method, the method cache was not cleared correctly if klass has an origin. Clear the method cache for the klass before switching to the origin of klass. This fixed failures in the autoload tests related to overridding require, without breaking the optimization tests. Also clear the method cache for both the module and origin when removing a method. * Module#include? is fixed to skip origin iclasses. * Refinements are fixed to use the origin class of the module that has an origin. * RCLASS_REFINED_BY_ANY is removed as it was only used in a single place and is no longer needed. * Marshal#dump is fixed to skip iclass origins. * rb_method_entry_make is fixed to handled overridden optimized methods for modules that have origins. Fixes [Bug #16852] Notes: Merged: https://github.com/ruby/ruby/pull/3140
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-04-15Raise EPIPE at broken pipe for the backward compatibilityNobuyoshi Nakada
Instead of SignalException for SIGPIPE, raise `Errno::EPIPE` with instance variable `signo` and re-send that signal at exit. [Feature #14413] Notes: Merged: https://github.com/ruby/ruby/pull/3035
2020-04-08Suppress -Wswitch warningsNobuyoshi Nakada
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <shyouhei@ruby-lang.org>