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

584 Коммитов

Автор SHA1 Сообщение Дата
nobu 944c620dfa object.c: undef Module#prepend_features on Class
* object.c (Init_Object): undef Module#prepend_features on Class, as
  well as Module#append_features.  [Fixes GH-376]
* test_class.rb: Added test for above. And ensure type checking
  on similar methods as module_function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-13 12:52:25 +00:00
nobu a25d02b144 object.c: Module#singleton_class?
* object.c (rb_mod_singleton_p): new method Module#singleton_class? to
  return whether the receiver is a singleton class or not.
  [ruby-core:51087] [Feature #7609]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08 14:01:23 +00:00
charliesome 5e98991f1b * object.c (rb_class_inherited_p): allow iclasses to be tested for
inheritance. [Bug #8686] [ruby-core:56174]

* test/ruby/test_method.rb: add test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-05 01:02:22 +00:00
eregon 59d1fc3615 * object.c (rb_obj_cmp): Improve doc for Kernel#<=>
to clarify #equal? is not called. [See GH-352]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-09 13:25:57 +00:00
hsbt 331f22cd30 Module extended doc by @PragTob [fixes GH-335]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-09 12:03:07 +00:00
knu b0bc85f933 * object.c: Fix rdoc for Kernel#<=>. [Fix GH-352]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-09 07:02:06 +00:00
charliesome 3d8deb6e1b * object.c (rb_obj_equal): Fixed an rb_obj_equal documentation typo
where "a" was used instead of "obj".
  Fixes GH-349. Patch by @adnandoric

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-04 13:31:11 +00:00
ko1 87a120fbdc * class.c, include/ruby/ruby.h: add write barriers for T_CLASS,
T_MODULE, T_ICLASS.
* constant.h: constify rb_const_entry_t::value and file to detect
  assignment.
* variable.c, internal.h (rb_st_insert_id_and_value, rb_st_copy):
  added. update table with write barrier.
* method.h: constify some variables to detect assignment.
* object.c (init_copy): add WBs.
* variable.c: ditto.
* vm_method.c (rb_add_method): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-14 09:23:54 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
ayumin aff64b9478 * object.c (rb_Hash): fix docs. patched by Stefan Schüßler.
[ruby-core:55299] [Bug #8487]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-04 14:47:33 +00:00
zzak acae96deb7 * object.c, proc.c: s/call_seq/call-seq in rdoc. [Fix GH-322]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-31 07:04:33 +00:00
ko1 b8b26d05ce * object.c (rb_obj_clone): should not propagate OLDGEN status.
This propagation had caused WB miss for class.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-23 18:01:46 +00:00
eregon 30f813ddf2 * object.c (rb_inspect): fix typo and error message
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 21:23:15 +00:00
ko1 4f401816ff * gc.c: support RGENGC. [ruby-trunk - Feature #8339]
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-13 18:07:47 +00:00
ko1 83aba04862 * include/ruby/ruby.h: constify RBasic::klass and add
RBASIC_CLASS(obj) macro which returns a class of `obj'.
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
  This function reveal interal (hidden) object by rb_obj_hide().
  Note that do not change class before and after hiding.
  Only permitted example is:
  klass = RBASIC_CLASS(obj);
  rb_obj_hide(obj);
  ....
  rb_obj_reveal(obj, klass);
  TODO: API design. rb_obj_reveal() should be replaced with others.
  TODO: modify constified variables using cast may be harmful for
  compiler's analysis and optimizaton.
  Any idea to prohibt inserting RBasic::klass directly?
  If rename RBasic::klass and force to use RBASIC_CLASS(obj),
  then all codes such as `RBASIC(obj)->klass' will be
  compilation error. Is it acceptable? (We have similar
  experience at Ruby 1.9,
  for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
  object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
  without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
  file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
  parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
  string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
  Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
  ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 10:49:11 +00:00
ko1 b6b85f6eaf * object.c (rb_obj_setup): added.
* include/ruby/ruby.h (OBJSETUP): ues rb_obj_setup() instead of
  a macro.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 06:33:48 +00:00
nobu a58c224dcf object.c: skip prepending modules
* object.c (rb_obj_is_kind_of): skip prepending modules.
  [ruby-core:54742] [Bug #8357]
* object.c (rb_class_inherited_p): ditto.
  [ruby-core:54736] [Bug #8357]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-02 14:23:56 +00:00
nobu 97982e823f id.def: predefined IDs
* 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
2013-05-02 07:54:17 +00:00
zzak 9ef25d883d * object.c: With feedback from Steve Klabnik, reverted a change to
#untrusted? and #tainted?. Also adjusted grammar for $SAFE levels


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-28 01:35:56 +00:00
zzak 6fe3e9e488 * object.c: Documentation for taint and trust [Bug #8162]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-28 00:51:46 +00:00
nobu f507cce021 object.c: extract common code
* object.c (id_for_setter): extract common code from const, class
  variable, instance variable setters.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-08 14:57:29 +00:00
naruse ae13ab2466 * object.c (rb_obj_ivar_set): call to_str for string only once.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-08 03:05:15 +00:00
naruse 6cb682a480 * object.c (rb_mod_const_set): call to_str for string only once.
to_str was called from rb_is_const_name and rb_to_id before.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-07 12:28:21 +00:00
naruse d9ff5c2230 * object.c (rb_mod_cvar_set): call to_str for string only once.
to_str was called from rb_is_class_name and rb_to_id before.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-07 12:18:26 +00:00
nobu 672b8bf1c0 object.c: avoid inadvertent symbol creation
* object.c (rb_mod_cvar_set): fix typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 21:36:38 +00:00
akr a4587840cc * object.c (rb_mod_cvar_set): Reverted "avoid inadvertent
symbol creation" to avoid SEGV by
  Class.new.class_variable_set(1, 2).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 13:26:39 +00:00
nobu 5e2c39ed22 object.c: avoid inadvertent symbol creation
* object.c (rb_mod_const_set): fix symbol name check.
  (rb_obj_ivar_set): ditto.
  (rb_mod_cvar_set): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 08:18:54 +00:00
nobu 4e59c822a0 object.c: avoid inadvertent symbol creation
* object.c (rb_mod_const_set): avoid inadvertent symbol creation.
  (rb_obj_ivar_set): ditto.
  (rb_mod_cvar_set): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 07:54:44 +00:00
nobu adf1c94ffe bignum.c: hide intermediate Bignums
* bignum.c (rb_big_eq): hide intermediate Bignums not just freeing
  memory.  [ruby-core:53893] [Bug #8204]
* object.c (rb_obj_hide): hide an object by clearing klass.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-03 07:35:35 +00:00
shugo c851bd00a3 * object.c (Init_Object): remove Module#used, which has been
introduced in Ruby 2.0 by mistake.  [Bug #7916] [ruby-core:52719]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-13 02:43:09 +00:00
zzak bd88e6c0b5 * object.c: Document methods receiving string and convert to symbol
Patch by Stefan Rusterholz
* vm_eval.c: ditto
* vm_method.c: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-24 04:24:52 +00:00
zzak c2204ca328 * array.c: Document #<=> return values and formatting
* bignum.c: ditto
* file.c: ditto
* object.c: ditto
* numeric.c: ditto
* rational.c: ditto
* string.c: ditto
* time.c: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23 03:35:38 +00:00
zzak c135883d37 * object.c (rb_obj_comp): Documenting Object#<=> return values
Patch by Stefan Rusterholz


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23 02:11:53 +00:00
marcandre eff6180e53 * object.c: Add doc for Module.prepended
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-22 23:18:33 +00:00
zzak c7bb797410 * object.c: Document Data class [Bug #7890] [ruby-core:52549]
Patch by Matthew Mongeau


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-20 03:19:01 +00:00
zzak 281e6e1b3b * object.c: rdoc formatting for Kernel#Array()
* array.c: Add rdoc for Array() method to Creating Arrays section


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-19 03:32:11 +00:00
marcandre c34e9f23aa * object.c: Improve error for failed implicit conversions [Bug #7539]
* error.c: Adapt rdoc

* test/ruby/test_object.rb: Test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29 22:00:58 +00:00
marcandre bca544340b * object.c: Fix rdoc typo, patch by Narsimham Chelluri [#7753].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29 18:58:37 +00:00
eregon 3a50fb15d0 * object.c: Typo in Kernel#hash documentation.
Patch by zed_0xff [Github Fixes #237]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-17 11:28:52 +00:00
nobu d2a176028f object.c: CLASS_OR_MODULE_P
* object.c (rb_mod_to_s, rb_class_inherited_p, rb_mod_ge, rb_mod_cmp):
  use BUILTIN_TYPE() instead of TYPE() for optimization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-15 14:07:24 +00:00
nobu e4ebf6d946 object.c: two literals
* object.c (rb_mod_to_s): concatenate two literals.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-15 14:07:22 +00:00
nobu ad6f06aed8 object.c: singleton class clone
* object.c (rb_obj_clone): attach clone to its singleton class during
  cloning singleton class so that singleton_method_added will be called
  on it.  based on the patch by shiba (satoshi shiba)[Bug #5283] in
  [ruby-dev:44477].  [Bug #5283]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 02:37:47 +00:00
nobu 6f02547d83 internal.h: quote unprintable
* 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-22 15:04:57 +00:00
nobu f3b132faac object.c: no nested symbol
* object.c (rb_mod_const_get): symbol cannot be nested constant name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22 11:31:13 +00:00
nobu 7815cbd7d0 object.c: defer creating string
* object.c (rb_mod_const_get): defer creating partinal name string
  until needed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22 10:40:03 +00:00
nobu af1ca4cb13 object.c: check more strictly
* object.c (rb_mod_const_get): check more strictly.  [ruby-dev:46748]
  [Bug #7573]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22 10:26:40 +00:00
usa e31b67700b * object.c (rb_obj_hash): shouldn't assume object_id can be long.
based on a patch by Heesob Park at [ruby-core:51060].
  cf. [Backport #7454]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21 15:30:44 +00:00
nobu c3026b723c object.c: nul in const name
* object.c (rb_mod_const_get): nul byte is invalid as constant name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-19 10:34:13 +00:00
nobu 3738ebe15a * object.c (Init_Object): no needs to override with same method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-13 14:32:40 +00:00
charliesome c01f06089f * object.c (Init_Object): use rb_mod_init_copy for Class#initialize_copy
* class.c (rb_class_init_copy): rename to class_init_copy_check, performs type
	  checks on arguments to prevent reinitialization of initialized class
	  [ruby-core:50869] [Bug #7557]
	* class.c (rb_mod_init_copy): use class_init_copy_check if receiver is T_CLASS
	* test/ruby/test_class.rb (class TestClass): related test


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-13 14:11:01 +00:00
shugo 60d6038dda * revised r37993 to avoid SEGV/ILL in tests. In r37993, a method
entry with VM_METHOD_TYPE_REFINED holds only the original method
  definition, so ci->me is set to a method entry allocated in the
  stack, and it causes SEGV/ILL.  In this commit, a method entry
  with VM_METHOD_TYPE_REFINED holds the whole original method entry.
  Furthermore, rb_thread_mark() is changed to mark cfp->klass to
  avoid GC for iclasses created by copy_refinement_iclass().

* vm_method.c (rb_method_entry_make): add a method entry with
  VM_METHOD_TYPE_REFINED to the class refined by the refinement if
  the target module is a refinement.  When a method entry with
  VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with
  the same name is searched in refinements.  If such a method is
  found, the method is invoked.  Otherwise, the original method in
  the refined class (rb_method_definition_t::body.orig_me) is
  invoked.  This change is made to simplify the normal method lookup
  and to improve the performance of normal method calls.

* vm_method.c (EXPR1, search_method, rb_method_entry),
  vm_eval.c (rb_call0, rb_search_method_entry): do not use
  refinements for method lookup.

* vm_insnhelper.c (vm_call_method): search methods in refinements if
  ci->me is VM_METHOD_TYPE_REFINED.  If the method is called by
  super (i.e., ci->call == vm_call_super_method), skip the same
  method entry as the current method to avoid infinite call of the
  same method.

* class.c (include_modules_at): add a refined method entry for each
  method defined in a module included in a refinement.

* class.c (rb_prepend_module): set an empty table to
  RCLASS_M_TBL(klass) to add refined method entries, because
  refinements should have priority over prepended modules.

* proc.c (mnew): use rb_method_entry_with_refinements() to get
  a refined method.

* vm.c (rb_thread_mark): mark cfp->klass for iclasses created by
  copy_refinement_iclass().

* vm.c (Init_VM), cont.c (fiber_init): initialize th->cfp->klass.

* test/ruby/test_refinement.rb (test_inline_method_cache): do not skip
  the test because it should pass successfully.

* test/ruby/test_refinement.rb (test_redefine_refined_method): new
  test for the case a refined method is redefined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-06 13:08:41 +00:00
nobu d4736bcf4d object.c: test bits at once
* object.c (rb_obj_clone): test TAINT and UNTRUSTED bits at once.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-03 10:21:46 +00:00
nobu 82ec3de020 object.c: make remove_instance_variable public
* object.c (Init_Object): make remove_instance_variable public.
  [Feature #6539]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 09:16:57 +00:00
shugo 9e44974874 * revert r37993 to avoid SEGV in tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 02:11:59 +00:00
shugo 421314cf4e * vm_method.c (rb_method_entry_make): add a method entry with
VM_METHOD_TYPE_REFINED to the class refined by the refinement if
  the target module is a refinement.  When a method entry with
  VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with
  the same name is searched in refinements.  If such a method is
  found, the method is invoked.  Otherwise, the original method in
  the refined class (rb_method_definition_t::body.orig_def) is
  invoked.  This change is made to simplify the normal method lookup
  and to improve the performance of normal method calls.

* vm_method.c (EXPR1, search_method, rb_method_entry),
  vm_eval.c (rb_call0, rb_search_method_entry): do not use
  refinements for method lookup.

* vm_insnhelper.c (vm_call_method): search methods in refinements if
  ci->me is VM_METHOD_TYPE_REFINED.  If the method is called by
  super (i.e., ci->call == vm_call_super_method), skip the same
  method entry as the current method to avoid infinite call of the
  same method.

* class.c (include_modules_at): add a refined method entry for each
  method defined in a module included in a refinement.

* class.c (rb_prepend_module): set an empty table to
  RCLASS_M_TBL(klass) to add refined method entries, because
  refinements should have priority over prepended modules.

* proc.c (mnew): use rb_method_entry_with_refinements() to get
  a refined method.

* test/ruby/test_refinement.rb (test_inline_method_cache): do not skip
  the test because it should pass successfully.

* test/ruby/test_refinement.rb (test_redefine_refined_method): new
  test for the case a refined method is redefined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 12:50:10 +00:00
nobu 7bd638b7a4 object.c: suppress warning
* object.c (rb_obj_alloc): suppress unused variable warning.

* tool/gen_dummy_probes.rb: define dtrace disabling macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-16 17:02:39 +00:00
nobu b29b2962d2 adjust indent
* object.c (rb_obj_alloc): adjust indent.

* vm.c (vm_collect_usage_{insn,operand,register}): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-16 17:02:35 +00:00
tenderlove 4c740bae97 * probes.d: add DTrace probe declarations. [ruby-core:27448]
* array.c (empty_ary_alloc, ary_new): added array create DTrace probe.

* compile.c (rb_insns_name): allowing DTrace probes to access
  instruction sequence name.

* Makefile.in: translate probes.d file to appropriate header file.

* common.mk: declare dependencies on the DTrace header.

* configure.in: add a test for existence of DTrace.

* eval.c (setup_exception): add a probe for when an exception is
  raised.

* gc.c: Add DTrace probes for mark begin and end, and sweep begin and
  end.

* hash.c (empty_hash_alloc): Add a probe for hash allocation.

* insns.def: Add probes for function entry and return.

* internal.h: function declaration for compile.c change.

* load.c (rb_f_load): add probes for `load` entry and exit, require
  entry and exit, and wrapping search_required for load path search.

* object.c (rb_obj_alloc): added a probe for general object creation.

* parse.y (yycompile0): added a probe around parse and compile phase.

* string.c (empty_str_alloc, str_new): DTrace probes for string
  allocation.

* test/dtrace/*: tests for DTrace probes.

* vm.c (vm_invoke_proc): add probes for function return on exception
  raise, hash create, and instruction sequence execution.

* vm_core.h: add probe declarations for function entry and exit.

* vm_dump.c: add probes header file.

* vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on
  function entry and return.

* vm_exec.c: expose instruction number to instruction name function.

* vm_insnshelper.c: add function entry and exit probes for cfunc
  methods.

* vm_insnhelper.h: vm usage information is always collected, so
  uncomment the functions.

12 19:14:50 2012  Akinori MUSHA  <knu@iDaemons.org>

* configure.in (isinf, isnan): isinf() and isnan() are macros on
  DragonFly which cannot be found by AC_REPLACE_FUNCS().  This
  workaround enforces the fact that they exist on DragonFly.

12 15:59:38 2012  Shugo Maeda  <shugo@ruby-lang.org>

* vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo),
  vm_insnhelper.c (vm_search_method): revert r37616 because it's too
  slow.  [ruby-dev:46477]

* test/ruby/test_refinement.rb (test_inline_method_cache): skip
  the test until the bug is fixed efficiently.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-12 21:52:12 +00:00
nobu bd9b31e557 object.c: inadvertent symbol
* object.c (rb_mod_const_get): avoid inadvertent symbol creation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-07 00:16:03 +00:00
tenderlove ac7f5157ac * object.c (rb_mod_const_get): Fix constant missing exception class
and message to maintain backwards compatibility. Constant search
  should start at Object when constant starts with '::'

* test/ruby/test_module.rb: test for fixes

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 11:42:24 +00:00
shugo b14e2b4401 * object.c (rb_mod_to_s): Module#{to_s,inspect}, when invoked on
a refinement, returns a string in the format #<refinement:C@M>,
  where C is a refined class and M is a module at which the refinemet
  is defined.

* eval.c (rb_mod_refine): store information on a refinement for the
  above change.

* test/ruby/test_refinement.rb: related test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-02 08:53:06 +00:00
tenderlove 909bc583a4 * object.c (rb_mod_const_get): make sure the constant name is
converted to a string before searching. [ruby-core:48405]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-27 01:51:58 +00:00
tenderlove 82af182e74 * object.c (rb_mod_const_get): const_get accepts qualified constant
strings.  e.g. Object.const_get("Foo::Bar::Baz") [ruby-core:41404]

* test/ruby/test_module.rb: tests for new behavior

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-26 21:31:23 +00:00
nari c3a46d6aca * include/ruby/ruby.h: add C APIs.
VALUE rb_newobj_of(VALUE klass, VALUE flags)
  #define NEWOBJ_OF(obj,type,klass,flags)
  These allow to change a allocation strategy depending on klass
  or flags.

* gc.c: ditto

* array.c: use new C API.
* bignum.c: ditto
* class.c: ditto
* complex.c: ditto
* ext/socket/ancdata.c: ditto
* ext/socket/option.c: ditto
* hash.c: ditto
* io.c: ditto
* marshal.c: ditto
* numeric.c: ditto
* object.c: ditto
* random.c: ditto
* range.c: ditto
* rational.c: ditto
* re.c: ditto
* string.c: ditto
* struct.c: ditto
  [Feature #7177][Feature #7047]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 06:57:51 +00:00
nobu 5fbfc21b67 internal.h: allocator function in rb_classext_t
* internal.h (struct rb_classext_struct): move allocator function into
  rb_classext_t from ordinary method table.  [ruby-dev:46121]
  [Feature #6993]
* object.c (rb_obj_alloc): call allocator function directly.
* vm_method.c (rb_define_alloc_func, rb_undef_alloc_func)
  (rb_get_alloc_func): use allocator function in rb_classext_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-08 09:52:26 +00:00
nobu b421bd0e12 object.c: preserve encodings
* object.c (rb_any_to_s, rb_obj_inspect): preserve encodings of class
  name and instance variable names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-17 14:29:00 +00:00
nobu 9528358120 object.c: forbid uninitialized class
* object.c (rb_class_initialize): forbid inheriting uninitialized
  class.  another class tree not based on BasicObject cannot exist.
  [ruby-core:47148][Bug #6863]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-16 10:15:28 +00:00
eregon fd7dc23d28 Kernel#inspect: improve consistency and do not call #to_s.
* object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s. A class
  can now benefit from the nice default #inspect even if it defines #to_s.
  Also, there is no more unexpected change in #inspect result.
* NEWS: Add note about the change.
* bignum.c, io.c, numeric.c, object.c, proc.c, vm.c (Init_*):
  Adapt internal structures (by aliasing #inspect to #to_s) so they
  don't rely on the removed behavior (#inspect calling overridden #to_s).
* test/ruby/test_object.rb (test_inspect): add tests for Kernel#inspect.
* lib/pp.rb (class PP): do not call #to_s anymore, as #inspect
  no more does (mame).
* test/test_pp.rb (class PPInspectTest): remove related assertion (mame).
  [ruby-core:43238][Feature #6130]
* test/drb/drbtest.rb (DRbCore#teardown, DRbAry#teardown):
  adapt DRb tests with the new change (shirosaki).
  [ruby-core:47182][Bug #6866]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-15 11:50:01 +00:00
naruse 780e7d0951 Revert r36699 and r36700. [Feature #6130]
Revert "Kernel#inspect: improve consistency and do not call #to_s."
Revert "update PP with recent Kernel#inspect change. Patch by Yusuke Endoh."

r36699 cause test-all failure on test/drb/test_drb.rb and
test/drb/test_drbssl.rb. Run test-all before commit.

Moreover its ChangeLog formst is wrong: see CommitterHowto
https://bugs.ruby-lang.org/projects/ruby/wiki/CommitterHowto#ChangeLog

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-15 01:09:10 +00:00
eregon 795c29dcda Kernel#inspect: improve consistency and do not call #to_s.
A class can now benefit from the nice default #inspect even if it
defines #to_s. Also, there is no more unexpected change in #inspect
result. Internal structures have been adapted so they don't rely
on the removed behavior (#inspect calling overridden #to_s).

* object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s.
* test/ruby/test_object.rb (test_inspect): add tests for Kernel#inspect.
* bignum.c, io.c, numeric.c, object.c, proc.c, vm.c (Init_*):
  alias #inspect to #to_s where it was expected.
  [ruby-core:43238][Feature #6130]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-14 10:20:44 +00:00
shugo 19ddfc2483 * eval.c (rb_mod_using): new method Module#using. [experimental]
* eval.c (rb_mod_refine): new method Module#refine. [experimental]

* eval.c (f_using): new method Kernel#using. [experimental]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02 11:34:19 +00:00
shugo 1f03c90dbf * variable.c (rb_mod_class_variables): return inherited variables
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-07-19 06:41:47 +00:00
drbrain db0126b609 * object.c (Init_Object): Added RDoc location pointers for
Kernel#methods, Kernel#protected_methods, Kernel#private_methods and
  Kernel#public_methods.  [Bug #6666]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-02 21:12:48 +00:00
nobu 8ddbbb3324 Module#prepend
* class.c (rb_prepend_module): prepend module into another module.
* eval.c (rb_mod_prepend): new method Module#prepend.  [Feature #1102]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-27 07:48:50 +00:00
marcandre 17e97a9b10 * object.c: Fix typo in rdoc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-19 13:58:30 +00:00
nobu 2073258a7d obj_init_copy
* object.c (rb_obj_init_copy): should check if trusted too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 11:13:18 +00:00
nobu 5b95238aa7 class_or_module_required
* object.c (class_or_module_required): extract check for class or
  module.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-01 00:31:00 +00:00
drbrain 4f69926f75 * object.c (Init_Object): Restored Kernel documentation based on
Pickaxe book documentation.  Patch by Zachary Scott.
  [ruby-trunk - Feature #6521]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-31 21:41:21 +00:00
drbrain c458f08e90 * object.c (rb_equal): Let Object be a link in #=== documentation.
Patch by Zachary Scott.  [ruby-trunk - Feature #6518]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-31 21:30:18 +00:00
drbrain f6e2081c16 * object.c (Init_Object): Added reference to variable.c where
public_constant and private_constant documentation lives.  [#6381]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-07 20:35:59 +00:00
nobu 770ddcdfe0 * hash.c, object.c, struct.c, lib/ostruct.rb: add to_h methods.
[Feature #6276]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-24 03:46:55 +00:00
naruse 62c9ecfa12 Revert r35339-35343 because of no tests.
* hash.c: Alias ENV.to_h to ENV.to_hash [ref #6276]

* lib/ostruct.rb: Add OpenStruct#to_h [Feature #6276]

* struct.c: Add Struct#to_h [Feature #6276]

* object.c: Add NilClass#to_h [Feature #6276]

* hash.c: Add Hash#to_h [Feature #6276]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-18 03:59:15 +00:00
marcandre 33399fe824 * object.c: Add NilClass#to_h [Feature #6276]
[ref #5008] [rubyspec:dc5ecddbd608]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-16 03:15:56 +00:00
drbrain da39d32f60 * encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "control
reaches end of non-void function" warnings.  [ruby-trunk - Bug #6066]
* re.c (name_to_backref_number):  ditto.
* object.c (rb_Float):  ditto.
* io.c (io_readpartial):  ditto.
* io.c (io_read_nonblock):  ditto.
* pack.c (rb_uv_to_utf8):  ditto.
* proc.c (rb_method_entry_arity):  ditto.
* vm_method.c (rb_f_notimplement):  ditto.
* struct.c (rb_struct_aset_id):  ditto.
* class.c (rb_scan_args):  ditto.
* process.c (rlimit_resource_type):  ditto.
* process.c (rlimit_resource_value):  ditto.
* process.c (p_uid_switch):  ditto.
* process.c (p_gid_switch):  ditto.
* ext/digest/digest.c (rb_digest_instance_update):  ditto.
* ext/digest/digest.c (rb_digest_instance_finish):  ditto.
* ext/digest/digest.c (rb_digest_instance_reset):  ditto.
* ext/digest/digest.c (rb_digest_instance_block_length):  ditto.
* ext/bigdecimal/bigdecimal.c (BigDecimalCmp):  ditto.
* ext/dl/handle.c (rb_dlhandle_close):  ditto.
* ext/tk/tcltklib.c (pending_exception_check0):  ditto.
* ext/tk/tcltklib.c (pending_exception_check1):  ditto.
* ext/tk/tcltklib.c (ip_cancel_eval_core):  ditto.
* ext/tk/tcltklib.c (lib_get_reltype_name):  ditto.
* ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core):  ditto.
* ext/tk/tkutil/tkutil.c (tk_hash_kv):  ditto.
* ext/openssl/ossl_ssl.c (ossl_ssl_session_reused):  ditto.
* ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1):  ditto.
* ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit):  ditto.
* ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve):  ditto.
* ext/fiddle/conversions.c (generic_to_value):  ditto.
* ext/socket/raddrinfo.c (rsock_io_socket_addrinfo):  ditto.
* ext/socket/socket.c (sock_s_getnameinfo):  ditto.
* ext/ripper/eventids2.c (ripper_token2eventid):  ditto.
* cont.c (return_fiber):  ditto.
* dmydln.c (dln_load):  ditto.
* vm_insnhelper.c (vm_search_normal_superclass):  ditto.
* bignum.c (big_fdiv):  ditto.
* marshal.c (r_symlink):  ditto.
* marshal.c (r_symbol):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13 23:45:37 +00:00
nobu 4b3a1f77e1 * hash.c, marshal.c, object.c, variable.c: fix callback argument types
of iterators.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-30 22:40:54 +00:00
drbrain db3bce11dd * object.c: Fix indentation of Class#inherited example.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-16 21:57:24 +00:00
drbrain 6d6b4569fc * object.c (rb_obj_eql): Improve equality documentation by adding an
example of equal? vs == and recommending eql? be aliased to == when
  overridden.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-23 22:36:40 +00:00
drbrain 9802ce8bd2 * object.c (rb_obj_hash): Added note that the hash value is not
deterministic on Marc-Andre's suggestion.  Expanded description of
  the purpose of the hash method.  [Bug #6068]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-23 22:23:58 +00:00
nobu abd135d36b * object.c (rb_Hash): fix mixed declaration and code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-24 07:21:33 +00:00
nobu d03199b6d6 * object.c (rb_Hash): trivial optimization.
* test/ruby/test_object.rb (TestObject#test_convert_hash): fix
  arguments order.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-24 04:29:07 +00:00
matz 498838c662 * object.c (rb_Hash): add Kernel#Hash conversion method like
Array() or Float().  a patch from Run Paint Run Run.  Fix #3131

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-24 04:02:30 +00:00
naruse ef18be2366 * object.c (rb_inspect): raise the result is not compatible with
the default external encoding. [ruby-core:42095] [Bug #5848]
  If the default external encoding is ASCII compatible, the encoding of
  inspected result must be compatible with it.
  If the default external encoding is ASCII incomapatible,
  the result must be ASCII only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-15 07:28:50 +00:00
ayumin 32e6600128 * object.c: Added examples for Object#is_a? and Object#instance_of?
patcheed from Manoj Kumar. [Bug #5880] [ruby-core:42057]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-11 17:19:54 +00:00
naruse 8d4baab08f Fix typo of rdoc of Object#inspect.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-07 15:21:09 +00:00
nari 50675fdba1 * gc.c: use Bitmap Marking algorithm to avoid copy-on-write of
memory pages. See [ruby-dev:45085] [Feature #5839]
  [ruby-core:41916].

* include/ruby/ruby.h : FL_MARK rename to FL_RESERVED1.

* node.h : ditto.

* debug.c : ditto.

* object.c (rb_obj_clone): FL_MARK move to a bitmap.

* class.c (rb_singleton_class_clone): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-07 14:02:23 +00:00
naruse e945532350 * object.c (rb_inspect): raises Encoding::CompatibilityError if the
result is incompatible with the default external encoding.
  [ruby-core:41931] [Bug #5848]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-06 07:06:22 +00:00
nobu c5fc4da7a2 * object.c (rb_check_to_int): new function to convert a VALUE to
an Integer if possible, but returns nil instead of raising an
  exception otherwise.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-11 01:37:50 +00:00
drbrain ee8fd5f197 * object.c (Init_Object): Add reference to BasicObject, brief
explanation of constant lookup.  Based on patch by Alvaro Pereyra
  Rabanal.
  [Ruby 1.9 - Bug #5426]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-10 20:54:45 +00:00
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00
nobu 125b62e76d * object.c (rb_obj_clone): singleton class should be attached
singleton object to.  a patch by Satoshi Shiba <shiba AT rvm.jp>
  at [ruby-dev:44460].  [Bug #5274]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-18 22:54:25 +00:00
drbrain 3eb7d2b33e * object.c: Add usage documentation for BasicObject. Based on patch
by Thomas Sawyer.  [Ruby 1.9 - Bug #5067]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-27 06:44:39 +00:00
nobu 8603c5934a * eval_error.c (rb_print_undef_str): new function to raise
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 16:05:35 +00:00
nobu 3fbc65d47f * parse.y (rb_check_id): make the given name a symbol or a string.
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-26 16:05:27 +00:00
nobu 4dc1a21809 * error.c (rb_name_error_str): new function to raise NameError
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-07-23 15:05:03 +00:00
nobu 34918aa832 * object.c (rb_mod_{const,cvar}_defined, rb_obj_ivar_defined):
avoid inadvertent symbol creation in reflection methods.  based
  on a patch by Jeremy Evans at [ruby-core:38367].  [Feature #5072]
* vm_method.c (rb_mod_method_defined)
  (rb_mod_{public,private,protected}_method_defined)
  (obj_respond_to): ditto.
* parse.y (rb_check_id): new function returns already interned ID
  or 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-22 12:06:42 +00:00
drbrain 926301969f * math.c: Attach documentation for Math.
* object.c:  Document NIL, TRUE, FALSE.
	* io.c:  Improve grammar in ARGF comment.  Document STDIN/OUT/ERR.
	  Document ARGF global constant.
	* lib/rake:  Hide deprecated toplevel constants from RDoc (import from
	  rake trunk).
	* lib/thwait.rb:  Document ThWait.
	* lib/mathn.rb:  Hide Math redefinition from RDoc
	* lib/sync.rb:  Add a basic comment for Sync_m, Synchronizer_m, Sync,
	  Synchronizer.
	* parse.y:  Document SCRIPT_LINES__.
	* hash.c:  Document ENV class and global constant.
	* vm.c:  Document TOPLEVEL_BINDING.
	* version.c:  Document RUBY_* constants.
	* ruby.c:  Document DATA and ARGV.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-29 03:09:34 +00:00
drbrain 0de3c24ea2 * object.c (Init_Object): Teach RDoc what Init_class_hierarchy does to
hook up ri for BasicObject, Object, Module and Class.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-27 22:51:42 +00:00
akr 7da3ea811e * method.h, internal.h iseq.h: declare internal functions.
* compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c,
  thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't
  declare internal functions.

  Note that rb_method_entry_eq() is defined in vm_method.c but
  there was a declaration in proc.c with different const-ness.
  Now it is declared in method.h with same const-ness to the
  definition.

* object.c (rb_mod_module_exec): don't declare functions declared in
  include/ruby/intern.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 03:49:33 +00:00
nobu 19f386674e * include/ruby/backward/classext.h: for evil gems. fixed #4803
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 03:05:11 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* 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 22:43:38 +00:00
drbrain ca25e7962c * object.c: Document Module#method_added and #method_removed.
Patch by Bryce Kerley.  [Ruby 1.9 - Feature #4867]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 00:11:20 +00:00
marcandre ffd86054f5 * object.c (rb_mod_attr_accessor, rb_mod_const_set): made rdoc
more precise by specifying Object can searched for Modules.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-27 13:55:21 +00:00
nobu 52f5f410e4 * internal.h: add for internal use only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 13:41:54 +00:00
nagachika 9fac3321a7 * object.c: format comments to keep 80 columns in a line.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-12 12:18:47 +00:00
drbrain 615e7987ca * object.c (rb_obj_equal): Add documentation. Patch by Vincent Batts.
[Ruby 1.9 - Bug #4664]
	* lib/rexml:  ditto
	* lib/mkmf.rb:  ditto
	* ext/socket/lib/socket.rb:  ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-11 22:56:13 +00:00
nagachika a64103fbfe * string.c (rb_String): Kernel#String should call to_str before to_s.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-29 12:56:40 +00:00
kosaki ac0178910e * object.c (rb_str_to_dbl): rewrite again. use ALLOCV instead
rb_str_tmp_new().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-27 12:46:30 +00:00
kosaki cab9751e97 * object.c (rb_str_to_dbl): Fix again. use rb_str_tmp_new()
instead ALLOC_N.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24 18:23:05 +00:00
kosaki 2ec31553ea * object.c (rb_str_to_dbl): use ALLOC_N instead ALLOCA_N because
ALLOC_N may cause stack overflow.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24 12:30:02 +00:00
marcandre af859f8d54 * object.c: Make BasicObject.new accept no parameter.
Revert of r26135 [ruby-core:27080], as per [ruby-core:32952].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-30 01:25:41 +00:00
mame b88c9aa1fe * object.c (Init_Object), constant.h, variable.c
(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 17:27:44 +00:00
mame a115768161 * class.c, constant.h, gc.c, method.h, object.c, variable.c,
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
2010-10-26 17:27:32 +00:00
mame 2285a8d813 * class.c, gc.c, object.c, variable.c, vm_insnhelper.c,
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
2010-10-26 17:27:21 +00:00
nobu 23e8deaf0d * array.c, gc.c, hash.c, object.c, string.c, struct.c,
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
2010-10-24 08:14:05 +00:00
nobu 671b498070 Commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:25:29 +00:00
nobu 12cbb58819 * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:22:03 +00:00
ryan a91ee12dd0 Improved doco for both Module.new and Class.new
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-18 06:56:41 +00:00
usa 3a297bb1f0 * object.c (rb_obj_class): remove mention of obsolete method.
a patch from Run Paint Run Run at [ruby-core:31842].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-27 03:27:50 +00:00
naruse b88a5027b8 Add rdoc about Kernel#<=> [ruby-core:31770]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-20 05:13:39 +00:00
nobu 492d8e67d7 * object.c (rb_f_integer): add example with base.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-06 22:02:25 +00:00
mame d35f8ea885 * object.c: Object#public_methods, private_methods, etc. returns
method ids that belong to the class or the singleton class(es) of
  the object.  [ruby-dev:41613]

* class.c: on the other hand, Module#public_instance_methods, etc.
  returns method ids that belong to the module itself (even if the
  module is singleton, it does not return method ids of super
  class(es); see [ruby-core:28837]).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-17 16:58:25 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
nari ca64478089 * gc.c : use simple lazy sweep algorithm for response performance
gain. See [ruby-dev:41067].

* object.c: FL_MARK of some objects by lazy sweep is copied when
  RVALUE is cloned. These objects are not marked in the mark phase.
  So delete FL_MARK.

* class.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 11:13:42 +00:00
nobu b4f1eaa493 * ext/openssl/lib/openssl/x509-internal.rb, lib/forwardable.rb,
lib/irb/cmd/fork.rb, lib/mutex_m.rb,
  lib/shell/process-controller.rb, lib/sync.rb, object.c: 
  suppress warnings patched by Benoit Daloze at [ruby-core:30366].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-23 08:48:44 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
naruse 4d399f12d4 * object.c (rb_cstr_to_dbl): return 0.0 if hexadecimal and
baccheck is FALSE: Float("0x1p+0") works, but "0x1p+0".to_f
  doesn't. [ruby-dev:40650]

* util.c (ruby_strtod): allow hexdecimal integers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 04:32:43 +00:00
akr 0471422beb enable Object#inspect doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-23 14:00:35 +00:00
shugo a3e10f380a * object.c (rb_obj_singleton_class): new method
Kernel#singleton_class.  [ruby-core:21702]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-23 09:38:54 +00:00
akr 82488cf2b9 * object.c (rb_obj_hash): use LONG2FIX to avoid Bignum allocation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-21 00:24:44 +00:00
matz a7926befe0 * object.c (rb_obj_clone): call initialize_clone hook method to
call initialize_copy.

* object.c (rb_obj_dup): call initialize_dup hook.

* lib/delegate.rb (Delegator#initialize_clone): use new hook to
  implement deep copy.  [ruby-dev:40242]

* lib/delegate.rb (Delegator#initialize_dup): ditto.

* test/test_delegate.rb (TestDelegateClass#test_copy_frozen): add
  a test to ensure #clone copies frozen status.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-08 07:43:54 +00:00
marcandre fb2941a4ec * object.c (rb_class_initialize): Make sure BasicObject doesn't get initialized twice [ruby-core:27577]
* class.c (rb_class_init_copy): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-13 02:57:48 +00:00
marcandre b3c3dda3f4 * lib/object.c (rb_obj_cmp): Default <=> operator returns 0 if objects are == [ruby-core:24063]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-24 01:32:01 +00:00
marcandre dbf07b09fd * object.c: BasicObject#initialize accepts any number of arguments [ruby-core:27080]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-20 23:05:07 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
marcandre 68b23a0de7 * object.c (convert_type): Cleanup unused variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-01 04:06:00 +00:00
matz 0580ba0611 * array.c (rb_ary_to_ary): do not use #respond_to? to detect
to_ary.  Just call.  [ruby-core:23738]

* eval.c (rb_check_funcall): new function with method existence
  check.  returns Qundef when the method does not exist.

* enumerator.c (enumerator_rewind): just call method, using
  rb_check_funcall().  [ruby-core:23738]

* error.c (exc_equal): ditto.

* object.c (convert_type): ditto.

* error.c (rb_name_err_mesg_new): export function.

* eval.c (make_exception): ditto.

* io.c (pop_last_hash): return early when the last argument is nil.

* io.c (rb_io_puts): treat T_STRING specially for small
  optimization. 

* vm_eval.c (raise_method_missing): skip method call if possible
  using rb_method_basic_definition_p().

* vm_eval.c (method_missing): ditto.

* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test
  suites changed to ignore exceptions caused by just-call policy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 04:55:10 +00:00
matz 51f033f853 * object.c (rb_obj_cmp): defines Object#<=>. [ruby-core:24063]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-24 16:48:05 +00:00
matz 7eac66b9c6 * object.c (rb_obj_inspect): print instance variables only when
Object#to_s is not overridden.  [ruby-core:24425]

* class.c (rb_obj_basic_to_s_p): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-21 20:17:27 +00:00
nobu b20521ddc5 * object.c (rb_obj_inspect): fixed rdoc about the case that to_s
is called.  [ruby-core:24425]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-21 10:32:53 +00:00
marcandre 72838c28bd * object.c (rb_mod_const_defined): rdoc fix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-13 23:12:59 +00:00
matz 74926fefb7 * object.c (rb_f_integer): now Integer() takes optional base
argument.  base will be ignored for non string values.
  suggested by Sam Carr at RubyFoo Lounge at London.

* test/ruby/test_integer.rb (TestInteger#test_Integer): test
  updated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-03 10:18:14 +00:00
nobu 31b7ae00c0 * include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
yugui e056ac59a7 * class.c: refactored singleton class related matters.
Handles eigenclasses and plain classes transparently.

  (make_metaclass): renamed from make_metametaclass.
  (METACLASS_OF): new utility macro
  (META_CLASS_OF_CLASS_CLASS): ditto.
  (ENSURE_EIGENCLASS): ditto.
  (make_singleton_class): extracted from rb_singleton_class.
  (boot_defclass): moved from object.c
  (Init_class_hierarchy): extracted from Init_Object.
  (rb_make_metaclass): refactored.
  (singleton_class_of): extracted from rb_singleton_class.
  (rb_singleton_class): refactored.
  (rb_define_singleton_method): it needs a metaclass only
  but not its metametaclass.

* object.c: booting class hierarchy was moved to class.c
  for keeping dependency between compilation units least.
  (Init_Object): extracting the booting into
  Init_class_hierarchy.
  (boot_defclass): moved to class.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-31 05:55:57 +00:00
nobu 9676023607 * random.c (random_rand): unified random_int and random_float.
[ruby-dev:39158].  and fixes [ruby-core:24655], [ruby-core:24677],
  [ruby-core:24679].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-26 10:20:30 +00:00
nobu e07cb859cc * suppressed shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
nobu b1f618e9e5 * object.c (rb_to_integer, rb_check_to_integer): return Bignum
as-is.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12 14:30:32 +00:00
matz a5e227edfe * hash.c (rb_hash_hash): documentation fix. a patch from
Marc-Andre Lafortune.  [ruby-core:23943]

* object.c (rb_mod_cmp): ditto.

* range.c (range_eq): ditto.

* string.c (rb_str_partition, rb_str_rpartition): ditto.

* struct.c (rb_struct_s_def): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 21:20:44 +00:00
yugui cbb56c7514 Doxy-comment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 16:52:57 +00:00
yugui 2d42e704f4 Doxy-comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 16:39:28 +00:00
yugui 8bacaf1f5c * object.c: updated the diagram of metaclass hierarchy in rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 15:34:30 +00:00
akr 6eebf142e1 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-24 13:37:43 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
mame e722ad99d5 * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),
include/ruby/intern.h: add Murmurhash API.  [ruby-dev:37784]

* complex.c (nucomp_hash), array.c (rb_ary_hash), time.c (time_hash),
  string.c (rb_str_hsah), object.c (rb_obj_hash), range.c
  (range_hash), struct.c (rb_struct_hash), hash.c (rb_any_hash),
  rational.c (nurat_hash): use Murmurhash.  [ruby-dev:37784]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 19:55:34 +00:00
akr 074a374c86 * include/ruby/ruby.h (STR2CSTR): removed.
(rb_str2cstr): removed.

* object.c (rb_str2cstr): removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-31 13:30:17 +00:00
yugui e1809a0ced * object.c (rb_obj_not_match): rdoc.
Patch by Kornelius Kalnbach.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-13 12:29:54 +00:00
matz 98454a6da8 * object.c (rb_to_float): replaced by to_flo definition from
math.c  [ruby-dev:37668]

* math.c (Need_Float): use rb_to_float().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-31 14:30:50 +00:00
matz ce0cd6ad1f * object.c (rb_to_float): prohibit conversion from nil to float.
[ruby-dev:37663]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-30 16:07:14 +00:00
matz ad00464489 * pack.c (pack_pack): template f should not accept non float
values.  [ruby-dev:37656]

* object.c (rb_to_float): new function to type check floats.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29 13:40:33 +00:00
ko1 8cd252ac6f * common.mk: clean up
- remove blockinlining.$(OBJEXT) to built
  - make ENCODING_H_INCLDUES variable (include/ruby/encoding.h)
  - make VM_CORE_H_INCLUDES variable (vm_core.h)
  - simplify rules.
  - make depends rule to output depend status using gcc -MM.
* include/ruby/mvm.h, include/ruby/vm.h: rename mvm.h to vm.h.
* include/ruby.h: ditto.
* load.c: add inclusion explicitly.
* enumerator.c, object.c, parse.y, thread.c, vm_dump.c:
  remove useless inclusion.
* eval_intern.h: cleanup inclusion.
* vm_core.h: rb_thread_t should be defined in this file.
* vm_evalbody.c, vm_exec.c: rename vm_evalbody.c to vm_exec.c.
* vm.h, vm_exec.h: rename vm.h to vm_exec.h.
* insnhelper.h, vm_insnhelper.h: rename insnhelper.h to vm_insnhelper.h.
* vm.c, vm_insnhelper.c, vm_insnhelper.h:
  - rename vm_eval() to vm_exec_core().
  - rename vm_eval_body() to vm_exec().
  - cleanup include order.
* vm_method.c: fix comment.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 00:20:28 +00:00
yugui 975ecd2f3f * object.c (Init_Object): added metameta-class initialization for
BasicObject, Object, and Module.
  The metameta-classes of them are now the metaclass of Class, as the
  metameta-calss of Class is.

* object.c (boot_defmetametaclass): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-14 04:48:56 +00:00
matz 31b6ea65bb * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp>
  in [ruby-dev:36102].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 18:24:21 +00:00
matz 41d5072573 * object.c (rb_obj_freeze): update rdoc to mention RuntimeError
(not TypeError any longer) would be raised.  [ruby-dev:35982]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 17:49:18 +00:00
matz 84b144f6de * object.c (convert_type): call less rb_intern() less frequently
by using cache structure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-28 11:50:31 +00:00
nobu 5f9c188d97 * include/ruby/ruby.h (rb_intern_const): tiny optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 00:20:31 +00:00
shugo f433d710d0 * object.c (rb_obj_untrusted): new method Object#untrusted?.
(rb_obj_untrust): new method Object#untrust.
  (rb_obj_trust): new method Object#trust.
* array.c, debug.c, time.c, include/ruby/ruby.h, re.c, variable.c,
  string.c, io.c, dir.c, vm_method.c, struct.c, class.c, hash.c,
  ruby.c, marshal.c: fixes for Object#untrusted?.
* test/ruby/test_module.rb, test/ruby/test_array.rb,
  test/ruby/test_object.rb, test/ruby/test_string.rb,
  test/ruby/test_marshal.rb, test/ruby/test_hash.rb: added tests for
  Object#untrusted?.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 07:25:05 +00:00
nobu fa57f78b9b * object.c (rb_class_superclass): rdoc improvement, a patch from
Gaston Ramos <ramos.gaston AT gmail.com> in [ruby-core:17371].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-22 00:51:17 +00:00
nobu 02337b089e * marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
public methods only.  [ruby-core:17283]

* object.c (convert_type): ditto.

* lib/singleton.rb (Singleton#_dump): conversion method should be
  public.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-18 03:05:33 +00:00
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
matz a690ad4698 * object.c (rb_obj_alloc): RDoc updated. a patch from Gaston
Ramos <ramos.gaston at gmail.com> in [ruby-core:17073].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-04 09:55:14 +00:00
nobu 075530a685 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
nobu de9d25c544 * marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
private methods too.  [ruby-dev:34671]

* object.c (convert_type): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-28 03:52:44 +00:00
matz c2257734e3 * util.c (ruby_strtod): clear errno at the top of our own
impelementation of strtod(3).  [ruby-dev:34834] [ruby-dev:34839]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-26 07:51:46 +00:00
matz 8707a6ff4b * object.c (rb_cstr_to_dbl): should clear errno before calling
strtod(3).  [ruby-dev:34834]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 13:39:18 +00:00
matz f970ffedae * math.c (to_flo): rb_Float() accepts even strings for input.
* complex.c (nucomp_to_f): fix wrong message.

* complex.c (nucomp_to_r): ditto.

* object.c (rb_Float): do not check NaN for error.  NaN is a part
  of valid float values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-16 04:17:45 +00:00
matz 1d53405b31 * object.c (rb_cstr_to_dbl): no need for forceful warning when
converting to float.  overflow is a nature of float values.

* parse.y (parser_yylex): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-15 10:48:10 +00:00
nobu c3cbb209ca * object.c (rb_cstr_to_dbl): fix for a mere underscore.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-12 08:33:37 +00:00
akr 861219ce4a fix doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
matz bececd35c5 * object.c (rb_mod_freeze): call rb_class_name() directly.
[ruby-core:15802]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-06 01:33:56 +00:00
matz 39787ea14d * numeric.c (fix_to_s): avoid rb_scan_args() when no argument
given. 
* bignum.c (rb_big_to_s): ditto.
* enum.c (enum_first): ditto.
* eval_jump.c (rb_f_catch): ditto.
* io.c (rb_obj_display): ditto.
* class.c (rb_obj_singleton_methods): ditto.
* object.c (rb_class_initialize): ditto.
* random.c (rb_f_srand): ditto.
* range.c (range_step): ditto.
* re.c (rb_reg_s_last_match): ditto.
* string.c (rb_str_to_i): ditto.
* string.c (rb_str_each_line): ditto.
* string.c (rb_str_chomp_bang): ditto.
* string.c (rb_str_sum): ditto.

* string.c (str_modifiable): declare inline.
* string.c (str_independent): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-05 05:22:17 +00:00
nobu b4b3180bfa * object.c (rb_cstr_to_dbl): check for successive underscores.
[ruby-dev:33952]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-01 15:08:13 +00:00
naruse 50a860d006 * string.c (str_new): remove encoding assumption of empty string.
* hash.c ( rb_f_getenv, env_fetch, env_inspect): result of ENV should
  be always ASCII-8BIT.

* object.c (nil_to_s): nil.to_s should be US-ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-28 18:13:45 +00:00
akr b58e36da4a * include/ruby/ruby.h (ROBJECT_NUMIV): renamed from ROBJECT_LEN.
(ROBJECT_IVPTR): renamed from ROBJECT_PTR.

* variable.c: follow the above renaming.

* object.c: ditto.

* gc.c: ditto.

* marshal.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-25 16:18:18 +00:00
akr 8f842d71e9 * include/ruby/ruby.h (RObject): add iv_index_tbl for shortcut of
RCLASS_IV_INDEX_TBL(rb_obj_class(obj)).
  (ROBJECT_IV_INDEX_TBL): defined.

* object.c (init_copy): initialize iv_index_tbl in struct RObject.

* variable.c (ivar_get): use ROBJECT_IV_INDEX_TBL.
  (rb_ivar_defined): ditto.
  (obj_ivar_each): ditto.
  (rb_obj_remove_instance_variable): ditto.
  (rb_ivar_set): update iv_index_tbl in struct RObject.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-13 11:52:46 +00:00
matz 0472db84c5 * range.c (range_include): specialize single character string
case (e.g. (?a ..?z).include(?x)) for performance.
  [ruby-core:15481]

* string.c (rb_str_upto): specialize single character case.

* string.c (rb_str_hash): omit coderange scan for performance.

* object.c (rb_check_to_integer): check Fixnum first.

* object.c (rb_to_integer): ditto.

* string.c (rb_str_equal): inline memcmp to avoid unnecessary
  rb_str_comparable(). 

* parse.y (rb_intern2): use US-ASCII encoding.

* parse.y (rb_intern_str): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-11 17:46:52 +00:00
naruse 42dcda08ae * string.c (rb_str_usascii_new{,2}: defined.
(rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when empty
  string.

* encoding.c (rb_usascii_encoding, rb_usascii_encindex): defined.
  (rb_enc_inspect, enc_name, rb_locale_charmap, rb_enc_name_list_i):
  use rb_str_ascii_new.

* array.c (recursive_join, inspect_ary): ditto.

* object.c (nil_to_s, nil_inspect, true_to_s, false_to_s,
  rb_mod_to_s): ditto.

* hash.c (inspect_hash, rb_hash_inspect, rb_f_getenv, env_fetch,
  env_clear, env_to_s, env_inspect): ditto.

* numeric.c (flo_to_s, int_chr, rb_fix2str): ditto.

* bignum.c (rb_big2str): ditto.

* file.c (rb_file_ftype, rb_file_s_dirname, rb_file_s_extname,
  file_inspect_join, Init_file): ditto.

* test/ruby/test_ruby_m17n.rb: add checks for encoding of string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 16:40:02 +00:00
nobu db26a9b105 * load.c (rb_feature_p): get rid of unlimited alloca.
* object.c (rb_cstr_to_dbl): ditto.

* io.c (mode_enc): fixed uninitialized variable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-16 06:26:33 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr e01c045a8b enable several rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 07:52:39 +00:00
ko1 cd84310864 * compile.c, insnhelper.ci, insns.def, object.c, vm.c, vm.h:
optimize !@, != method invocation.
* id.c, id.h: ditto.
* bootstraptest/test_syntax.rb: add tests for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-18 12:07:51 +00:00
matz 2521b33ed7 * object.c (rb_obj_freeze): preserve frozen state of immediate
values in internal hash table, a la generic_ivar.

* object.c (rb_obj_frozen_p): check immediate values too.

* variable.c (generic_ivar_set): add frozen check fro immediate
  values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-18 08:28:39 +00:00