summaryrefslogtreecommitdiff
path: root/load.c
AgeCommit message (Collapse)Author
2021-09-12Replace RB_TYPE_P macro to FIXNUM_P and RB_INTEGER_TYPE_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4816
2021-09-10Remove stale DLEXT2Nobuyoshi Nakada
Actually disabled at 181a3a2af5df88d145b73a060d51fe437c8c4ad4 in 2004, it has remained in config.status and been carried over to rbconfig.rb.
2021-08-02Using RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4695 Merged-By: nobu <nobu@ruby-lang.org>
2021-07-28Avoid pointless attempts to open .so file if already requiredJeremy Evans
When attempting to require a file without an extension that has already been required or provided with an .so extension, only look for files with an .rb extension. There is no point in trying to find files with an .so extension, since we already know one has been loaded. Previously, attempting to require such a file scanned the load path twice, once for .rb and once for .so. Now it only scans once for .rb. The scan once for .rb cannot be avoided, since the .rb file would take precedence and should be loaded if it exists. Fixes [Bug #10902] Notes: Merged: https://github.com/ruby/ruby/pull/4687
2021-07-24Sort feature index arrays by the priority of file types [Bug #15856]Nobuyoshi Nakada
When looking for libraries to load with a feature name without extension, `.rb` files are given priority. However, since the feature index arrays were not in that order of priority, but in the order in which they were loaded, a lower priority extension library might be returned. In that case, the `.rb` file had to be searched for again from the `$LOAD_PATH`, resulting in poor performance. Notes: Merged: https://github.com/ruby/ruby/pull/4679
2021-07-18Get rid of type aliasingNobuyoshi Nakada
2021-06-14Suppress gcc11 clobbered warningNobuyoshi Nakada
2021-06-14Revert "Suppress gcc11 clobbered warning"Samuel Williams
This reverts commit f0f9e77b65990001bd2acb42e1c6b673f6324425. Notes: Merged: https://github.com/ruby/ruby/pull/4570
2021-06-14Pack values to preserveNobuyoshi Nakada
2021-06-14Suppress gcc11 clobbered warningNobuyoshi Nakada
2021-02-16`$LOAD_PATH.resolve_feature_path` should not raiseDavid Rodríguez
I think it's more friendly and easier to work with to return `nil` when the feature is not found in the $LOAD_PATH. Notes: Merged: https://github.com/ruby/ruby/pull/2317
2020-12-11Suppress a "clobbered" warning by gcc on macOSNobuyoshi Nakada
2020-12-01rb_ext_ractor_safe() to declare ractor-safe extKoichi Sasada
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] Notes: Merged: https://github.com/ruby/ruby/pull/3824
2020-10-21Don't redefine #rb_intern over and over againStefan Stüben
Notes: Merged: https://github.com/ruby/ruby/pull/3589
2020-10-09rb_class_real never returns QnilNobuyoshi Nakada
2020-07-09Document that Kernel#load will load relative to current directory [ci skip]Jeremy Evans
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]
2020-06-29search_required: 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_feature_p: 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-01[DOC] relative filename `Kernel#.require` and `Kernel#.load` [ci skip]MSP-Greg
Notes: Merged: https://github.com/ruby/ruby/pull/3167
2020-05-30[DOC] refined `Kernel#.require` and `Kernel#.load` [ci skip]Nobuyoshi Nakada
2020-05-30[DOC] mentioned "explicit relative path" [ci skip]Nobuyoshi Nakada
`Kernel#.require` and `Kernel#.load` do not search also "explicit relative path" files, not only absolute paths, in the load path.
2020-04-30Remove deprecated rb_require_safeJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/3071
2020-02-04Add the loaded feature after no exception raisedNobuyoshi Nakada
Retrying after rescued `require` should try to load the same library again. [Bug #16607] Notes: Merged: https://github.com/ruby/ruby/pull/2879
2019-12-26decouple internal.h headers卜部昌平
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). Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-12-03Fixed stack overflow [Bug #16382]Nobuyoshi Nakada
Get rid of infinite recursion in expanding a load path to the real path while loading a transcoder. Notes: Merged: https://github.com/ruby/ruby/pull/2714
2019-11-19care about TAG_FATAL.Koichi Sasada
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]
2019-11-18Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans
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. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-11-14delete unused functions卜部昌平
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. Notes: Merged: https://github.com/ruby/ruby/pull/2677
2019-08-29drop-in type check for rb_define_global_function卜部昌平
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.
2019-08-27delete `$` sign from C identifiers卜部昌平
They lack portability. See also https://travis-ci.org/shyouhei/ruby/jobs/577164015
2019-08-27struct MEMO now free from ANYARGS卜部昌平
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.
2019-08-27rb_define_hooked_variable now free from ANYARGS卜部昌平
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.
2019-08-18Omit a tag unless loading with a wrapper moduleNobuyoshi Nakada
2019-08-09Should require without wrapper moduleNobuyoshi Nakada
2019-08-08Reduce unnecessary EXEC_TAG in requireNobuyoshi Nakada
2019-08-08solve "duplicate :raise event" in require too [Bug #15877]Nobuyoshi Nakada
2019-08-08Use `ec` instead of `th->ec` where the `th` came from the `ec`Nobuyoshi Nakada
2019-08-08* expand tabs.git
2019-08-08solve "duplicate :raise event" [Bug #15877]Koichi Sasada
Without this patch, "raise" event invoked twice when raise an exception in "load"ed script. This patch by danielwaterworth (Daniel Waterworth). [Bug #15877]
2019-08-05Do not expect RSTRING_PTR valid after rb_fstringNobuyoshi Nakada
2019-08-04* expand tabs.git
2019-08-04Fix dangling path name from fstringNobuyoshi Nakada
* 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]
2019-07-14Add a /* fall through */ commentYusuke Endoh
2019-07-13Document $LOAD_PATH.resolve_feature_path in globals.rdocBenoit Daloze
* RDoc does not seem to support documenting singleton object methods, and making $LOAD_PATH a class as a workaround is too weird.
2019-07-11$LOAD_PATH.resolve_feature_pathNobuyoshi Nakada
Moved from RubyVM. [Feature #15903]
2019-06-21Turned `recur` into `int` [Feature #15777]Nobuyoshi Nakada
2019-06-21Add an optional `inherit` argument to Module#autoload?Jean Boussier
[Feature #15777] Closes: https://github.com/ruby/ruby/pull/2173
2019-03-22[DOC] fix markups [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-31* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-31load.c: resolve_feature_pathnobu
* 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