1 #ifndef RUBY_EVAL_INTERN_H 2 #define RUBY_EVAL_INTERN_H 10 vm_block_handler_verify(block_handler);
18 vm_block_handler_verify(block_handler);
19 vm_passed_block_handler_set(th, block_handler);
23 #define PASS_PASSED_BLOCK_HANDLER_TH(th) pass_passed_block_handler(th) 24 #define PASS_PASSED_BLOCK_HANDLER() pass_passed_block_handler(GET_THREAD()) 30 #define EXIT_SUCCESS 0 33 #define EXIT_FAILURE 1 40 # ifdef HAVE_CRT_EXTERNS_H 48 char *
strrchr(
const char *,
const char);
55 #ifdef HAVE_NET_SOCKET_H 56 #include <net/socket.h> 59 #define ruby_setjmp(env) RUBY_SETJMP(env) 60 #define ruby_longjmp(env,val) RUBY_LONGJMP((env),(val)) 66 NORETURN(
void _longjmp(jmp_buf,
int));
70 #include <sys/types.h> 74 #ifdef HAVE_SYS_SELECT_H 75 #include <sys/select.h> 84 #ifdef HAVE_SELECT_LARGE_FDSET 85 #define select(n, r, w, e, t) select_large_fdset((n), (r), (w), (e), (t)) 86 extern int select_large_fdset(
int, fd_set *, fd_set *, fd_set *,
struct timeval *);
89 #ifdef HAVE_SYS_PARAM_H 90 #include <sys/param.h> 96 #define SAVE_ROOT_JMPBUF_BEFORE_STMT \ 98 #define SAVE_ROOT_JMPBUF_AFTER_STMT \ 100 __except (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW ? \ 101 (rb_thread_raised_set(GET_THREAD(), RAISED_STACKOVERFLOW), \ 103 EXCEPTION_EXECUTE_HANDLER) : \ 104 EXCEPTION_CONTINUE_SEARCH) { \ 107 #elif defined(__MINGW32__) 108 LONG WINAPI rb_w32_stack_overflow_handler(
struct _EXCEPTION_POINTERS *);
109 #define SAVE_ROOT_JMPBUF_BEFORE_STMT \ 111 PVOID _handler = AddVectoredExceptionHandler(1, rb_w32_stack_overflow_handler); 113 #define SAVE_ROOT_JMPBUF_AFTER_STMT \ 114 RemoveVectoredExceptionHandler(_handler); \ 117 #define SAVE_ROOT_JMPBUF_BEFORE_STMT 118 #define SAVE_ROOT_JMPBUF_AFTER_STMT 121 #define SAVE_ROOT_JMPBUF(th, stmt) do \ 122 if (ruby_setjmp((th)->root_jmpbuf) == 0) { \ 123 SAVE_ROOT_JMPBUF_BEFORE_STMT \ 125 SAVE_ROOT_JMPBUF_AFTER_STMT \ 131 #define TH_PUSH_TAG(th) do { \ 132 rb_thread_t * const _th = (th); \ 133 struct rb_vm_tag _tag; \ 134 _tag.state = TAG_NONE; \ 136 _tag.prev = _th->ec.tag; 138 #define TH_POP_TAG() \ 139 _th->ec.tag = _tag.prev; \ 142 #define TH_TMPPOP_TAG() \ 143 _th->ec.tag = _tag.prev 145 #define TH_REPUSH_TAG() (void)(_th->ec.tag = &_tag) 147 #define PUSH_TAG() TH_PUSH_TAG(GET_THREAD()) 148 #define POP_TAG() TH_POP_TAG() 150 #if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) 151 # define VAR_FROM_MEMORY(var) __extension__(*(__typeof__(var) volatile *)&(var)) 152 # define VAR_INITIALIZED(var) ((var) = VAR_FROM_MEMORY(var)) 153 # define VAR_NOCLOBBERED(var) volatile var 155 # define VAR_FROM_MEMORY(var) (var) 156 # define VAR_INITIALIZED(var) ((void)&(var)) 157 # define VAR_NOCLOBBERED(var) var 160 #if defined(USE_UNALIGNED_MEMBER_ACCESS) && USE_UNALIGNED_MEMBER_ACCESS && \ 162 # define UNALIGNED_MEMBER_ACCESS(expr) __extension__({ \ 163 _Pragma("GCC diagnostic push"); \ 164 _Pragma("GCC diagnostic ignored \"-Waddress-of-packed-member\""); \ 165 typeof(expr) unaligned_member_access_result = (expr); \ 166 _Pragma("GCC diagnostic pop"); \ 167 unaligned_member_access_result; \ 170 # define UNALIGNED_MEMBER_ACCESS(expr) expr 172 #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem) 175 #define RB_OBJ_WRITE(a, slot, b) UNALIGNED_MEMBER_ACCESS(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__)) 198 #define TH_EXEC_TAG() \ 199 (ruby_setjmp(_tag.buf) ? rb_threadptr_tag_state(VAR_FROM_MEMORY(_th)) : (TH_REPUSH_TAG(), 0)) 204 #define TH_JUMP_TAG(th, st) rb_threadptr_tag_jump(th, st) 206 #define JUMP_TAG(st) TH_JUMP_TAG(GET_THREAD(), (st)) 208 #define INTERNAL_EXCEPTION_P(exc) FIXNUM_P(exc) 212 #define CREF_FL_PUSHED_BY_EVAL IMEMO_FL_USER1 213 #define CREF_FL_OMOD_SHARED IMEMO_FL_USER2 246 CREF_PUSHED_BY_EVAL(
const rb_cref_t *cref)
285 #define rb_thread_raised_set(th, f) ((th)->ec.raised_flag |= (f)) 286 #define rb_thread_raised_reset(th, f) ((th)->ec.raised_flag &= ~(f)) 287 #define rb_thread_raised_p(th, f) (((th)->ec.raised_flag & (f)) != 0) 288 #define rb_thread_raised_clear(th) ((th)->ec.raised_flag = 0) 303 NORETURN(
void rb_vm_jump_tag_but_local_jump(
int));
306 VALUE obj,
int call_status));
323 # define CharNext(p) ((p) + mblen((p), RUBY_MBCHAR_MAXSIZE)) 325 # define CharNext(p) ((p) + 1) 329 #if defined DOSISH || defined __CYGWIN__ 331 translit_char(
char *p,
int from,
int to)
334 if ((
unsigned char)*p == from)
VALUE passed_block_handler
#define ruby_longjmp(env, val)
void rb_print_undef(VALUE klass, ID id, rb_method_visibility_t visi)
#define CREF_FL_PUSHED_BY_EVAL
VALUE rb_threadptr_backtrace_object(rb_thread_t *th)
VALUE rb_vm_call_cfunc(VALUE recv, VALUE(*func)(VALUE), VALUE arg, VALUE block_handler, VALUE filename)
#define CREF_FL_OMOD_SHARED
void rb_print_undef_str(VALUE klass, VALUE name)
void rb_vm_localjump_error(const char *mesg, VALUE value, int reason)
void rb_method_name_error(VALUE klass, VALUE str)
VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self)
VALUE rb_threadptr_backtrace_str_ary(rb_thread_t *th, long lev, long n)
void rb_thread_terminate_all(void)
const rb_scope_visibility_t scope_visi
struct rb_cref_struct *const next
int rb_threadptr_set_raised(rb_thread_t *th)
void rb_print_inaccessible(VALUE klass, ID id, rb_method_visibility_t visi)
void rb_fiber_start(void)
rb_cref_t * rb_vm_cref_replace_with_duplicated_cref(void)
void rb_thread_cleanup(void)
void rb_thread_wait_other_threads(void)
void rb_raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj, int call_status)
NORETURN(static inline void rb_threadptr_tag_jump(rb_thread_t *, enum ruby_tag_type st))
VALUE rb_make_exception(int argc, const VALUE *argv)
Make an Exception object from the list of arguments in a manner similar to Kernel#raise.
int rb_threadptr_reset_raised(rb_thread_t *th)
#define RB_OBJ_WRITE(a, slot, b)
VALUE rb_vm_frame_block_handler(const rb_control_frame_t *cfp)
VALUE rb_threadptr_backtrace_location_ary(rb_thread_t *th, long lev, long n)
void rb_vm_set_progname(VALUE filename)
rb_execution_context_t ec
int rb_threadptr_stack_check(rb_thread_t *th)
VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val)
rb_cref_t * rb_vm_cref(void)
char * strrchr(const char *, const char)