summaryrefslogtreecommitdiff
path: root/variable.c
AgeCommit message (Collapse)Author
2013-05-25no clearing method cachenobu
* variable.c (set_const_visibility): return without clearing method cache if no arguments. * vm_method.c (set_method_visibility): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-25eval.c: rb_frame_callee returns current namenobu
* eval.c (rb_frame_callee): returns the called name of the current frame, not the previous frame. * eval.c (prev_frame_callee, prev_frame_func): rename and make static, as these are used by rb_f_method_name() and rb_f_callee_name() only. * variable.c (set_const_visibility): use the called name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-24* variable.c (set_const_visibility): use rb_frame_this_func() insteadcharliesome
of rb_frame_callee() for getting the name of the called method * test/ruby/test_module.rb: add test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* gc.c: support RGENGC. [ruby-trunk - Feature #8339]ko1
See this ticet about RGENGC. * gc.c: Add several flags: * RGENGC_DEBUG: if >0, then prints debug information. * RGENGC_CHECK_MODE: if >0, add assertions. * RGENGC_PROFILE: if >0, add profiling features. check GC.stat and GC::Profiler. * include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0). * array.c: add write barriers for T_ARRAY and generate sunny objects. * include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if you want to access raw pointers. If you modify the contents which pointer pointed, then you need to care write barrier. * bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects. * complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX and generate sunny objects. * rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write barriers for T_RATIONAL and generate sunny objects. * internal.h: add write barriers for RBasic::klass. * numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects. * object.c (rb_class_allocate_instance), range.c: generate sunny T_OBJECT objects. * string.c: add write barriers for T_STRING and generate sunny objects. * variable.c: add write barriers for ivars. * vm_insnhelper.c (vm_setivar): ditto. * include/ruby/ruby.h, debug.c: use two flags FL_WB_PROTECTED and FL_OLDGEN. * node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED): move flag bits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-02variable.c: move warnings to rb_ivar_getnobu
* variable.c (generic_ivar_get, ivar_get): return undef value instead of Qnil with warnings, for uninitialized instance variable. * variable.c (rb_ivar_get): warn for uninitialized instance variable here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-02id.def: predefined IDsnobu
* defs/id.def: add more predefined IDs used in core. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-27* variable.c (rb_mod_remove_const): fix segv caused by r38558.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22internal.h: quote unprintablenobu
* internal.h (QUOTE, QUOTE_ID): quote unprintable chars in strings and IDs. [Bug #7574] [ruby-dev:46749] * string.c (rb_str_quote_unprintable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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