Ruby
2.7.1p83(2020-03-31revisiona0c7c23c9cec0d0ffcba012279cd652d28ad5bf3)
|
#include "internal.h"
#include "vm_core.h"
#include "gc.h"
#include "eval_intern.h"
#include "mjit.h"
#include <unistd.h>
#include <sys/mman.h>
Go to the source code of this file.
Data Structures | |
struct | cont_saved_vm_stack |
struct | fiber_pool_stack |
struct | fiber_pool_vacancy |
struct | fiber_pool_allocation |
struct | fiber_pool |
struct | rb_context_struct |
struct | rb_fiber_struct |
Macros | |
#define | RB_PAGE_SIZE (pagesize) |
#define | RB_PAGE_MASK (~(RB_PAGE_SIZE - 1)) |
#define | CAPTURE_JUST_VALID_VM_STACK 1 |
#define | FIBER_POOL_INITIAL_SIZE 32 |
#define | FIBER_POOL_ALLOCATION_MAXIMUM_SIZE 1024 |
#define | FIBER_CREATED_P(fiber) ((fiber)->status == FIBER_CREATED) |
#define | FIBER_RESUMED_P(fiber) ((fiber)->status == FIBER_RESUMED) |
#define | FIBER_SUSPENDED_P(fiber) ((fiber)->status == FIBER_SUSPENDED) |
#define | FIBER_TERMINATED_P(fiber) ((fiber)->status == FIBER_TERMINATED) |
#define | FIBER_RUNNABLE_P(fiber) (FIBER_CREATED_P(fiber) || FIBER_SUSPENDED_P(fiber)) |
#define | FIBER_STACK_FLAGS (MAP_PRIVATE | MAP_ANON) |
#define | ERRNOMSG strerror(errno) |
#define | THREAD_MUST_BE_RUNNING(th) |
#define | STACK_PAD_SIZE 1024 |
#define | PASS_KW_SPLAT (rb_empty_keyword_given_p() ? RB_PASS_EMPTY_KEYWORDS : rb_keyword_given_p()) |
Typedefs | |
typedef struct rb_context_struct | rb_context_t |
typedef VALUE | e_proc(VALUE) |
Enumerations | |
enum | context_type { CONTINUATION_CONTEXT = 0, FIBER_CONTEXT = 1 } |
enum | fiber_status { FIBER_CREATED, FIBER_RESUMED, FIBER_SUSPENDED, FIBER_TERMINATED } |
#define FIBER_CREATED_P | ( | fiber | ) | ((fiber)->status == FIBER_CREATED) |
#define FIBER_RESUMED_P | ( | fiber | ) | ((fiber)->status == FIBER_RESUMED) |
#define FIBER_RUNNABLE_P | ( | fiber | ) | (FIBER_CREATED_P(fiber) || FIBER_SUSPENDED_P(fiber)) |
#define FIBER_SUSPENDED_P | ( | fiber | ) | ((fiber)->status == FIBER_SUSPENDED) |
#define FIBER_TERMINATED_P | ( | fiber | ) | ((fiber)->status == FIBER_TERMINATED) |
#define PASS_KW_SPLAT (rb_empty_keyword_given_p() ? RB_PASS_EMPTY_KEYWORDS : rb_keyword_given_p()) |
#define RB_PAGE_MASK (~(RB_PAGE_SIZE - 1)) |
#define STACK_PAD_SIZE 1024 |
#define THREAD_MUST_BE_RUNNING | ( | th | ) |
typedef struct rb_context_struct rb_context_t |
enum context_type |
enum fiber_status |
Definition at line 2422 of file cont.c.
References rb_vm_struct::default_params, rb_vm_struct::fiber_machine_stack_size, rb_vm_struct::fiber_vm_stack_size, GET_THREAD, rb_thread_struct::vm, and fiber_pool::vm_stack_size.
NOINLINE | ( | NORETURN(static void cont_restore_1(rb_context_t *)) | ) |
NOINLINE | ( | static VALUE | cont_capturevolatile int *volatile stat | ) |
NOINLINE | ( | static void | fiber_setcontextrb_fiber_t *new_fiber, rb_fiber_t *old_fiber | ) |
NORETURN | ( | NOINLINE(static void cont_restore_0(rb_context_t *, VALUE *)) | ) |
Definition at line 2152 of file cont.c.
References FIBER_TERMINATED_P.
void rb_fiber_close | ( | rb_fiber_t * | fiber | ) |
void rb_fiber_init_mjit_cont | ( | struct rb_fiber_struct * | fiber | ) |
void rb_fiber_mark_self | ( | const rb_fiber_t * | fiber | ) |
Definition at line 972 of file cont.c.
References rb_fiber_struct::cont, rb_execution_context_mark(), rb_gc_mark_movable(), rb_context_struct::saved_ec, and rb_context_struct::self.
VALUE rb_fiber_new | ( | rb_block_call_func_t | func, |
VALUE | obj | ||
) |
void rb_fiber_reset_root_local_storage | ( | rb_thread_t * | th | ) |
Definition at line 2135 of file cont.c.
References rb_fiber_struct::cont, rb_thread_struct::ec, rb_execution_context_struct::fiber_ptr, rb_execution_context_struct::local_storage, rb_thread_struct::root_fiber, and rb_context_struct::saved_ec.
Referenced by ruby_vm_destruct().
Definition at line 2117 of file cont.c.
References argc, argv, rb_fiber_resume_kw(), and RB_NO_KEYWORDS.
Definition at line 2097 of file cont.c.
Referenced by rb_fiber_resume().
Definition at line 1805 of file cont.c.
References rb_context_struct::argc, argc, argv, rb_thread_struct::ec, EC_EXEC_TAG, EC_POP_TAG, EC_PUSH_TAG, err, rb_execution_context_struct::errinfo, EXEC_EVENT_HOOK, rb_execution_context_struct::fiber_ptr, FIBER_RESUMED_P, rb_fiber_struct::first_proc, GET_THREAD, GetProcPtr, rb_context_struct::kw_splat, NIL_P, Qfalse, Qnil, RARRAY_CONST_PTR, rb_adjust_argv_kw_splat(), rb_threadptr_pending_interrupt_enque(), rb_vm_invoke_proc(), rb_vm_make_jump_tag_but_local_jump(), rb_vm_proc_local_ep(), rb_execution_context_struct::root_lep, rb_execution_context_struct::root_svar, ruby_current_execution_context_ptr, RUBY_EVENT_FIBER_SWITCH, rb_thread_struct::self, TAG_FATAL, TAG_NONE, TAG_RAISE, TRUE, rb_context_struct::value, VAR_FROM_MEMORY, VM_ASSERT, and VM_BLOCK_HANDLER_NONE.
void rb_fiber_update_self | ( | rb_fiber_t * | fiber | ) |
Definition at line 961 of file cont.c.
References rb_fiber_struct::cont, rb_execution_context_update(), rb_gc_location(), rb_context_struct::saved_ec, and rb_context_struct::self.
Definition at line 1041 of file cont.c.
References obj, and rb_typeddata_is_kind_of().
void rb_threadptr_root_fiber_release | ( | rb_thread_t * | th | ) |
Definition at line 1895 of file cont.c.
References rb_fiber_struct::cont, rb_thread_struct::ec, FIBER_CONTEXT, rb_execution_context_struct::fiber_ptr, rb_thread_struct::root_fiber, rb_context_struct::self, rb_context_struct::type, and VM_ASSERT.
void rb_threadptr_root_fiber_setup | ( | rb_thread_t * | th | ) |
Definition at line 1880 of file cont.c.
References rb_fiber_struct::cont, errno, FIBER_CONTEXT, rb_execution_context_struct::fiber_ptr, MEMZERO, rb_bug(), ruby_mimmalloc(), rb_context_struct::saved_ec, strerror(), rb_execution_context_struct::thread_ptr, and rb_context_struct::type.
void rb_threadptr_root_fiber_terminate | ( | rb_thread_t * | th | ) |
Definition at line 1913 of file cont.c.
References rb_thread_struct::ec, rb_execution_context_struct::fiber_ptr, FIBER_TERMINATED, and rb_ec_clear_vm_stack().
RUBY_SYMBOL_EXPORT_BEGIN void ruby_Init_Continuation_body | ( | void | ) |
Definition at line 2465 of file cont.c.
Referenced by Init_continuation().
Definition at line 1535 of file cont.c.
References GET_VM, NULL, st_init_numtable(), st_insert(), and UNLIKELY.