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

462 Коммитов

Автор SHA1 Сообщение Дата
nobu 140929d8ba vm.c: return the result hash
* vm.c (core_hash_merge_kwd): should return the result hash, which
  may be converted from and differ from the given argument.
  [ruby-core:62921] [Bug #9898]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-03 19:08:40 +00:00
ko1 bbfe069ec1 * vm.c (ruby_vm_destruct): remove useless call of
rb_gc_force_recycle().
  At this line, a VM object is already freed
  (is changed to T_NONE) by rb_gc_call_finalizer_at_exit().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02 08:17:55 +00:00
usa 6c42f57177 * vm_trace.c, vm.c, thread.c: get rid of (maybe false positive) warnings about
using uninitialized var with VC++.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-29 15:45:25 +00:00
normal 1142249713 vm.c: remove rb_vm_living_threads_foreach function
Shorter code with fewer callbacks and casts should be more readable.

* vm.c (rb_vm_living_threads_foreach): remove function
  [ruby-core:62745]
* thread.c (terminate_i): remove
* thread.c (terminate_all): implement (inlines old terminate_i)
* thread.c (rb_thread_terminate_all): use terminate_all
* thread.c (rb_thread_fd_close_i): remove
* thread.c (rb_thread_fd_close): iterate inline
* thread.c (thread_list_i): remove
* thread.c (rb_thread_list): iterate inline
* thread.c (rb_thread_atfork_internal): iterate inline
* thread.c (terminate_atfork_i): update types to remove casts
* thread.c (terminate_atfork_before_exec_i): ditto
* thread.c (struct thgroup_list_params): remove definition
* thread.c (thgroup_list_i): remove
* thread.c (thgroup_list): iterate inline
* thread.c (check_deadlock_i): remove
* thread.c (debug_deadlock_check): implement (inlines check_deadlock_i)
* thread.c (debug_i): remove
* thread.c (rb_check_deadlock): iterate inline
* vm.c (vm_mark_each_thread_func): remove
* vm.c (rb_vm_mark): iterate inline
* vm_core.h (rb_vm_living_threads_remove): remove
* vm_trace.c (clear_trace_func_i): remove
* vm_trace.c (rb_clear_trace_func): iterate inline

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-28 01:48:11 +00:00
nobu 82f4c4d4d7 report bug with machine regisiters
* error.c (rb_bug_context): new function to report bug with
  context.
* vm_dump.c (rb_vm_bugreport): accepts `ucontext_t` argument to
  dump machine regisiters.  based on [GH-584].
* signal.c (sigbus, sigsegv): dump machine regisiters if available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 03:46:55 +00:00
nobu 97c2a48960 vm.c: rewind cfp
* vm.c (m_core_hash_{from_ary,merge_{ary,ptr,kwd}}): rewind cfp to
  show proper backtrace.  [ruby-dev:35820] [Bug #416]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-21 06:11:25 +00:00
akr dd5d029db0 * compile.c (BUFSIZE): Unused macro removed.
* vm.c (BUFSIZE): Ditto.

* pack.c (INT64toNUM): Ditto.
  (UINT64toNUM): Ditto.
  (BYTEWIDTH): Ditto.

* time.c (lshift): Ditto.
  (UINT64toNUM): Ditto.
  (id_lshift): Unused variable removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-11 13:29:16 +00:00
nobu 7c68a3121c vm.c: suppress a warning
* vm.c (rb_vm_living_threads_foreach): suppress "uninitialized"
  warning where "typeof" is unavailable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-11 00:25:36 +00:00
normal f11db2a605 vm*: doubly-linked list from ccan to manage vm->living_threads
A doubly-linked list for tracking living threads guarantees
constant-time insert/delete performance with no corner cases of a
hash table.  I chose this ccan implementation of doubly-linked
lists over the BSD sys/queue.h implementation since:

1) insertion and removal are both branchless
2) locality is improved if a struct may be a member of multiple lists
   (0002 patch in Feature 9632 will introduce a secondary list
   for waiting FDs)

