Skip to content

Commit 837fd5e

Browse files
committed
Use rb_execution_context_t instead of rb_thread_t
to represent execution context [Feature #14038] * vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer. There are many code using `th` to represent execution context (such as cfp, VM stack and so on). To access `ec`, they need to use `th->ec->...` (adding one indirection) so that we need to replace them by passing `ec` instead of `th`. * vm_core.h (GET_EC()): introduced to access current ec. Also remove `ruby_current_thread` global variable. * cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of rb_context_t::thread_value. * cont.c (ec_set_vm_stack): added to update vm_stack explicitly. * cont.c (ec_switch): added to switch ec explicitly. * cont.c (rb_fiber_close): added to terminate fibers explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 07f04f4 commit 837fd5e

32 files changed

+742
-575
lines changed

.gdbinit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,8 +1119,8 @@ define rb_ps_thread
11191119
set $ps_thread_th = (rb_thread_t*)$ps_thread->data
11201120
printf "* #<Thread:%p rb_thread_t:%p native_thread:%p>\n", \
11211121
$ps_thread, $ps_thread_th, $ps_thread_th->thread_id
1122-
set $cfp = $ps_thread_th->ec.cfp
1123-
set $cfpend = (rb_control_frame_t *)($ps_thread_th->ec.vm_stack + $ps_thread_th->ec.vm_stack_size)-1
1122+
set $cfp = $ps_thread_th->ec->cfp
1123+
set $cfpend = (rb_control_frame_t *)($ps_thread_th->ec->vm_stack + $ps_thread_th->ec.vm_stack_size)-1
11241124
while $cfp < $cfpend
11251125
if $cfp->iseq
11261126
if !((VALUE)$cfp->iseq & RUBY_IMMEDIATE_MASK) && (((imemo_ifunc << RUBY_FL_USHIFT) | RUBY_T_IMEMO)==$cfp->iseq->flags & ((RUBY_IMEMO_MASK << RUBY_FL_USHIFT) | RUBY_T_MASK))

compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7604,7 +7604,7 @@ caller_location(VALUE *path, VALUE *realpath)
76047604
{
76057605
const rb_thread_t *const th = GET_THREAD();
76067606
const rb_control_frame_t *const cfp =
7607-
rb_vm_get_ruby_level_next_cfp(th, th->ec.cfp);
7607+
rb_vm_get_ruby_level_next_cfp(th, th->ec->cfp);
76087608

76097609
if (cfp) {
76107610
int line = rb_vm_get_sourceline(cfp);

0 commit comments

Comments
 (0)