summaryrefslogtreecommitdiff
path: root/variable.c
AgeCommit message (Collapse)Author
2012-12-04marshal.c: GC guardnobu
* marshal.c (w_object, marshal_dump, r_object0, marshal_load): use RB_GC_GUARD() (directly or indirectly) instead of volatile. * variable.c (rb_path_to_class): prevent the arguemnt from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01* variable.c (rb_class_path_no_cache): add a function to get the classtenderlove
path without caching the computed path. Some classes are frozen, and will raise an exception without this. * probes.d (cmethod-entry, cmethod-return): separate cmethods from regular methods to match set trace func. * probes_helper.h: refactor macros. Fix probes to avoid calling #inspect when profiling. * insns.def: update for use with new macros. * vm_eval.c: ditto * vm_insnhelper.c: ditto * test/dtrace/test_singleton_function.rb: fix test for new output. * test/dtrace/test_cmethod.rb: test the cmethod probes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29variable.c: show namespacenobu
* 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
2012-08-23remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-06variable.c: split CVAR_LOOKUPnobu
* 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
2012-07-31variable.c: fix r36574nobu
* 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
2012-07-30variable.c: fix r36574nobu
* 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
2012-07-30variable.c: tmp_classpathnobu
* 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
2012-07-28variable.c: RB_TYPE_Pnobu
* 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
2012-07-19* variable.c (rb_mod_class_variables): return inherited variablesshugo
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
2012-06-22variable.c: fix indentnobu
* 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
2012-04-14* variable.c (trace_ev): Removed "not reached" comment as this line isdrbrain
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
2012-04-04* variable.c (mark_global_entry): remove unused variable.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-04fix typo in r35183nobu
* 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
2012-03-30* hash.c, marshal.c, object.c, variable.c: fix callback argument typesnobu
of iterators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14* variable.c: Simplify rdoc for remove_const [Bug #5354]marcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-14* variable.c (autoload_const_set, autoload_require): fixnobu
signatures. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-08* variable.c (set_const_visibility): clear inine-cache when constant'snagachika
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
2011-12-03* variable.c (set_const_visibility): print a warning when no argumentmame
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
2011-12-03* variable.c (set_const_visibility): Module#private_constant hasmame
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
2011-11-30* variable.c (rb_path2class): don't raise NameError when the middlenaruse
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
2011-09-29* use RB_TYPE_P which is optimized for constant types, instead ofnobu
comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-03* variable.c (rb_const_set): show the previous definitionnobu
location. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-01* variable.c (rb_autoloading_value) Fix the order of definitions.naruse
It is used by autoload_defined_p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-31* variable.c (rb_autoload): There was a chance to run GC (fromnahi
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
2011-08-31* Re-apply r33078, thread-safe autoload which is reverted at r33093.nahi
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27* Revert r33078. It caused a Rails application NoMethodError.nahi
/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
2011-08-26* variable.c: Make autoload thread-safe. See #921.nahi
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
2011-08-11* variable.c (autoload_delete): An autoload entry is still in a nahi
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
2011-08-03* variable.c (check_before_mod_set): should be static.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-26* eval_error.c (rb_print_undef_str): new function to raisenobu
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
2011-07-26* parse.y (rb_check_id): make the given name a symbol or a string.nobu
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
2011-07-23* error.c (rb_name_error_str): new function to raise NameErrornobu
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
2011-06-30* class.c (Init_class_hierarchy): should name BasicObjectmatz
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
2011-06-29* variable.c (rb_const_get_0): should not look for superclasses ifmatz
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
2011-06-17* internal.h: declare internal functions here.akr
* 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
2011-06-17* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-16 * variable.c (const_missing): Add simple example of const_missing.drbrain
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
2011-05-18* internal.h: add for internal use only.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-14* variable.c (rb_autoload_p): search superclasses as same as actualnobu
loading. fixes [ruby-core:35679] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-24* variable.c (rb_const_defined_0): fix autoloading base.nobu
[ruby-core:35509] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-20* prevent temporary objects from GC, and should not usenobu
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
2011-01-31* addr2line.c: suppressed shorten-64-to-32 warnings.naruse
* 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
2011-01-28* variable.c (rb_mod_const_of, sv_i): Module#constant should excludemame
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
2011-01-28* variable.c (rb_const_set): const_set shoud preserve constantmame
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
2011-01-28* constant.h, variable.c: to ensure compatibility, rb_const_get_* mustmame
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
2011-01-28* variable.c (set_const_visibility): fix typo. a patch from Tomoyukimame
Chikanaga in [ruby-core:32919]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-11* variable.c: parenthesize macro arguments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-26* object.c (Init_Object), constant.h, variable.cmame
(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
2010-10-26* class.c, constant.h, gc.c, method.h, object.c, variable.c,mame
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