This also increases cache locality during iteration: improving
performance in a new IO#close benchmark with many sleeping threads
while still scanning the same number of threads.

	vm_thread_close 1.762

* vm_core.h (rb_vm_t): list_head and counter for living_threads
  (rb_thread_t): vmlt_node for living_threads linkage
  (rb_vm_living_threads_init): new function wrapper
  (rb_vm_living_threads_insert): ditto
  (rb_vm_living_threads_remove): ditto
* vm.c (rb_vm_living_threads_foreach): new function wrapper
* thread.c (terminate_i, thread_start_func_2, thread_create_core,
  thread_fd_close_i, thread_fd_close): update to use new APIs
* vm.c (vm_mark_each_thread_func, rb_vm_mark, ruby_vm_destruct,
  vm_memsize, vm_init2, Init_VM): ditto
* vm_trace.c (clear_trace_func_i, rb_clear_trace_func): ditto
* benchmark/bm_vm_thread_close.rb: added to show improvement
* ccan/build_assert/build_assert.h: added as a dependency of list.h
* ccan/check_type/check_type.h: ditto
* ccan/container_of/container_of.h: ditto
* ccan/licenses/BSD-MIT: ditto
* ccan/licenses/CC0: ditto
* ccan/str/str.h: ditto (stripped of unused macros)
* ccan/list/list.h: ditto
* common.mk: add CCAN_LIST_INCLUDES
  [ruby-core:61871][Feature 9632 (part 1)]

Apologies for the size of this commit, but I think a good
doubly-linked list will be useful for future features, too.
This may be used to add ordering to a container_of-based hash
table to preserve compatibility if required (e.g. feature 9614).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10 23:48:51 +00:00
nobu 766478f6a7 vm_eval.c: valid name IDs only
* vm.c (vm_collect_local_variables_in_heap): use struct local_var_list
  instead of VALUE directly.

