aboutsummaryrefslogtreecommitdiffstats
path: root/variable.c
Commit message (Collapse)AuthorAgeFilesLines
...
* variable.c: show namespacenobu2012-11-291-1/+5
| | | | | | | | * variable.c (rb_const_set): show namespace in warning messages. [Feature #7190] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove trailing spaces.nobu2012-08-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: split CVAR_LOOKUPnobu2012-08-061-21/+28
| | | | | | | * variable.c (CVAR_LOOKUP): split into helper functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: fix r36574nobu2012-07-311-15/+39
| | | | | | | | | | | * variable.c (classname): tell if found name is permanent. search tmp_classpath only if class id is set. [ruby-core:42865][Bug #6078] * variable.c (rb_class_path): duplicate found temporary path. * variable.c (rb_set_class_path_string, rb_set_class_path): set class id to find classpath. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: fix r36574nobu2012-07-301-14/+16
| | | | | | | | | | | | | * variable.c (find_class_path): no retry when preferred is given. * variable.c (classname): if classid is set try it to find full qualified class path, and then try arbitrary class path. try tmp_classpath at last even if enclosing namespace is anonymous. fix r36574. [ruby-core:42865][Bug #6078] * variable.c (rb_set_class_path_string, rb_set_class_path): set tmp_classpath instead of classpath if the name is not permanent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: tmp_classpathnobu2012-07-301-11/+39
| | | | | | | | * variable.c: store anonymous class path in tmp_classpath but not in classpath. [ruby-core:42865][Bug #6078] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: RB_TYPE_Pnobu2012-07-281-24/+23
| | | | | | | * variable.c: use RB_TYPE_P() and BUILTIN_TYPE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_mod_class_variables): return inherited variablesshugo2012-07-191-12/+71
| | | | | | | | | except when the optional argument is set to false. [ruby-dev:44034] [Bug #4971] * variable.c (rb_mod_constants): fix typo in documentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: fix indentnobu2012-06-221-4/+4
| | | | | | * variable.c (rb_ivar_count, rb_autoloading_value): fix indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (trace_ev): Removed "not reached" comment as this line isdrbrain2012-04-141-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reached. * variable.c (rb_obj_remove_instance_variable): Replaced "not reached" comment with the UNREACHABLE macro. * variable.c (rb_mod_const_missing): ditto. * variable.c (rb_mod_remove_cvar): ditto. * enum.c (first_i): ditto. * string.c (rb_str_aref): ditto. * string.c (str_byte_aref): ditto. * string.c (rb_to_id): ditto. * io.c (rb_io_fmode_modestr): ditto. * io.c (rb_io_oflags_modestr): ditto. * pack.c (num2i32): ditto. * vm_eval.c (rb_method_missing): ditto. * vm_eval.c (rb_f_throw): ditto. * dir.c (dir_read): ditto. * win32/win32.c (child_result): ditto. * struct.c (rb_struct_getmember): ditto. * struct.c (rb_struct_set): ditto. * struct.c (rb_struct_aref_id): ditto. * eval.c (rb_f_raise): ditto. * process.c (rb_f_exit_bang): ditto. * process.c (rb_f_exit): ditto. * process.c (rb_f_abort): ditto. * ext/-test-/iter/break.c (iter_break_value): ditto. * ext/pty/pty.c (pty_check): ditto. * ext/openssl/ossl_pkey.c (ossl_pkey_new): ditto. * ext/readline/readline.c (rb_remove_history): ditto. * ext/stringio/stringio.c (strio_unimpl): ditto. * numeric.c (num_sadded): ditto. * numeric.c (num_init_copy): ditto. * numeric.c (rb_num2ll): ditto. * numeric.c (rb_num2ull): ditto. * vm_insnhelper.c (call_cfunc): ditto. * ruby.c (opt_W_getter): ditto. * bignum.c (rb_big_coerce): ditto. * file.c (rb_f_test): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (mark_global_entry): remove unused variable.nobu2012-04-041-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typo in r35183nobu2012-04-041-1/+1
| | | | | | * variable.c (mark_global_entry): fix typo in r35183. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c, marshal.c, object.c, variable.c: fix callback argument typesnobu2012-03-301-9/+29
| | | | | | | of iterators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c: Simplify rdoc for remove_const [Bug #5354]marcandre2012-03-141-4/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (autoload_const_set, autoload_require): fixnobu2012-02-141-5/+8
| | | | | | | signatures. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (set_const_visibility): clear inine-cache when constant'snagachika2011-12-081-3/+9
| | | | | | | | | visibility is modified. [ruby-dev:44929] * test/ruby/test_module.rb (test_private_constants_clear_inlinecache): add test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (set_const_visibility): print a warning when no argumentmame2011-12-031-0/+4
| | | | | | | | | is passwd to Module#private_constant. [ruby-list:48558] * vm_method.c (set_method_visibility): ditto for Module#private_class_method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (set_const_visibility): Module#private_constant hasmame2011-12-031-1/+1
| | | | | | | | | changed the visibility of only the first argument. Now it changes all of them. [ruby-list:48558] * test/ruby/test_module.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_path2class): don't raise NameError when the middlenaruse2011-11-301-1/+1
| | | | | | | constant of the path is not defined but defined on toplevel. [ruby-core:41410] [Bug #5691] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * use RB_TYPE_P which is optimized for constant types, instead ofnobu2011-09-291-3/+3
| | | | | | comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_const_set): show the previous definitionnobu2011-09-031-1/+8
| | | | | | location. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_autoloading_value) Fix the order of definitions.naruse2011-09-011-12/+12
| | | | | | It is used by autoload_defined_p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_autoload): There was a chance to run GC (fromnahi2011-08-311-6/+6
| | | | | | | | | | | | | | | | | | | | rb_str_new2()) before finishing autoload_data_i construction. It caused SEGV at rb_gc_mark() at autoload_i_mark. * variable.c (rb_autoload_load): Move RB_GC_GUARD() to proper position based on suggestion by CHIKANAGA Tomoyuki at http://d.hatena.ne.jp/nagachika/20110826/ruby_trunk_changes_33070_33078 * variable.c (autoload_defined_p): Fix incompatible autoload behavior that causes Rails crash. Class deifnition instruction defined in 'defineclass' in insns.def always invokes rb_autoload_load for a constant. It's invoked for every class definition regardless of existence of autoload definition. rb_autoload_load checkes if a constant is defined as autoloaded, but new thread-safe autoload returned different value if the constant is under autoloading. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * Re-apply r33078, thread-safe autoload which is reverted at r33093.nahi2011-08-311-31/+163
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * Revert r33078. It caused a Rails application NoMethodError.nahi2011-08-271-163/+31
| | | | | | | | /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/utils.rb:157: warning: toplevel constant ScanError referenced by Regin::Parser::ScanError /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/vendor/regin/regin/parser.rb:17:in `parse_regexp': undefined method `scan_str' for #<Regin::Parser:0x00000002344548> (NoMethodError) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c: Make autoload thread-safe. See #921.nahi2011-08-261-31/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What's the problem? autoload is thread unsafe. When we define a constant to be autoloaded, we expect the constant construction is invariant. But current autoload implementation allows other threads to access the constant while the first thread is loading a file. What's happening inside? The current implementation uses Qundef as a marker of autoload in Constant table. Once the first thread find Qundef as a value at constant lookup, it starts loading a defined feature. Generally a loaded file overrides the Qundef in Constant table by module/class declaration at very beginning lines of the file, so other threads can see the new Module/Class object before feature loading is finished. It breaks invariant construction. How to solve? To ensure invariant constant construction, we need to override Qundef with defined Object after the feature loading. For keeping Qundef in Constant table, I expanded autoload_data struct in Module to have a slot for keeping the defined object while feature loading. And changed Module's constant lookup/update logic a little so that the slot is only visible from the thread which invokes feature loading. (== the first thread which accessed the autoload constant) Evaluation? All test passes (bootstrap test, test-all and RubySpec) and added 8 tests for threading behavior. Extra logics are executed only when Qundef is found, so no perf drop should happen except autoloading. * variable.c (rb_autoload): Prepare new autoload_data struct. * variable.c (rb_autoload_load): Load feature and update Constant table after feature loading is finished. * variable.c (rb_const_get_0): When the fetched constant is under autoloading, it returns the object only for the thread which starts autoloading. * variable.c (rb_const_defined_0): Ditto. * variable.c (rb_const_set): When the specified constant is under autoloading, it sets the object only for the thread which starts autoloading. Otherwise, simply overrides Qundef with constant override warning. * vm_insnhelper.c (vm_get_ev_const): Apply same change as rb_const_get_0 in variable.c. * test/ruby/test_autoload.rb: Added tests for threading behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (autoload_delete): An autoload entry is still in a nahi2011-08-111-3/+1
| | | | | | | | | | RCLASS_IV_TBL, not in a RCLASS_CONST_TBL, so take back the table changed in r29600. And an autoload entry keeps not a rb_const_entry_t but a NODE so remove rb_const_entry_t thing added in r29602. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (check_before_mod_set): should be static.nobu2011-08-031-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval_error.c (rb_print_undef_str): new function to raisenobu2011-07-261-2/+9
| | | | | | | | | | | NameError for undefined method. * load.c (rb_mod_autoload_p), object.c (rb_mod_const_get), variable.c (rb_f_untrace_var, set_const_visibility), vm_method.c (rb_mod_{remove,undef,alias}_method, set_method_visibility): remove inadvertent symbol creation. based on the first patch by Jeremy Evans at [ruby-core:38447]. [Feature #5089] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (rb_check_id): make the given name a symbol or a string.nobu2011-07-261-3/+3
| | | | | | based on the second patch by Jeremy Evans at [ruby-core:38447] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * error.c (rb_name_error_str): new function to raise NameErrornobu2011-07-231-3/+29
| | | | | | | | with the name string but not ID. * object.c, proc.c, variable.c: more removal of inadvertent symbol creation. [Feature #5079] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * class.c (Init_class_hierarchy): should name BasicObjectmatz2011-06-301-1/+1
| | | | | | | | | explicitly. * variable.c (rb_const_defined_0): should not check for superclasses as const_get. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_const_get_0): should not look for superclasses ifmatz2011-06-291-1/+1
| | | | | | | the second optional argument is given for #const_get(). fix [Bug #3422] [Bug #3423] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: declare internal functions here.akr2011-06-171-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | * node.h: declare NODE dependent internal functions here. * iseq.h: declare rb_iseq_t dependent internal functions here. * vm_core.h: declare rb_thread_t dependent internal functions here. * bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c, enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c, iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y, proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c, thread.c, time.c, transcode.c, variable.c, vm.c, tool/compile_prelude.rb: don't declare internal functions declared in above headers. include above headers if required. Note that rb_thread_mark() was declared as void rb_thread_mark(rb_thread_t *th) in cont.c but defined as void rb_thread_mark(void *ptr) in vm.c. Now it is declared as the later in internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * remove trailing spaces.nobu2011-06-171-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (const_missing): Add simple example of const_missing.drbrain2011-06-161-20/+28
| | | | | | | Patch by Anuj Dutta. [Ruby 1.9 - Bug #4794] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: add for internal use only.nobu2011-05-181-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_autoload_p): search superclasses as same as actualnobu2011-04-141-1/+4
| | | | | | loading. fixes [ruby-core:35679] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_const_defined_0): fix autoloading base.nobu2011-03-241-1/+1
| | | | | | [ruby-core:35509] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * prevent temporary objects from GC, and should not usenobu2011-02-201-1/+2
| | | | | | | RSTRING_PTR() for function calls since it evaluates the argument a couple of times. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * addr2line.c: suppressed shorten-64-to-32 warnings.naruse2011-01-311-1/+1
| | | | | | | | | | | | * regcomp.c: ditto. * regexec.c: ditto. * regint.h: ditto. * regparse.c: ditto. * regparse.h: ditto. * time.c: ditto. * variable.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_mod_const_of, sv_i): Module#constant should excludemame2011-01-281-3/+5
| | | | | | | | | private constants. see [ruby-core:32912]. * test/ruby/test_module.rb (test_constants_with_private_constant): add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_const_set): const_set shoud preserve constantmame2011-01-281-3/+7
| | | | | | | | visibility. see [ruby-core:32912]. * test/ruby/test_module.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * constant.h, variable.c: to ensure compatibility, rb_const_get_* mustmame2011-01-281-10/+50
| | | | | | | | | | | | | | | | not raise an exception even when the constant is private. Instead, rb_public_const_get_* and rb_public_const_defined_* are introduced, which raise an exception when the referring constant is private. see [ruby-core:32912]. * vm_insnhelper.c (vm_get_ev_const): use rb_public_const_get_* instead of rb_const_get_* to follow the constant visibility when user code refers a constant. * test/ruby/test_marshal.rb (test_marshal_private_class): add a test. This test had failed because of incompatibility of rb_const_get. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (set_const_visibility): fix typo. a patch from Tomoyukimame2011-01-281-1/+1
| | | | | | Chikanaga in [ruby-core:32919]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c: parenthesize macro arguments.akr2011-01-111-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * object.c (Init_Object), constant.h, variable.cmame2010-10-261-1/+56
| | | | | | | | | | (rb_mod_private_constant, rb_mod_public_constant, set_const_visibility, rb_const_get_0): add Module#public_constant and private_constant. [ruby-dev:39685][ruby-core:32698] * test/ruby/test_module.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * class.c, constant.h, gc.c, method.h, object.c, variable.c,mame2010-10-261-10/+25
| | | | | | | | | | | | vm_insnhelper.c: use struct rb_constant_entry_t as entry of RCLASS_CONST_TBL. RCLASS_CONST_TBL has contained VALUE of constant directly. Now instead rb_const_entry_t is contained in RCLASS_CONST_TBL, rb_const_entry_t is managed by malloc, and have not only the value itself but also visibility flag. This is another preparation for private constant (see [ruby-dev:39685][ruby-core:32698]). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * class.c, gc.c, object.c, variable.c, vm_insnhelper.c,mame2010-10-261-38/+42
| | | | | | | | | | include/ruby/ruby.h: separate RCLASS_CONST_TBL from RCLASS_IV_TBL. RCLASS_IV_TBL has contained not only instance variable table but also constant table. Now the two table are separated to RCLASS_CONST_TBL and RCLASS_IV_TBL. This is a preparation for private constant (see [ruby-dev:39685][ruby-core:32698]). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, gc.c, hash.c, object.c, string.c, struct.c,nobu2010-10-241-14/+5
| | | | | | | | transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c: replace calls to rb_error_frozen() with rb_check_frozen(). a patch from Run Paint Run Run at [ruby-core:32014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e