aboutsummaryrefslogtreecommitdiffstats
path: root/load.c
Commit message (Collapse)AuthorAgeFilesLines
* th->ec: rb_load_internal0ko12017-11-071-11/+12
| | | | | | | * load.c (rb_load_internal0): accepts `ec`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.h (ast_t): renamed to `rb_ast_t`.ko12017-10-291-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "Revert "Manage AST NODEs out of GC""mame2017-10-271-3/+4
| | | | | | | This re-introduces r60485. This reverts commit 5a176b75b1187cbd3861c387bde65ff66396a07c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "Manage AST NODEs out of GC"mame2017-10-271-4/+3
| | | | | | This reverts commit 620ba74778bfdbdc34ffbb142d49ce84a0ef58e9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Manage AST NODEs out of GCmame2017-10-271-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NODEs in AST are no longer objects managed by GC. This change will remove the restriction imposed by the GC. For example, a NODE can use more than five words (this is my primary purpose; we want to store the position data for each NODE, for coverage library), or even a NODE can have variable length (some kinds of NODEs have unused fields). To do this, however, we need more work, since Ripper still uses T_NODE objects managed by the GC. The life time of NODEs is more obvious than other kinds of objects; they are created at parsing, and they become disused immediately after compilation. This change releases all NODEs by a few `xfree`s after compilation, so performance will be improved a bit. In extreme example, `eval("x=1;" * 10000000)` runs much faster (40 sec. -> 7.8 sec. on my machine). The most important part of this change is `ast_t` struct, which has three contents: (1) NODE buffer (malloc'ed memory), (2) a reference to the root NODE, and (3) an array that contains objects that must be marked during parsing (such as literal objects). Some functions that had received `NODE*` arguments, must now receive `ast_t*`. * node.c, node.h: defines `ast_t` struct and related operations. * gc.c, internal.h: defines `imemo_ast`. * parse.y: makes `parser_params` struct have a reference to `ast_t`. Instead of `rb_node_newnode`, use `rb_ast_newnode` to create a NODE. * iseq.c, load.c, ruby.c, template/prelude.c.tmpl: modifies some functions to handle `ast_t*` instead of `NODE*`. * test/ruby/test_gc.rb: ad-hoc fix for a failed test. The test assumes GC eden is increased at startup by NODE object creation. However, this change now create no NODE object, so GC eden is not necessarily increased. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* introduce EC_*_TAG() instead of TH_*_TAG()ko12017-10-261-5/+5
| | | | | | | | | | | | | | | | * eval_intern.h: introduce EC_*_TAG() macros instead of TH_*_TAG() macros. * TH_PUSH_TAG() -> EC_PUSH_TAG() * TH_POP_TAG() -> EC_POP_TAG() * TH_TMPPOP_TAG() -> EC_TMPPOP_TAG() * TH_REPUSH_TAG() -> EC_REPUSH_TAG() * TH_EXEC_TAG() -> EC_EXEC_TAG() * TH_JUMP_TAG() -> EC_JUMP_TAG() rb_threadptr_tag_state() , rb_ec_tag_jump() also accept `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use rb_execution_context_t instead of rb_thread_tko12017-10-261-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | to represent execution context [Feature #14038] * vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer. There are many code using `th` to represent execution context (such as cfp, VM stack and so on). To access `ec`, they need to use `th->ec->...` (adding one indirection) so that we need to replace them by passing `ec` instead of `th`. * vm_core.h (GET_EC()): introduced to access current ec. Also remove `ruby_current_thread` global variable. * cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of rb_context_t::thread_value. * cont.c (ec_set_vm_stack): added to update vm_stack explicitly. * cont.c (ec_switch): added to switch ec explicitly. * cont.c (rb_fiber_close): added to terminate fibers explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: fetch retval iff necessarynobu2017-09-251-0/+2
| | | | | | | | * vm.c (rb_vm_make_jump_tag_but_local_jump): get rid of fetching retval when it is not used. it is necessary for local jump state only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: fix rb_load_protect conditionnobu2017-09-241-1/+1
| | | | | | | * load.c (rb_load_protect): fix the condition to load the found file. fixup of r59155. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: real path to loadnobu2017-09-211-1/+2
| | | | | | | | * load.c (rb_construct_expanded_load_path): expand load paths to real paths to get rid of duplicate loading from symbolic-linked directories. [Feature #10222] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move fields to ec.ko12017-06-281-6/+6
| | | | | | | | | | * vm_core.h (rb_thread.h): move errinfo and trace_arg to rb_execution_context_t. * cont.c (fiber_switch, rb_cont_call): do not restore "trace_arg" here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use "enum ruby_tag_type" and TAG_NONE.ko12017-06-231-10/+10
| | | | | | | | | | | | | | | Return value of EXEC_TAG() is saved by "int state". Instead of "int", use "enum ruby_tag_type". First EXEC_TAG() value should be 0, so that define TAG_NONE (= 0) and use it. Some code used "status" instead of "state". To make them clear, rename them to state. We can change variable name from "state" to "tag_state", but this ticket doesn't contain it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: get rid of side effectsnobu2017-06-071-8/+7
| | | | | | | * load.c (rb_f_load, rb_require_internal): DTrace hooks should not have side effects, i.e., conversion to String. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: encode to OS path outside PUSH_TAGnobu2017-06-041-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: convert by rb_get_path_checknobu2017-06-011-4/+4
| | | | | | | * load.c (rb_require_internal): convert to path name with the given safe level, without setting global safe level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: remove a redundant rb_str_freeze callnormal2017-04-291-1/+0
| | | | | | | | | | | rb_file_expand_path_fast already performs the buffer shrinking rb_str_freeze does (via expand_path macro in file.c); the result of rb_fstring is always frozen, and that rb_fstring call is the last use of `expanded_path` in its scope. load.c (rb_construct_expanded_load_path): remove rb_str_freeze git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Send the backtrace of the circular require warning as a single String to ↵eregon2017-04-271-2/+3
| | | | | | | | | | | Warning.warn * load.c: send as a single string. * error.c: expose the string formatted by rb_warning as rb_warning_string(). * test/ruby/test_exception.rb: update tests. [ruby-core:80850] [Bug #13505] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: make fstrings from C strings soonernormal2017-04-271-3/+2
| | | | | | | | | | The underlying string objects will become fstrings anyways, so create the fstring directly from the C string to reduce intermediate garbage. * load.c (rb_provide, rb_provide): create fstring git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: backtrace of circular requirenobu2017-04-251-1/+3
| | | | | | | * load.c (load_lock): print backtrace of circular require via `Warning.warn` [ruby-core:80850] [Bug #13505] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* introduce imemo_type_p(v, imemo_type)ko12017-04-071-1/+1
| | | | | | | | * internal.h: introduce imemo_type_p() which checks the given value is T_IMEMO and imemo_type() == given imemo_type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* deduplicate strings sooner at load and compilenormal2017-03-011-1/+2
| | | | | | | | | | | | We can use rb_fstring_cstr in some places to prevent an intermediate object from being created before deduplication via rb_fstring. * compile.c (iseq_compile_each): use rb_fstring_cstr (rb_insns_name_array): ditto * load.c (rb_load_internal0): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Adjust indent [ci skip]nobu2016-12-091-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add a comment.shugo2016-12-051-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Don't insert an entry to loading_tbl if another thread succeed to load.shugo2016-12-051-4/+4
| | | | | | | | If rb_thread_shield_wait() returns Qfalse, the file has been successfully loaded by another thread, so there is no need to insert a new entry into loading_tbl. [ruby-core:78464] [Bug #12999] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: setup syntax error backtracenobu2016-10-061-0/+1
| | | | | | | | * load.c (rb_require_safe): SyntaxError created by the parser just has the mesage and needs to set up the backtrace. [ruby-core:77491] [Bug #12811] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: fix load/require contextnobu2016-10-061-1/+1
| | | | | | | * load.c (rb_load_internal0): load/require is not the main script. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: revisit the structure of frame, block and env.ko12016-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | [Bug #12628] This patch introduce many changes. * Introduce concept of "Block Handler (BH)" to represent passed blocks. * move rb_control_frame_t::flag to ep[0] (as a special local variable). This flags represents not only frame type, but also env flags such as escaped. * rename `rb_block_t` to `struct rb_block`. * Make Proc, Binding and RubyVM::Env objects wb-protected. Check [Bug #12628] for more details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use TH_JUMP_TAGnobu2016-05-051-1/+1
| | | | | | | | * vm_eval.c (rb_eval_cmd, rb_catch_obj): use TH_JUMP_TAG with the same rb_thread_t used for TH_PUSH_TAG, instead of JUMP_TAG with the current thread global variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: fix r54521nobu2016-04-091-5/+2
| | | | | | * load.c (rb_f_load): do not convert the encoding twice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: raise name before conversionnobu2016-04-091-2/+5
| | | | | | | * load.c (rb_f_load): raise with the original path name before encoding conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove rb_thread_t::parse_in_evalnobu2016-03-281-1/+1
| | | | | | | | | | | | * parse.y (struct parser_params): move parse_in_eval flag from rb_thread_t. * parse.y (rb_parser_set_context): set parsing context, not only mild error flag. * iseq.c (rb_iseq_compile_with_option): the parser now refers no thread local states to be restored. * vm_eval.c (eval_string_with_cref): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* SyntaxError message at iseq compilenobu2016-03-191-6/+3
| | | | | | | | | | | | * iseq.c (rb_iseq_compile_with_option): make the parser in mild error. * load.c (rb_load_internal0): ditto. * parse.y (yycompile0): return the error message within the error to be raised. [Feature #11951] * parse.y (parser_compile_error): accumulate error messages in the error_buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * introduce new ISeq binary format serializer/de-serializerko12015-12-081-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and a pre-compilation/runtime loader sample. [Feature #11788] * iseq.c: add new methods: * RubyVM::InstructionSequence#to_binary_format(extra_data = nil) * RubyVM::InstructionSequence.from_binary_format(binary) * RubyVM::InstructionSequence.from_binary_format_extra_data(binary) * compile.c: implement body of this new feature. * load.c (rb_load_internal0), iseq.c (rb_iseq_load_iseq): call RubyVM::InstructionSequence.load_iseq(fname) with loading script name if this method is defined. We can return any ISeq object as a result value. Otherwise loading will be continue as usual. This interface is not matured and is not extensible. So that we don't guarantee the future compatibility of this method. Basically, you should'nt use this method. * iseq.h: move ISEQ_MAJOR/MINOR_VERSION (and some definitions) from iseq.c. * encoding.c (rb_data_is_encoding), internal.h: added. * vm_core.h: add several supports for lazy load. * add USE_LAZY_LOAD macro to specify enable or disable of this feature. * add several fields to rb_iseq_t. * introduce new macro rb_iseq_check(). * insns.def: some check for lazy loading feature. * vm_insnhelper.c: ditto. * proc.c: ditto. * vm.c: ditto. * test/lib/iseq_loader_checker.rb: enabled iff suitable environment variables are provided. * test/runner.rb: enable lib/iseq_loader_checker.rb. * sample/iseq_loader.rb: add sample compiler and loader. $ ruby sample/iseq_loader.rb [dir] will compile all ruby scripts in [dir]. With default setting, this compile creates *.rb.yarb files in same directory of target .rb scripts. $ ruby -r sample/iseq_loader.rb [app] will run with enable to load compiled binary data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* introduce rb_autoload_str to replace rb_autoloadnormal2015-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rb_autoload_str may be safer by preventing premature GC. It can also be more efficient by passing a pre-frozen string that can be deduped using rb_fstring. Common autoload callers (e.g. rubygems, rdoc) already use string literals as the file argument. There seems to be no reason to expose rb_autoload_str to the public C API since autoload is not performance-critical. Applications may declare autoloads in Ruby code or via rb_funcall; so merely deprecate rb_autoload without exposing rb_autoload_str to new users. Running: valgrind -v ruby -rrdoc -rubygems -e exit shows a minor memory reduction (32-bit userspace) before: in use at exit: 1,600,621 bytes in 28,819 blocks total heap usage: 55,786 allocs, 26,967 frees, 6,693,790 bytes allocated after: in use at exit: 1,599,778 bytes in 28,789 blocks total heap usage: 55,739 allocs, 26,950 frees, 6,692,973 bytes allocated * include/ruby/intern.h (rb_autoload): deprecate * internal.h (rb_autoload_str): declare * load.c (rb_mod_autoload): use rb_autoload_str * variable.c (rb_autoload): become compatibility wrapper (rb_autoload_str): hoisted out from old rb_autoload [ruby-core:71369] [Feature #11664] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h: RUBY_DTRACE_HOOKnobu2015-10-311-30/+6
| | | | | | | | | | | * internal.h (RUBY_DTRACE_HOOK): extract from RUBY_DTRACE_CREATE_HOOK for other type hooks. * gc.c (RUBY_DTRACE_GC_HOOK): ditto. * parse.y (RUBY_DTRACE_PARSE_HOOK): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c (features_index_add): avoid repeat calculationnormal2015-08-131-2/+5
| | | | | | | | Reduce cognitive overhead, eye strain and keep lines less than 80 columns to benefit users of giant fonts (honestly I prefer 64 column wrap :P). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: match comment with variable (`e' => `ext') [ci skip]normal2015-08-121-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: use rb_load_internal0nobu2015-07-311-3/+5
| | | | | | | * load.c (rb_require_internal): use rb_load_internal0 not to raise a exception to be caught. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: stop separating exits at loadingnobu2015-07-301-6/+0
| | | | | | | | | | * load.c (rb_load_internal0): stop separating exits at loading from exits from execution. TAG_FATAL is the only case that `errinfo` is a Fixnum, and should continue to exit by JUMP_TAG but not raising as an ordinary exception. [ruby-core:70169] [Bug #11404] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: avoid segfault when 'throw' occurs in the middle of rb_load_file_strnobu2015-07-301-1/+1
| | | | | | | | | | | | | | | | | | How can a 'throw' happen while the current thread is reading a Ruby source file from disk and parsing it? It can happen if another thread calls Thread#raise, and passes an Exception object which responds to #exception, and the custom #exception method calls Kernel#throw. In practice, this is most likely to happen if you combine the use of autoload and Timeout.timeout. An extra check is required to avoid a segfault in this case. * load.c (rb_load_internal0): extra check before returning TAG_RAISE when a non-local transfer of control happens while loading and parsing a Ruby source file. [ruby-core:70169] [Bug #11404] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: use enumnobu2015-07-261-1/+1
| | | | | | | * load.c (rb_construct_expanded_load_path): use enum for the purpose. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * make rb_iseq_t T_IMEMO object (type is imemo_iseq).ko12015-07-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All contents of previous rb_iseq_t is in rb_iseq_t::body. Remove rb_iseq_t::self because rb_iseq_t is an object. RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq. So RubyVM::ISeq.of(something) method returns different wrapper objects but they point the same T_IMEMO/iseq object. This patch is big, but most of difference is replacement of iseq->xxx to iseq->body->xxx. (previous) rb_iseq_t::compile_data is also located to rb_iseq_t::compile_data. It was moved from rb_iseq_body::compile_data. Now rb_iseq_t has empty two pointers. I will split rb_iseq_body data into static data and dynamic data. * compile.c: rename some functions/macros. Now, we don't need to separate iseq and iseqval (only VALUE). * eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq). * ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq. * gc.c: check T_IMEMO/iseq. * internal.h: add imemo_type::imemo_iseq. * iseq.c: define RubyVM::InstructionSequnce as T_OBJECT. Methods are implemented by functions named iseqw_.... * load.c (rb_load_internal0): rb_iseq_new_top() returns rb_iseq_t (T_IMEMO/iesq). * method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq). * vm_core.h (GetISeqPtr): removed because it is not T_DATA now. * vm_core.h (struct rb_iseq_body): remove padding for [Bug #10037][ruby-core:63721]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c (ruby_dln_librefs): make staticnormal2015-07-211-1/+1
| | | | | | | This isn't used outside of load.c, so there appears to be no reason to expose it to other modules. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: use TAG_RETURNnobu2015-07-181-5/+4
| | | | | | * load.c (rb_require_internal): use TAG_RETURN not a magic number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: reduce EXEC_TAGsnobu2015-07-181-9/+26
| | | | | | | | * load.c (rb_load_internal0): do not raise any exceptions but return the result tag state. * load.c (rb_load_protect): reduce nested EXEC_TAGs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: use fstring for loaded features and expanded load pathnormal2015-07-161-3/+3
| | | | | | | | | | | | | | | | | Loaded features is an obvious candidate for fstring since feature paths of Ruby sources are included in iseq locations, and iseq locations are in the fstring table anyways. Deduplicating expanded load path can reuse old objects, since since repeated expansions may recycle before old expanded paths are GC-ed away. * load.c (rb_construct_expanded_load_path): fstring expanded path (get_loaded_features_index): fstring feature path (rb_provide_feature): ditto [ruby-core:69871] [Feature #11331] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: use RB_GC_GUARDnobu2015-06-241-1/+2
| | | | | | | * load.c (rb_feature_provided): use RB_GC_GUARD for fullpath after last use of feature. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c: rename `rb_frame_...' to `rb_scope_...'.ko12015-06-031-1/+1
| | | | | | | | | * eval_intern.h: move decl. of rb_scope_visibility_set() to method.h. * load.c: catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c: eagerly allocate `loading_table`. This eliminates the need totenderlove2015-06-031-54/+45
| | | | | | | | | do NULL checks when looking up the `loading_table` hash. https://github.com/ruby/ruby/pull/918 * load.c: remove various NULL checks git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: split rb_method_definition_t::flag to several flags.ko12015-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `flag' contains several categories of attributes and it makes us confusion (at least, I had confused). * rb_method_visibility_t (flags::visi) * NOEX_UNDEF -> METHOD_VISI_UNDEF = 0 * NOEX_PUBLIC -> METHOD_VISI_PUBLIC = 1 * NOEX_PRIVATE -> METHOD_VISI_PRIVATE = 2 * NOEX_PROTECTED -> METHOD_VISI_PROTECTED = 3 * NOEX_SAFE(flag)) -> safe (flags::safe, 2 bits) * NOEX_BASIC -> basic (flags::basic, 1 bit) * NOEX_MODFUNC -> rb_scope_visibility_t in CREF * NOEX_SUPER -> MISSING_SUPER (enum missing_reason) * NOEX_VCALL -> MISSING_VCALL (enum missing_reason) * NOEX_RESPONDS -> BOUND_RESPONDS (macro) Now, NOEX_NOREDEF is not supported (I'm not sure it is needed). Background: I did not know what "NOEX" stands for. I asked Matz (who made this name) and his answer was "Nothing". "At first, it meant NO EXport (private), but the original meaning was gone." This is why I remove the mysterious word "NOEX" from MRI. * vm_core.h: introduce `enum missing_reason' to represent method_missing (NoMethodError) reason. * eval_intern.h: introduce rb_scope_visibility_t to represent scope visibility. It has 3 method visibilities (public/private/protected) and `module_function`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e