Граф коммитов

399 Коммитов

Автор SHA1 Сообщение Дата
normal c7ff36c6f0 variable.c: cleanup waitq upon thread death
* variable.c (autoload_reset): use idempotent list_del_init
  (autoload_sleep): moved code from rb_autoload_load
  (autoload_sleep_done): cleanup for use with rb_ensure
  (rb_autoload_load): ensure list delete happens in case the
  thread dies during sleep
* test/ruby/bug-13526.rb: new script for separate execution
* test/ruby/test_autoload.rb (test_bug_13526): new test
  [ruby-core:81016] [Bug #13526]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 04:26:37 +00:00
ko1 10b800133e add several counters to analyze ivar inline caches.
* debug_counter.h: add (and renamed) several counters:
  ivar_get_ic_hit
  ivar_get_ic_miss
  ivar_get_ic_miss_serial
  ivar_get_ic_miss_unset
  ivar_get_ic_miss_noobject
  ivar_set_ic_hit
  ivar_set_ic_miss
  ivar_set_ic_miss_serial
  ivar_set_ic_miss_unset
  ivar_set_ic_miss_oorange
  ivar_set_ic_miss_noobject
  ivar_get_base
  ivar_set_base

  See related source code to know what counters mean.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-15 08:25:58 +00:00
ko1 76c4cca19c add performance counting mechanism for MRI debug/tuning purpose.
* How to enable this feature?
  * define USE_DEBUG_COUNTER as 1.
  * you can disable to output the result with
    RUBY_DEBUG_COUNTER_DISABLE environment variable
    even if USE_DEBUG_COUNTER == 1.

* How to add new counter?
  * add COUNTER(<name>) line on debug_counter.h.
  * include "debug_counter.h"
  * insert RB_DEBUG_COUNTER_INC(<name>) line on your favorite place.

* counter output example:
  [RUBY_DEBUG_COUNTER]    mc_inline_hit   999
  [RUBY_DEBUG_COUNTER]    mc_inline_miss  3
  [RUBY_DEBUG_COUNTER]    mc_global_hit   23
  [RUBY_DEBUG_COUNTER]    mc_global_miss  273
  [RUBY_DEBUG_COUNTER]    mc_global_state_miss    3
  [RUBY_DEBUG_COUNTER]    mc_class_serial_miss    0
  [RUBY_DEBUG_COUNTER]    mc_cme_complement       0
  [RUBY_DEBUG_COUNTER]    mc_cme_complement_hit   0
  [RUBY_DEBUG_COUNTER]    mc_search_super 1384
  [RUBY_DEBUG_COUNTER]    ivar_get_hit    0
  [RUBY_DEBUG_COUNTER]    ivar_get_miss   0
  [RUBY_DEBUG_COUNTER]    ivar_set_hit    0
  [RUBY_DEBUG_COUNTER]    ivar_set_miss   0
  [RUBY_DEBUG_COUNTER]    ivar_get        431
  [RUBY_DEBUG_COUNTER]    ivar_set        465

  * mc_... is related to method caching.
  * ivar_... is related to instance variable accesses.

* compare with dtrace/system tap features, there are completely
  no performacne penalties when it is disabled.

* This feature is supported only on __GNUC__ compilers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 08:18:15 +00:00
nobu cd0426c00b variable.c: remove deprecated internal feature
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 06:16:49 +00:00
nobu a9c1522969 variable.c: noreturn in GCC
* variable.c (rb_generic_ivar_table): declare as noreturn only in
  GCC, which does not err on different attributes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 01:28:30 +00:00
ko1 56c38a648b remove harmful declaration.
* variable.c (gen_ivtbl_get): declaration conflict on VC++.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-20 19:12:52 +00:00
naruse 11eba07b83 Supress warning: function might be candidate for attribute 'noreturn'
GCC7 shows it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-20 10:59:10 +00:00
nobu 6877de73de DEPRECATED_INTERNAL_FEATURE
* error.c (ruby_deprecated_internal_feature): renamed, to
  explicitly represent deprecation.

* internal.h (DEPRECATED_INTERNAL_FEATURE): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-17 05:45:44 +00:00
nobu 14d61a94ff variable.c: fatal rb_generic_ivar_table
* variable.c (rb_generic_ivar_table): raise fatal error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-16 14:48:12 +00:00
nobu 1df80905a3 variable.c: fix the condition to cache
* variable.c (rb_const_set): fix the condition to cache the class
  path and cache permanent or temporary path corresponding to the
  outer klass.  [ruby-core:79039] [Bug #13120]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-11 04:12:56 +00:00
nobu faf472a2bb variable.c: resolve permanent name only
* variable.c (rb_const_set): resolve and cache class name
  immediately only if the outer class/module has the name,
  otherwise just set the ID.  [ruby-core:79007] [Bug #13113]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-08 01:59:54 +00:00
nobu 44a2576f79 variable.c: top-level constant look-up
* variable.c (rb_const_search): [EXPERIMENTAL] remove top-level
  constant look-up.  [Feature #11547]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-01 09:07:56 +00:00
tenderlove e04167bc32 Stop reading past the end of `ivptr` array
If you have code like this:

```ruby
class A
  def initialize
    @a = nil
    @b = nil
    @c = nil
    @d = nil
    @e = nil
  end
end

x = A.new
y = x.clone
100.times { |z| x.instance_variable_set(:"@foo#{z}", nil) }
puts y.inspect
```

`x` and `y` will share `iv_index_tbl` hashes.  However, the size of the
hash will grow larger than the number if entries in `ivptr` in `y`.
Before this commit, `rb_ivar_count` would use the size of the hash to
determine how far to read in to the array, but this means that it could
read past the end of the array and cause the program to segv

[ruby-core:78403]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29 17:06:35 +00:00
nobu e6a260ecdb variable.c: rb_deprecate_constant
* variable.c (rb_deprecate_constant): new function to deprecate a
  constant by the name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09 03:02:22 +00:00
nobu 6054e6d65e variable.c: fix deprecated constant message
* variable.c (rb_const_search): warn with the actual class/module
  name which defines the deprecated constant.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09 01:10:01 +00:00
nobu a3cc3cc5c9 variable.c: fix private constant message
* variable.c (rb_const_search): raise with the actual class/module
  name which defines the private constant.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09 01:07:41 +00:00
nobu 6ea002a7a2 variable.c: exclude private constants
* variable.c (rb_local_constants_i): exclude private constants
  when excluding inherited constants too.  [Bug #12345]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-19 06:39:01 +00:00
nobu 0ce3fab422 variable.c: consider length
* variable.c (rb_path_to_class): consider the string length
  instead of a terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 02:19:45 +00:00
nobu 5707ba30aa variable.c: rb_const_search
* variable.c (rb_path_to_class): search the constant at once
  instead of checking if defined and then getting it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 01:54:42 +00:00
nobu 55a39399ff variable.c: check length
* variable.c (check_autoload_required): check length first before
  checking the first byte.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 05:18:16 +00:00
nobu c57c719e4a variable.c: hidden constants
* variable.c (rb_local_constants_i): exclude hidden constants.
  [ruby-core:75575] [Bug #12389]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-27 08:38:50 +00:00
nobu 5cb5692ac8 vm_insnhelper.c: deprecated constant in class
* vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even
  in the class context.  [ruby-core:75505] [Bug #12382]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-15 01:57:28 +00:00
nobu bc65dbcdeb variable.c: fix implicit conversion
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22 10:04:47 +00:00
naruse 3738fe3333 * variable.c: use uint32_t instead of long to avoid confusion about
the type of ivtbl->numiv.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22 09:47:34 +00:00
hsbt b33841b32a * variable.c: Added documentation about order of `Module#constants`
[ci skip][Bug #12121][ruby-dev:49505][fix GH-1301]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-23 01:39:41 +00:00
nobu 92e803c9c8 variable.c: matched backrefs only
* variable.c (rb_f_global_variables): add matched back references
  only, as well as defiend? operator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-14 08:36:49 +00:00
nobu 7e825eeefc variable.c: $1..$9 in global_variables
* variable.c (rb_f_global_variables): add $1..$9 only if $~ is
  set.  fix the condition removed at r14014.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-14 02:45:03 +00:00
normal 244916d43b resolve class name earlier and more consistently
This further avoids class name resolution issues which came
about due to relying on hash table ordering before r53376.

Pre-caching the class name when it is never used raises memory
use, but the overall gain from moving away from st still gives
us a small gain.  Reverting r53376 and this patch and testing with
"valgrind -v ./ruby -rrdoc -eexit" on x86 (32-bit) shows:

before:
    in use at exit: 1,662,239 bytes in 25,286 blocks
  total heap usage: 49,514 allocs, 24,228 frees, 6,005,561 bytes allocated

after, with this change:
    in use at exit: 1,646,529 bytes in 24,572 blocks
  total heap usage: 48,891 allocs, 24,319 frees, 6,003,921 bytes allocated

* class.c (Init_class_hierarchy): resolve name for rb_cObject ASAP
* object.c (rb_mod_const_set): move name resolution to rb_const_set
* variable.c (rb_const_set): do class resolution here
  [ruby-core:72807] [Bug #11977]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-12 19:26:07 +00:00
sho-h d5f4a2ba12 variable.c (rb_mod_deprecate_constant): [DOC] added
documentation for Module#deprecate_constant. [ci skip]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-04 07:08:05 +00:00
normal 1142de8e2a use id_table for constant tables
valgrind 3.9.0 on x86-64 reports a minor reduction in memory usage
when loading only RubyGems and RDoc by running: ruby -rrdoc -eexit

before: HEAP SUMMARY:
    in use at exit: 2,913,448 bytes in 27,394 blocks
  total heap usage: 48,362 allocs, 20,968 frees, 9,034,621 bytes alloc

after: HEAP SUMMARY:
    in use at exit: 2,880,056 bytes in 26,712 blocks
  total heap usage: 47,791 allocs, 21,079 frees, 9,046,507 bytes alloc

* class.c (struct clone_const_arg): adjust for id_table
  (clone_const): ditto
  (clone_const_i): ditto
  (rb_mod_init_copy): ditto
  (rb_singleton_class_clone_and_attach): ditto
  (rb_include_class_new): ditto
  (include_modules_at): ditto
* constant.h (rb_free_const_table): ditto
* gc.c (free_const_entry_i): ditto
  (rb_free_const_table): ditto
  (obj_memsize_of): ditto
  (mark_const_entry_i): ditto
  (mark_const_tbl): ditto
* internal.h (struct rb_classext_struct): ditto
* object.c (rb_mod_const_set): resolve class name on assignment
* variable.c (const_update): replace with const_tbl_update
  (const_tbl_update): new function
  (fc_i): adjust for id_table
  (find_class_path): ditto
  (autoload_const_set): st_update => const_tbl_update
  (rb_const_remove): adjust for id_table
  (sv_i): ditto
  (rb_local_constants_i): ditto
  (rb_local_constants): ditto
  (rb_mod_const_at): ditto
  (rb_mod_const_set): ditto
  (rb_const_lookup): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 20:19:14 +00:00
ngoto 3bf3f825c3 * variable.c (struct ivar_update): rename "extended" to "iv_extended"
to avoid name conflict with /usr/include/floatingpoint.h on
  Solaris. [Bug #11853] [ruby-dev:49448]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-21 12:35:29 +00:00
nobu bb4d72c51f make local symbols static
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 15:07:41 +00:00
normal a2e025a7d0 introduce rb_autoload_str to replace rb_autoload
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
2015-12-06 12:28:09 +00:00
normal 9f9861699b variable.c: remove spurious #define for globals
Removing the indirection helps me with readability, at
least.  It doesn't seem like there are many other places
in the Ruby code where macros are used like this.

[ruby-core:71735] [Feature #11749]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-29 23:53:43 +00:00
normal 64c08dafe2 variable.c (rb_autoload_load): allow recursive calls
* variable.c (rb_autoload_load): allow recursive calls
  [ruby-core:71345] [Bug #11658]
* test/ruby/test_autoload.rb (test_autoload_while_autoloading):
  new test by: Hiroshi Shirosaki <h.shirosaki@gmail.com>
  [ruby-core:71390]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-09 21:18:42 +00:00
nobu c8803b10d1 variable.c: suppress a warning
* variable.c (autoload_reset): initialize formally to suppress a
  warning from container_off_var() by Visual C.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-04 06:59:15 +00:00
normal ca86c3abb8 variable.c: remove casts for rb_class_ivar_set callers
Casting any arguments of rb_class_ivar_set to st_data_t is wrong
as the function does not take any st_data_t parameters anymore.
There's no functional change, as ID, VALUE, and st_data_t are
all the same type, but this reduces confusion and improves
maintainability for future type changes.

* variable.c (find_class_path): remove cast for rb_class_ivar_set
  (rb_ivar_set): ditto
  (rb_cvar_set): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-02 21:50:24 +00:00
normal 5aef9e1d78 variable.c (rb_global_tbl): convert to id_table
Mainly this is to reduce casting a tiny amount; and
probably nothing depends on the order of globals.
Likely no measurable memory usage improvement as globals
are not common, but maybe some weird code out there benefits.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-02 21:26:26 +00:00
nobu 1546ffed49 use rb_source_loc and rb_source_location
* error.c, eval.c, eval_error.c, gc.c, variable.c, vm.c,
  vm_eval.c, vm_trace.c: use rb_source_loc/rb_source_location
  instead of combination of rb_sourcefile/rb_sourcefilename and
  rb_sourceline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-31 01:02:26 +00:00
nobu 6f77d0a3aa variable.c: rb_class_ivar_set
* variable.c (rb_class_ivar_set): rename as class specific ivar
  setter, and st_table is no longer involved.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-30 03:07:06 +00:00
normal 0a9f20ae02 variable.c (generic_ivar_remove): return original value
This fixes a bug introduced in r50678
("variable.c: use indices for generic ivars")
and does not affect any released version of Ruby

* variable.c (generic_ivar_remove): adjust type, set valp
  (rb_obj_remove_instance_variable): simplify call
* test/ruby/test_object.rb (test_remove_instance_variable):
  expand for implementation details

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-30 02:37:59 +00:00
normal a666e9b5f2 variable.c (rb_st_insert_id_and_value): reduce args
Minor simplification; this will hopefully make future patches
for switching to id_table easier-to-review.

* internal.h (rb_st_insert_id_and_value): update prototype
* variable.c (rb_st_insert_id_and_value): reduce args
  (find_class_path): adjust call for less args
  (rb_ivar_set): ditto
  (rb_cvar_set): ditto
* class.c (rb_singleton_class_attached): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-30 01:40:28 +00:00
normal fc87b3b7e0 variable.c: reduce heap usage for autoload_data_i
For the loader (first thread which hits autoload, it is wasteful
to have extra elements on the stack.  For the lifetime of the
process, it is wasteful to waste 2 words for every autoload
entry.  So this makes full use of existing stack overhead
while reducing heap overhead for long-lived autoload_data_i
structs.

* variable.c (struct autoload_state): usable as wait-queue head
  (struct autoload_data_i): remove 2 words of overhead
  (autoload_i_mark): remove marking for thread
  (autoload_reset): adjust for struct changes
  (rb_autoload): ditto
  (rb_autoloading_value): ditto
  (rb_autoload_load): ditto
  (const_update): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29 01:14:45 +00:00
normal cdc251c695 variable.c: additional locking around autoload
[ruby-core:70075] [ruby-core:71239] [Bug #11384]

Note: this open-coding locking method may go into
rb_mutex/rb_thread_shield types.  It is smaller and simpler and
based on the wait queue implementation of the Linux kernel.

When/if we get rid of GVL, native mutexes may be used as-is.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-28 23:59:45 +00:00
nobu a4f838c742 error.c: receiver in NameError
* error.c (rb_name_err_new): store the receiver directly.
* error.c (name_err_receiver): return directly stored receiver.
  [Feature #10881]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-28 06:36:13 +00:00
nobu 72ff61f4a8 NameError#receiver of uninitialized constant
* error.c (name_err_mesg_to_str): quote the name if unprintable.
* object.c (check_setter_id): use rb_check_id to convert names.
* variable.c (uninitialized_constant): use NameError::message to
  keep the receiver of uninitialized constant.  [Feature #10881]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-28 06:24:12 +00:00
nobu dfa9eb54bd variable.c: fail if frozen
* variable.c (set_const_visibility): fail if the class/module is
  frozen.  [ruby-core:70828] [Bug #11532]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-16 11:39:29 +00:00
normal 1e6a643fa9 variable.c: wrap long lines
Make code easier to read and hunt for bugs with my tiny terminal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-04 03:13:19 +00:00
nobu 83cd51e3fe variable.c: Module#deprecate_constant
* variable.c (rb_const_get_0): warn deprecated constant reference.
* variable.c (rb_mod_deprecate_constant): mark constants to be
  warned as deprecated.  [Feature #11398]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-30 04:20:00 +00:00
normal 1782dd8cd7 variable.c: remove FL_ABLE check for generic ivars
Missed this in r50758.

* variable.c (generic_ivar_set): remove FL_ABLE check
  (gen_ivar_copy): ditto
  [ruby-core:69715]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-24 00:24:32 +00:00