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

26 Коммитов

Автор SHA1 Сообщение Дата
zzak 7e62b6cccf * vm_backtrace.c: Add documentation for Kernel#caller_locations,
Kernel#caller, and Thread::Backtrace::Location


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-31 06:09:57 +00:00
ko1 1d193d9251 * vm_backtrace.c (vm_backtrace_to_ary): check negative size (2nd arg).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-03 07:23:57 +00:00
ko1 c906e879d8 * vm_backtrace.c (location_inspect_m): add
Thread::Backtrace::Location#inspect.
  It same as loc_obj.to_s.inspect.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 12:09:17 +00:00
nobu fcd4ecd576 vm_backtrace.c: suppress warning
* vm_backtrace.c (rb_debug_inspector_open): suppress
  uninitialized-variable warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 09:50:34 +00:00
nobu 4f451dddeb vm_backtrace.c: RB_GC_GUARD
* include/ruby/ruby.h (RB_GC_GUARD_PTR): add note.
* vm_backtrace.c (backtrace_to_str_ary): use RB_GC_GUARD() instead of
  RB_GC_GUARD_PTR() which has no effect.
  (backtrace_to_location_ary): ditto.
  (vm_backtrace_to_ary): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 00:38:24 +00:00
ko1 0c3f23ae7c * vm_backtrace.c: add GC guards.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 22:35:09 +00:00
nobu cf1d6730c1 remove trainling spaces
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 08:10:23 +00:00
ko1 e8af0046b7 * vm_backtrace.c (rb_debug_inspector_open): use RARRAY_LENINT() for
int variable.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 07:15:30 +00:00
ko1 585ac7f1a2 * include/ruby/debug.h: add rb_debug_inspector_* APIs.
* vm_backtrace.c: ditto.
* common.mk: add dpendency from vm_backtrace.o to
  include/ruby/debug.h.
