aboutsummaryrefslogtreecommitdiffstats
path: root/load.c
Commit message (Collapse)AuthorAgeFilesLines
* Suppress a "clobbered" warning by gcc on macOSNobuyoshi Nakada2020-12-111-4/+4
|
* rb_ext_ractor_safe() to declare ractor-safe extKoichi Sasada2020-12-011-0/+26
| | | | | | | | | | | 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]
* Don't redefine #rb_intern over and over againStefan Stüben2020-10-211-4/+2
|
* rb_class_real never returns QnilNobuyoshi Nakada2020-10-091-1/+1
|
* Document that Kernel#load will load relative to current directory [ci skip]Jeremy Evans2020-07-091-3/+15
| | | | | | | | Update and format the Kernel#load documentation to separate the three cases (absolute path, explicit relative path, other), and also document that it raises LoadError on failure. Fixes [Bug #16988]
* search_required: do not goto into a branch卜部昌平2020-06-291-3/+5
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_feature_p: do not goto into a branch卜部昌平2020-06-291-3/+5
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* [DOC] relative filename `Kernel#.require` and `Kernel#.load` [ci skip]MSP-Greg2020-06-011-0/+2
|
* [DOC] refined `Kernel#.require` and `Kernel#.load` [ci skip]Nobuyoshi Nakada2020-05-301-6/+6
|
* [DOC] mentioned "explicit relative path" [ci skip]Nobuyoshi Nakada2020-05-301-10/+14
| | | | | `Kernel#.require` and `Kernel#.load` do not search also "explicit relative path" files, not only absolute paths, in the load path.
* Remove deprecated rb_require_safeJeremy Evans2020-04-301-17/+0
|
* Add the loaded feature after no exception raisedNobuyoshi Nakada2020-02-041-2/+1
| | | | | Retrying after rescued `require` should try to load the same library again. [Bug #16607]
* decouple internal.h headers卜部昌平2019-12-261-4/+11
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* Fixed stack overflow [Bug #16382]Nobuyoshi Nakada2019-12-031-1/+1
| | | | | Get rid of infinite recursion in expanding a load path to the real path while loading a transcoder.
* care about TAG_FATAL.Koichi Sasada2019-11-191-1/+4
| | | | | | | | | | | TAG_FATAL represents interpreter closing state and ec->errinfo contains FIXNUM (eTerminateSignal, etc). If we need to change the state, then errinfo is also changed because TAG_RAISE assumes that ec->errinfo contains a Exception object. Without this patch, TAG_FATAL is ignored and no ec->errinfo change so that it causes critical issue. [Bug #16177]
* Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans2019-11-181-30/+38
| | | | | | | | | | | | | | | | | This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd.
* delete unused functions卜部昌平2019-11-141-7/+0
| | | | | | | | | | | | Looking at the list of symbols inside of libruby-static.a, I found hundreds of functions that are defined, but used from nowhere. There can be reasons for each of them (e.g. some functions are specific to some platform, some are useful when debugging, etc). However it seems the functions deleted here exist for no reason. This changeset reduces the size of ruby binary from 26,671,456 bytes to 26,592,864 bytes on my machine.
* drop-in type check for rb_define_global_function卜部昌平2019-08-291-1/+1
| | | | | | 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.
* delete `$` sign from C identifiers卜部昌平2019-08-271-3/+3
| | | | | They lack portability. See also https://travis-ci.org/shyouhei/ruby/jobs/577164015
* struct MEMO now free from ANYARGS卜部昌平2019-08-271-1/+1
| | | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. There is only one usage of MEMO::u3::func in load.c (where void Init_Foobar(vodi) is registered) so why not just be explicit.
* rb_define_hooked_variable now free from ANYARGS卜部昌平2019-08-271-3/+10
| | | | | | | | | 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.
* Omit a tag unless loading with a wrapper moduleNobuyoshi Nakada2019-08-181-11/+13
|
* Should require without wrapper moduleNobuyoshi Nakada2019-08-091-0/+7
|
* Reduce unnecessary EXEC_TAG in requireNobuyoshi Nakada2019-08-081-24/+55
|
* solve "duplicate :raise event" in require too [Bug #15877]Nobuyoshi Nakada2019-08-081-1/+0
|
* Use `ec` instead of `th->ec` where the `th` came from the `ec`Nobuyoshi Nakada2019-08-081-4/+4
|
* * expand tabs.git2019-08-081-1/+1
|
* solve "duplicate :raise event" [Bug #15877]Koichi Sasada2019-08-081-32/+11
| | | | | | | Without this patch, "raise" event invoked twice when raise an exception in "load"ed script. This patch by danielwaterworth (Daniel Waterworth). [Bug #15877]
* Do not expect RSTRING_PTR valid after rb_fstringNobuyoshi Nakada2019-08-051-2/+2
|
* * expand tabs.git2019-08-041-1/+1
|
* Fix dangling path name from fstringNobuyoshi Nakada2019-08-041-1/+1
| | | | | | * load.c (rb_require_internal): make sure in advance that the path to be loaded shares a fstring, to get rid of dangling path name. Fixed up 5931857281ce45c1c277aa86d1588119ab00a955. [Bug #16041]
* Add a /* fall through */ commentYusuke Endoh2019-07-141-0/+1
|
* Document $LOAD_PATH.resolve_feature_path in globals.rdocBenoit Daloze2019-07-131-2/+1
| | | | | * RDoc does not seem to support documenting singleton object methods, and making $LOAD_PATH a class as a workaround is too weird.
* $LOAD_PATH.resolve_feature_pathNobuyoshi Nakada2019-07-111-0/+1
| | | | Moved from RubyVM. [Feature #15903]
* Turned `recur` into `int` [Feature #15777]Nobuyoshi Nakada2019-06-211-2/+1
|
* Add an optional `inherit` argument to Module#autoload?Jean Boussier2019-06-211-9/+26
| | | | | | [Feature #15777] Closes: https://github.com/ruby/ruby/pull/2173
* [DOC] fix markups [ci skip]nobu2019-03-221-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * expand tabs.svn2018-12-311-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: resolve_feature_pathnobu2018-12-311-3/+11
| | | | | | | * load.c (rb_resolve_feature_path): search the path for already loaded feature. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: Move the rdoc of RubyVM.resolve_feature_path [Bug #15482]mame2018-12-301-10/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix missed script_compiled events. [Bug #15471]ko12018-12-271-3/+2
| | | | | | | | | | | | | | * ruby.c (process_options): script_compiled events are missed on command line -e or specified file. this commit fix it. [Bug #15471] This patch should be backport to Ruby 2.6 branch. * vm_core.h (rb_exec_event_hook_script_compiled): introduce utility function to invoke a script_compiled event. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `script_compiled` TracePoint event [Feature #15287]ko12018-12-061-1/+3
| | | | | | | | | | | | | | | | | * vm_trace.c: add `script_compiled` event. This event invoked after script compiling and before evaluating compiled script. Also the following methods are added: `TracePoint#compiled_instruction_sequence` method to get compiled `RubyVM::InstructionSequence` instance. `TracePoint#compiled_eval_script` method to get compiled script (String) by *eval methods (return nil if compiling by file). * vm_trace.c (tracepoint_attr_raised_exception): git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c (RubyVM.resolve_feature_path): New method. [Feature #15230]mame2018-12-061-0/+36
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Prefer `rb_fstring_lit` over `rb_fstring_cstr`nobu2018-10-131-1/+1
| | | | | | | The former states explicitly that the argument must be a literal, and can optimize away `strlen` on all compilers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: use ruby_sized_xfree for calloc-ed RArray VALUEnormal2018-05-211-1/+1
| | | | | | | | IMHO, this increases readability, too, since it's not immediately clear that the object is on the malloc heap and not a regular Ruby object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: reduce memory usage of loaded_features_indextenderlove2018-02-141-21/+20
| | | | | | | | | | | | Use integer hashsum instead of string as a key in loaded_features_index. Do not use ruby strings for substring operation, just plain pointer and length. [ruby-core:53688] Co-authored-by: Sokolov Yura aka funny_falcon <funny.falcon@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: use rb_warning directlynormal2018-01-201-3/+1
| | | | | | | | | | This removes the last dependency on rb_mWarning outside of error.c and allows future commits to mark it static. Yes, I expect this to slow down the emitting of a warning message in a cold code path slightly :P git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h: remove dependecy on ruby/encoding.hnobu2018-01-091-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* make rb_iseq_new* accept rb_ast_body_t instead of NODE*mame2018-01-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.h: define rb_ast_body_t and restructure rb_ast_tmame2018-01-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e