[前][次][番号順一覧][スレッド一覧]

ruby-changes:48336

From: ko1 <ko1@a...>
Date: Thu, 26 Oct 2017 20:06:00 +0900 (JST)
Subject: [ruby-changes:48336] ko1:r60449 (trunk): backtrace_each() accepts `ec` instead of `th`.

ko1	2017-10-26 19:57:16 +0900 (Thu, 26 Oct 2017)

  New Revision: 60449

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60449

  Log:
    backtrace_each() accepts `ec` instead of `th`.
    
    * vm_backtrace.c (backtrace_each): accepts `ec` instead of `th`.

  Modified files:
    trunk/vm_backtrace.c
Index: vm_backtrace.c
===================================================================
--- vm_backtrace.c	(revision 60448)
+++ vm_backtrace.c	(revision 60449)
@@ -421,14 +421,14 @@ backtrace_alloc(VALUE klass) https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L421
 }
 
 static void
-backtrace_each(rb_thread_t *th,
+backtrace_each(const rb_execution_context_t *ec,
 	       void (*init)(void *arg, size_t size),
 	       void (*iter_iseq)(void *arg, const rb_control_frame_t *cfp),
 	       void (*iter_cfunc)(void *arg, const rb_control_frame_t *cfp, ID mid),
 	       void *arg)
 {
-    const rb_control_frame_t *last_cfp = th->ec->cfp;
-    const rb_control_frame_t *start_cfp = RUBY_VM_END_CONTROL_FRAME(th->ec);
+    const rb_control_frame_t *last_cfp = ec->cfp;
+    const rb_control_frame_t *start_cfp = RUBY_VM_END_CONTROL_FRAME(ec);
     const rb_control_frame_t *cfp;
     ptrdiff_t size, i;
 
@@ -439,7 +439,7 @@ backtrace_each(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L439
      *  top frame
      *  ...
      *  2nd frame     <- lev:0
-     *  current frame <- th->ec->cfp
+     *  current frame <- ec->cfp
      */
 
     start_cfp =
@@ -457,7 +457,7 @@ backtrace_each(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L457
 
     /* SDR(); */
     for (i=0, cfp = start_cfp; i<size; i++, cfp = RUBY_VM_NEXT_CONTROL_FRAME(cfp)) {
-	/* fprintf(stderr, "cfp: %d\n", (rb_control_frame_t *)(th->stack + th->stack_size) - cfp); */
+	/* fprintf(stderr, "cfp: %d\n", (rb_control_frame_t *)(ec->vm_stack + ec->vm_stack_size) - cfp); */
 	if (cfp->iseq) {
 	    if (cfp->pc) {
 		iter_iseq(arg, cfp);
@@ -517,7 +517,7 @@ rb_threadptr_backtrace_object(rb_thread_ https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L517
     struct bt_iter_arg arg;
     arg.prev_loc = 0;
 
-    backtrace_each(th,
+    backtrace_each(th->ec,
 		   bt_init,
 		   bt_iter_iseq,
 		   bt_iter_cfunc,
@@ -726,7 +726,7 @@ vm_backtrace_print(FILE *fp) https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L726
 
     arg.func = oldbt_print;
     arg.data = (void *)fp;
-    backtrace_each(GET_THREAD(),
+    backtrace_each(GET_EC(),
 		   oldbt_init,
 		   oldbt_iter_iseq,
 		   oldbt_iter_cfunc,
@@ -759,7 +759,7 @@ rb_backtrace_print_as_bugreport(void) https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L759
     arg.func = oldbt_bugreport;
     arg.data = (int *)&i;
 
-    backtrace_each(GET_THREAD(),
+    backtrace_each(GET_EC(),
 		   oldbt_init,
 		   oldbt_iter_iseq,
 		   oldbt_iter_cfunc,
@@ -802,7 +802,7 @@ rb_backtrace_each(VALUE (*iter)(VALUE re https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L802
     parg.output = output;
     arg.func = oldbt_print_to;
     arg.data = &parg;
-    backtrace_each(GET_THREAD(),
+    backtrace_each(GET_EC(),
 		   oldbt_init,
 		   oldbt_iter_iseq,
 		   oldbt_iter_cfunc,
@@ -1141,7 +1141,7 @@ collect_caller_bindings(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L1141
 
     data.ary = rb_ary_new();
 
-    backtrace_each(th,
+    backtrace_each(th->ec,
 		   collect_caller_bindings_init,
 		   collect_caller_bindings_iseq,
 		   collect_caller_bindings_cfunc,

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]