* proc.c (rb_binding_new_with_cfp): constify.
* vm.c (rb_vm_get_ruby_level_next_cfp): consitify.
* vm_core.h, vm_trace.c: move decls.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 07:05:27 +00:00
ko1 f22f1fbb54 * vm_backtrace.c: same as a last patch.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 01:30:42 +00:00
ko1 d7ab6820b5 * vm_backtrace.c: use `long' for return values of `NUM2LONG()'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 01:26:38 +00:00
ko1 3d47e7b285 * vm_backtrace.c (vm_backtrace_to_ary): support range argument
like Array#[].
  [ruby-core:50092] [ruby-trunk - Feature #7434]
  Test and document is not available. Please help us.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 00:12:49 +00:00
ko1 2fa079b62a * vm_backtrace.c (backtrace_to_str_ary2): rename to backtrace_to_str_ary.
* vm_backtrace.c (rb_backtrace_to_str_ary): use `backtrace_to_str_ary()'.
* vm_backtrace.c (backtrace_to_frame_ary): rename to
  backtrace_to_location_ary.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28 20:30:01 +00:00
ko1 0fe2051c93 * vm_backtrace.c: rename Class name from
::RubyVM::Backtrace and ::RubyVM::Backtrace::Location
  to ::Thread::Backtrace and ::Thread::Backtrace::Location.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28 19:46:44 +00:00
kosaki 9cbf473287 * vm_core.h (enum rb_thread_status): remove THREAD_TO_KILL
* vm_core.h (struct rb_thread_struct): add to_kill field
* thread.c (terminate_i): convert THREAD_TO_KILL to to_kill.
* thread.c (rb_threadptr_to_kill): ditto.
* thread.c (rb_thread_kill): ditto.
* thread.c (rb_thread_wakeup_alive): ditto.
* thread.c (thread_list_i): ditto.
* thread.c (static const char): ditto.
* thread.c (thread_status_name): ditto.
* thread.c (rb_thread_status): ditto.
* thread.c (rb_thread_inspect): ditto.
* vm_backtrace.c (thread_backtrace_to_ary): ditto.

* thread.c (rb_threadptr_execute_interrupts): fix thread status
  overwritten issue. [Bug #7450] [ruby-core:50249]

* test/ruby/test_thread.rb (test_hread_status_raise_after_kill):
  test for the above.
* test/ruby/test_thread.rb (test_thread_status_in_trap): test for
  thread status in trap.
* test/ruby/test_thread.rb (test_status_and_stop_p): remove
  Thread.control_interrupt unsafe test. Thread#kill no longer
  changes thread status. Instead of, Thread#kill receiver changes
  their own status when receiving kill signal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28 08:31:03 +00:00
nagachika 82b2436422 * vm_backtrace.c (vm_backtrace_to_ary): fix a typo of an variable name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19 13:31:26 +00:00
ko1 15d940b8b0 * thread.c: add `Thread#backtrace_locations' method.
This method is similart to `caller_locations' method for
  specific method.
  And fix to accept `level' and `n' parameters for `Thread#backtrace'
  and `Thread#backtrace_locations'.
  `caller' (and `caller_locations') do not return `caller' method
  frame.
  However, `Thread#backtrace' (and `Thread#backtrace_locations')
  return `Thread#backtrace' method frame itself
  if `Thread.current.backtrace' was called.
* vm_backtrace.c: ditto.
* internal.h: ditto.
* test/ruby/test_backtrace.rb: add tests.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19 06:07:06 +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
kazu 064b70b603 * vm_backtrace.c (backtrace_collect): rename from backtreace_collect
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-15 12:01:45 +00:00
ko1 745c23b2d9 * vm_core.h: remove VM_FRAME_MAGIC_FINISH (finish frame type).
Before this commit:
  `finish frame' was place holder which indicates that VM loop
  needs to return function.
  If a C method calls a Ruby methods (a method written by Ruby),
  then VM loop will be (re-)invoked.  When the Ruby method returns,
  then also VM loop should be escaped.  `finish frame' has only
  one instruction `finish', which returns VM loop function.
  VM loop function executes `finish' instruction, then VM loop
  function returns itself.
  With such mechanism, `leave' instruction (which returns one
  frame from current scope) doesn't need to check that this `leave'
  should also return from VM loop function.
  Strictly, one branch can be removed from `leave' instructon.
  Consideration:
  However, pushing the `finish frame' needs costs because
  it needs several memory accesses.  The number of pushing
  `finish frame' is greater than I had assumed.  Of course,
  pushing `finish frame' consumes additional control frame.
  Moreover, recent processors has good branch prediction,
  with which we can ignore such trivial checking.
  After this commit:
  Finally, I decide to remove `finish frame' and `finish'
  instruction.  Some parts of VM depend on `finish frame',
  so the new frame flag VM_FRAME_FLAG_FINISH is introduced.
  If this frame should escape from VM function loop, then
  the result of VM_FRAME_TYPE_FINISH_P(cfp) is true.
  `leave' instruction checks this flag every time.
  I measured performance on it.  However on my environments,
  it improves some benchmarks and slows some benchmarks down.
  Maybe it is because of C compiler optimization parameters.
  I'll re-visit here if this cause problems.
* insns.def (leave, finish): remove finish instruction.
* vm.c, vm_eval.c, vm_exec.c, vm_backtrace.c, vm_dump.c:
  apply above changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-15 10:22:34 +00:00
shyouhei 9b29e5f7e1 * compile.c (iseq_set_sequence): nonstatic initializer of an
aggregate type is a C99ism.

	* compile.c (enum compile_array_type_t): comma at the end of enum
	  list is a C99ism.

	* vm_backtrace.c (enum LOCATION_TYPE): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-11 02:57:02 +00:00
nobu 1102fd2f3e * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 22:44:01 +00:00
ko1 bac9f65f70 * vm_core.h (rb_location_t): fix type and field name.
(1) rename rb_location_t to rb_iseq_location_t.
  (2) rename field names of rb_iseq_location_t to adjust
  RubyVM::Backtrace::Location methods.
  (2-1) filename -> path
  (2-2) filepath -> absolute_path
  (2-3) basename -> base_label
  (2-4) name -> label
  (3) rename filed name rb_iseq_location_t#line_no to
  rb_iseq_location_t#first_lineno to clear purpose of this field.
  (4) The field names rb_binding_t#(filename|line_no) are also renamed
  to rb_binding_t#(path|first_lineno).
* compile.c: apply above changes.
* iseq.c: ditto.
* proc.c: ditto.
* vm*.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 02:49:37 +00:00
ko1 f6f769d26d * vm_backtrace.c: change names.
(1) Class name: RubyVM::FrameInfo -> RubyVM::Backtrace::Location.
  (2) Method name: RubyVM::FrameInfo.caller ->
  Kernel.caller_locations.
  (3) Instance methods of
  RubyVM::FrameInfo (RubyVM::Backtrace::Location)
  (3-1) name -> label
  (3-2) basename -> base_label (basename is confusing with
  File.basename)
  (3-3) line_no -> lineno (We have already similar name
  File#lineno, commented by kou [ruby-dev:45686]).
  (3-4) filename -> path.
  (3-5) filepath -> absolute_path.
  (3-5) iseq -> removed (we will make other APIs to access iseq
  and other information of frame for debugging).
* test/ruby/test_backtrace.rb: apply above changes.
  And apply comment from kou [ruby-dev:45686].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 16:46:08 +00:00
ko1 b57c81ae3e * common.mk: fix to build vm_backtrace.c only itself (vm_backtrace.c
is no longer included from vm.c).  I hope this separation reduce
  compile time of vm.c.
* internal.h: ditto.
* vm.c, vm_core.h, vm_dump.c, vm_eval.c: ditto.
* vm_eval.c: some functions (callee, etc) moved to vm_backtrace.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 15:59:37 +00:00
ko1 681d73a923 * vm_backtrace.c: added. Separate backtrace related functions to
this file.
* vm.c, common.mk: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 15:23:37 +00:00