* vm_eval.c (local_var_list_update): add valid name IDs only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07 04:26:49 +00:00
nobu 11eb870136 vm_eval.c: exclude hidden variables
* vm_eval.c (rb_f_local_variables): exclude variables hidden by
  shadowing.  [ruby-core:60501] [Bug #9486]
* vm.c (collect_local_variables_in_iseq): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07 02:25:43 +00:00
nobu c60e282b30 rename variables
* vm.c (vm_collect_local_variables_in_heap): rename an argument.

* vm_eval.c (rb_f_local_variables): rename a local variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07 02:00:28 +00:00
nobu 40c6eaf6d8 vm.c: Init_vm_objects
* vm.c (Init_vm_objects): initialize VM internal objects, after
  heap initialized.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04 13:04:37 +00:00
ko1 ba6b0acdb6 * vm.c (invoke_block_from_c): add VM_FRAME_FLAG_BMETHOD to record
it is bmethod frame.
* vm.c (vm_exec): invoke RUBY_EVENT_RETURN event if rollbacked frame
  is VM_FRAME_FLAG_BMETHOD.
  [Bug #9759]
* test/ruby/test_settracefunc.rb: add a test for TracePoint/set_trace_func.
* vm_core.h: renmae rb_thread_t::passed_me to
  rb_thread_t::passed_bmethod_me to clarify the usage.
* vm_insnhelper.c (vm_call_bmethod_body): use renamed member.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30 09:08:10 +00:00
nobu 03f0ca4c81 vm.c: avoid inadvertent pin-down
* vm.c (vm_stat): get rid of inadvertent dynamic symbol pin-down,
  and preserve encoding in error messages.  also should not use
  RSTRING_PTR macro on function calls.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-31 02:34:40 +00:00
nobu 4765f9c774 vm.c: extract core_hash_merge
* vm.c (core_hash_merge): extract from m_core_hash_merge_ary and
  m_core_hash_merge_ptr.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-24 15:28:31 +00:00
nobu d617a02b14 vm.c: merge code
* vm.c (m_core_hash_from_ary, m_core_hash_merge_ary): merge
  duplicated code.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-24 15:28:30 +00:00
nobu 163f9abe4f vm_insnhelper.c: relax arity check
* vm.c (invoke_block_from_c): add splattable argument.
* vm.c (vm_invoke_proc): disallow to splat when directly invoked.
* vm_insnhelper.c (vm_callee_setup_arg_complex, vm_callee_setup_arg):
  relax arity check of yielded lambda.  [ruby-core:61340] [Bug #9605]
* test/ruby/test_yield.rb (TestRubyYieldGen#emu_bind_params): no
  longer raise ArgumentError when splatting to lambda.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-13 16:18:45 +00:00
normal fa043eb4e8 vm.c: cleanup to use rb_method_entry_at
* vm.c (add_opt_method): cleanup to use rb_method_entry_at
  Easier experiments with a non-st method entry tables.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08 08:56:50 +00:00
nobu cc216f9aae adjust indent and style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-27 07:10:14 +00:00
nobu 8a2621ddc2 eval_intern.h: use TH_TMPPOP_TAG and TH_REPUSH_TAG
* eval_intern.h (TH_TMPPOP_TAG, TH_REPUSH_TAG): instead of TAG2 names.

* eval_intern.h (TH_REPUSH_TAG): suppress unused-value warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05 15:32:35 +00:00
nobu 628f75b752 vm_core.h: rb_thread_struct::machine
* vm_core.h (rb_thread_struct): aggregate cpu stuff into a struct,
  so that a debugger can show its content at once.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-28 06:09:58 +00:00
naruse 0f24712471 suppress warning: implicit conversion loses integer precision
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-14 21:49:45 +00:00
ko1 c2e72fb343 * vm.c (rb_vm_pop_cfunc_frame): added. It cares c_return event.
The patch base by drkaes (Stefan Kaes).
  [Bug #9321]
* variable.c (rb_mod_const_missing): use rb_vm_pop_cfunc_frame()
  instead of rb_frame_pop().
* vm_eval.c (raise_method_missing): ditto.
* vm_eval.c (rb_iterate): ditto.
* internal.h (rb_vm_pop_cfunc_frame): add decl.
* test/ruby/test_settracefunc.rb: add tests.
  provided by drkaes (Stefan Kaes).
* vm.c, eval.c, include/ruby/intern.h (rb_frame_pop):
  move definition of rb_frame_pop() and deprecate it.
  It doesn't care about `return' events.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09 10:12:59 +00:00
ktsj de7e488b08 * vm.c (RubyVM::OPTS): get rid of a garbage character.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-04 08:22:46 +00:00
nobu 20c38381a8 vm.c: check cbase
* vm.c (rb_vm_cref_in_context): check also cbase, not only self.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-24 14:04:31 +00:00
nobu 1fc3319973 proc.c: make method by define_method public
* proc.c (rb_mod_define_method): consider visibility only if self
  in the caller is same as the receiver, otherwise make public as
  well as old behavior.  [ruby-core:57747] [Bug #9005]
  [ruby-core:58497] [Bug #9141]
* vm.c (rb_vm_cref_in_context): return ruby level cref if self is
  same.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-24 07:28:11 +00:00
ko1 c702005a7b * include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN into
RB_OBJ_WRITE and RB_OBJ_WRITTEN.
* array.c, class.c, compile.c, hash.c, internal.h, iseq.c,
  proc.c, process.c, re.c, string.c, variable.c, vm.c,
  vm_eval.c, vm_insnhelper.c, vm_insnhelper.h,
  vm_method.c: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20 08:07:47 +00:00
nobu f2c319395d vm.c: reduce clearing method cache
* vm_method.c (rb_add_method, rb_alias): rb_method_entry_set()
  already clears method cache.

* vm_method.c (rb_export_method): ditto by rb_add_method().

* vm_method.c (set_method_visibility): ditto by rb_export_method().

* vm.c (vm_define_method): ditto by rb_add_method().

* vm.c (m_core_undef_method): ditto by rb_add_method() in rb_undef().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13 03:23:42 +00:00
charliesome 7df9798126 * compile.c, insns.def, test/ruby/test_rubyvm.rb, vm.c, vm_core.h,
vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Rename method_serial
  to global_method_state and constant_serial to global_constant_state
  after discussion with ko1.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09 10:51:02 +00:00
ko1 5dc77048a3 * vm.c (vm_stat): renamed from ruby_vm_stat.
Should not use ruby_ prefix here.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09 09:12:23 +00:00
tmm1 599dbf65a5 vm.c: fix compile issue on 32bit freebsd
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08 23:07:43 +00:00
tmm1 cc1063092b vm.c: add RubyVM.stat for accessing cache serials
* vm.c (ruby_vm_stat): add RubyVM.stat() for access to internal cache
  counters. this methods behaves like GC.stat, accepting an optional
  hash or symbol argument. [Bug #9190] [ruby-core:58750]
* test/ruby/test_rubyvm.rb: test for new method

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08 04:05:59 +00:00
charliesome e0290c9404 * array.c (rb_ary_or): use RHASH_TBL_RAW instead of RHASH_TBL
* process.c (rb_execarg_fixup): use RHASH_TBL_RAW and insert write
  barriers where appropriate

* vm.c (kwmerge_i): use RHASH_TBL_RAW

* vm.c (HASH_ASET): use rb_hash_aset instead of calling directly into
  st_insert

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08 00:41:01 +00:00
tmm1 4258235876 * load.c (features_index_add_single): Move loaded_features_index array values off
the ruby heap. [Bug #9201] [ruby-core:58805]
* load.c (loaded_features_index_clear_i): Clean up off-heap array structure.
* vm.c (rb_vm_mark): Remove unnecessary mark_tbl for loaded_features_index.
  This improves minor GC time by 15% in a large application.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03 08:13:31 +00:00
nobu 92b4a05e07 vm_eval.c: rb_yield_block
* vm_eval.c (rb_yield_block): yield block with rb_block_call_func
  arguments.
* range.c (range_each): use rb_yield_block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 08:06:19 +00:00
ko1 a6ca9f9fce * vm.c (ruby_vm_destruct): do not use ruby_xfree() after freeing
objspace.
* gc.c (ruby_mimfree): added. It is similar to ruby_mimmalloc().
* internal.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22 01:38:08 +00:00
charliesome 07ac58747f * compile.c (iseq_compile_each): emit opt_str_freeze if the #freeze
method is called on a static string literal with no arguments.

* defs/id.def (firstline): add freeze so idFreeze is available

* insns.def (opt_str_freeze): add opt_str_freeze instruction which
  pushes a frozen string literal without allocating a new object if
  String#freeze is not overriden

* string.c (Init_String): define String#freeze

* vm.c (vm_init_redefined_flag): define BOP_FREEZE on String class as
  a basic operation

* vm_insnhelper.h: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 21:17:06 +00:00
charliesome 8b0771b014 * class.c: unify names of vm state version counters to 'serial'.
This includes renaming 'vm_state_version_t' to 'rb_serial_t',
  'method_state' to 'method_serial', 'seq' to 'class_serial',
  'vmstat' to 'constant_serial', etc.

* insns.def: ditto
* internal.h: ditto
* vm.c: ditto
* vm_core.h: ditto
* vm_insnhelper.c: ditto
* vm_insnhelper.h: ditto
* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 03:34:49 +00:00
ko1 d1674ef67b * gc.c: add support to estimate increase of oldspace memory usage.
This is another approach to solve an issue discussed at r43530.
  This feature is diabled as default.
  This feature measures an increment of memory consuption by oldgen
  objects. It measures memory consumption for each objects when
  the object is promoted. However, measurement of memory consumption
  is not accurate now. So that this measurement is `estimation'.
  To implement this feature, move memsize_of() function from
  ext/objspace/objspace.c and expose rb_obj_memsize_of().
  Some memsize() functions for T_DATA (T_TYPEDDATA) have problem to
  measure memory size, so that we ignores T_DATA objects now.
  For example, some functions skip NULL check for pointer.
  The macro RGENGC_ESTIMATE_OLDSPACE enables/disables this feature,
  and turned off as default.
  We need to compare 3gen GC and this feature carefully.
  (it is possible to enable both feature)
  We need a help to compare them.
* internal.h: expose rb_obj_memsize_of().
* ext/objspace/objspace.c: use rb_obj_memsize_of() function.
* cont.c (fiber_memsize): fix to check NULL.
* variable.c (autoload_memsize): ditto.
* vm.c (vm_memsize): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-05 04:51:01 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
charliesome 7fafa8f376 * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: split
ruby_vm_global_state_version into two separate counters - one for the
  global method state and one for the global constant state. This means
  changes to constants do not affect method caches, and changes to
  methods do not affect constant caches. In particular, this means
  inclusions of modules containing constants no longer globally
  invalidate the method cache.

* class.c, eval.c, include/ruby/intern.h, insns.def, vm.c, vm_method.c:
  rename rb_clear_cache_by_class to rb_clear_method_cache_by_class

* class.c, include/ruby/intern.h, variable.c, vm_method.c: add
  rb_clear_constant_cache

* compile.c, vm_core.h, vm_insnhelper.c: rename vmstat field in
  rb_call_info_struct to method_state

* vm_method.c: rename vmstat field in struct cache_entry to method_state

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 00:52:38 +00:00
charliesome 393e577d31 * vm.c: vm_clear_all_cache is not necessary now we use a 64 bit counter
for global state version.

* vm_insnhelper.h: ruby_vm_global_state_version overflow is unnecessary

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-28 00:31:07 +00:00
nobu 15798b606e vm.c: initialize defined_module_hash early
* vm.c (Init_BareVM): initialize defined_module_hash here,
  Init_top_self() is too late to register core classes/modules.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-13 11:59:27 +00:00
nobu 0e040f8dbf compile.c, vm.c: reduce hash merge
* compile.c (compile_array_): no hash to merge if it is empty.
* vm.c (m_core_hash_merge_kwd): just check keys if only one argument
  is given, without merging.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-13 03:16:54 +00:00
ko1 52c1331763 * class.c, variable.c, gc.c (rb_class_tbl): removed.
* vm.c, vm_core.h (rb_vm_add_root_module): added to register as a
  defined root module or class.
  This guard helps mark miss from defined classes/modules they are
  only refered from C's global variables in C-exts.
  Basically, it is extension's bug.
  Register to hash object VM has.
  Marking a hash objects allows generational GC supports.
* gc.c (RGENGC_PRINT_TICK): disable (revert).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-11 18:27:18 +00:00
ko1 4599d3efd7 * vm.c (vm_exec): support :b_return event for "lambda{return}.call".
[Bug #8622]
* test/ruby/test_settracefunc.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-10 08:31:48 +00:00
nobu 16095eb187 vm.c: hide singleton class of frozen-core
* vm.c (Init_VM): hide also the singleton class of frozen-core, not
  only frozen-core itself.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-10 02:11:37 +00:00
sorah c4b4e77c72 * insns.def (opt_regexpmatch2): Check String#=~ hasn't overridden
before calling rb_reg_match().

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

* vm.c (vm_init_redefined_flag): Add BOP flag for String#=~

[ruby-core:57385] [Bug #8953]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26 07:58:28 +00:00
charliesome b18151cf53 * insns.def (opt_regexpmatch1): check Regexp#=~ is not defined before
calling rb_reg_match()

* test/ruby/test_regexp.rb: add test

* vm.c (ruby_vm_redefined_flag): change type to short[]

* vm.c (vm_redefinition_check_flag): return REGEXP_REDEFINED_OP_FLAG if
  klass == rb_cRegexp

* vm.c (vm_init_redefined_flag): setup BOP flag for Regexp#=~

* vm_insnhelper.h: add REGEXP_REDEFINED_OP_FLAG

[ruby-core:57385] [Bug #8953]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26 07:39:48 +00:00