Ruby  2.5.0dev(2017-10-22revision60238)
Macros | Enumerations | Functions
eval_intern.h File Reference
#include "ruby/ruby.h"
#include "vm_core.h"
#include <stdio.h>
#include <setjmp.h>
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
#include <sys/stat.h>

Go to the source code of this file.

Macros

#define PASS_PASSED_BLOCK_HANDLER_TH(th)   pass_passed_block_handler(th)
 
#define PASS_PASSED_BLOCK_HANDLER()   pass_passed_block_handler(GET_THREAD())
 
#define EXIT_SUCCESS   0
 
#define EXIT_FAILURE   1
 
#define ruby_setjmp(env)   RUBY_SETJMP(env)
 
#define ruby_longjmp(env, val)   RUBY_LONGJMP((env),(val))
 
#define SAVE_ROOT_JMPBUF_BEFORE_STMT
 
#define SAVE_ROOT_JMPBUF_AFTER_STMT
 
#define SAVE_ROOT_JMPBUF(th, stmt)
 
#define TH_PUSH_TAG(th)
 
#define TH_POP_TAG()
 
#define TH_TMPPOP_TAG()   _th->ec.tag = _tag.prev
 
#define TH_REPUSH_TAG()   (void)(_th->ec.tag = &_tag)
 
#define PUSH_TAG()   TH_PUSH_TAG(GET_THREAD())
 
#define POP_TAG()   TH_POP_TAG()
 
#define VAR_FROM_MEMORY(var)   (var)
 
#define VAR_INITIALIZED(var)   ((void)&(var))
 
#define VAR_NOCLOBBERED(var)   var
 
#define UNALIGNED_MEMBER_ACCESS(expr)   expr
 
#define UNALIGNED_MEMBER_PTR(ptr, mem)   UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
 
#define RB_OBJ_WRITE(a, slot, b)   UNALIGNED_MEMBER_ACCESS(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__))
 
#define TH_EXEC_TAG()   (ruby_setjmp(_tag.buf) ? rb_threadptr_tag_state(VAR_FROM_MEMORY(_th)) : (TH_REPUSH_TAG(), 0))
 
#define EXEC_TAG()   TH_EXEC_TAG()
 
#define TH_JUMP_TAG(th, st)   rb_threadptr_tag_jump(th, st)
 
#define JUMP_TAG(st)   TH_JUMP_TAG(GET_THREAD(), (st))
 
#define INTERNAL_EXCEPTION_P(exc)   FIXNUM_P(exc)
 
#define CREF_FL_PUSHED_BY_EVAL   IMEMO_FL_USER1
 
#define CREF_FL_OMOD_SHARED   IMEMO_FL_USER2
 
#define rb_thread_raised_set(th, f)   ((th)->ec.raised_flag |= (f))
 
#define rb_thread_raised_reset(th, f)   ((th)->ec.raised_flag &= ~(f))
 
#define rb_thread_raised_p(th, f)   (((th)->ec.raised_flag & (f)) != 0)
 
#define rb_thread_raised_clear(th)   ((th)->ec.raised_flag = 0)
 
#define CharNext(p)   ((p) + 1)
 

Enumerations

enum  { RAISED_EXCEPTION = 1, RAISED_STACKOVERFLOW = 2, RAISED_NOMEMORY = 4 }
 

Functions

char * strrchr (const char *, const char)
 
 NORETURN (static inline void rb_threadptr_tag_jump(rb_thread_t *, enum ruby_tag_type st))
 
void rb_thread_cleanup (void)
 
void rb_thread_wait_other_threads (void)
 
int rb_threadptr_set_raised (rb_thread_t *th)
 
int rb_threadptr_reset_raised (rb_thread_t *th)
 
int rb_threadptr_stack_check (rb_thread_t *th)
 
VALUE rb_f_eval (int argc, const VALUE *argv, VALUE self)
 
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. More...
 
 NORETURN (void rb_method_name_error(VALUE, VALUE))
 
 NORETURN (void rb_fiber_start(void))
 
 NORETURN (void rb_print_undef(VALUE, ID, rb_method_visibility_t))
 
 NORETURN (void rb_vm_localjump_error(const char *, VALUE, int))
 
 NORETURN (void rb_raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj, int call_status))
 
VALUE rb_vm_make_jump_tag_but_local_jump (int state, VALUE val)
 
rb_cref_trb_vm_cref (void)
 
rb_cref_trb_vm_cref_replace_with_duplicated_cref (void)
 
VALUE rb_vm_call_cfunc (VALUE recv, VALUE(*func)(VALUE), VALUE arg, VALUE block_handler, VALUE filename)
 
void rb_vm_set_progname (VALUE filename)
 
void rb_thread_terminate_all (void)
 
VALUE rb_vm_cbase (void)
 
VALUE rb_threadptr_backtrace_object (rb_thread_t *th)
 
VALUE rb_threadptr_backtrace_str_ary (rb_thread_t *th, long lev, long n)
 
VALUE rb_threadptr_backtrace_location_ary (rb_thread_t *th, long lev, long n)
 

Macro Definition Documentation

◆ CharNext

#define CharNext (   p)    ((p) + 1)

Definition at line 325 of file eval_intern.h.

◆ CREF_FL_OMOD_SHARED

#define CREF_FL_OMOD_SHARED   IMEMO_FL_USER2

Definition at line 213 of file eval_intern.h.

◆ CREF_FL_PUSHED_BY_EVAL

#define CREF_FL_PUSHED_BY_EVAL   IMEMO_FL_USER1

Definition at line 212 of file eval_intern.h.

◆ EXEC_TAG

#define EXEC_TAG ( )    TH_EXEC_TAG()

◆ EXIT_FAILURE

#define EXIT_FAILURE   1

◆ EXIT_SUCCESS

#define EXIT_SUCCESS   0

Definition at line 30 of file eval_intern.h.

◆ INTERNAL_EXCEPTION_P

#define INTERNAL_EXCEPTION_P (   exc)    FIXNUM_P(exc)

Definition at line 208 of file eval_intern.h.

◆ JUMP_TAG

#define JUMP_TAG (   st)    TH_JUMP_TAG(GET_THREAD(), (st))

Definition at line 206 of file eval_intern.h.

Referenced by rb_jump_tag(), and rb_require_safe().

◆ PASS_PASSED_BLOCK_HANDLER

#define PASS_PASSED_BLOCK_HANDLER ( )    pass_passed_block_handler(GET_THREAD())

Definition at line 24 of file eval_intern.h.

Referenced by rb_funcall_passing_block(), and rb_obj_call_init().

◆ PASS_PASSED_BLOCK_HANDLER_TH

#define PASS_PASSED_BLOCK_HANDLER_TH (   th)    pass_passed_block_handler(th)

Definition at line 23 of file eval_intern.h.

Referenced by rb_call_super().

◆ POP_TAG

#define POP_TAG ( )    TH_POP_TAG()

Definition at line 148 of file eval_intern.h.

Referenced by ruby_setup().

◆ PUSH_TAG

#define PUSH_TAG ( )    TH_PUSH_TAG(GET_THREAD())

Definition at line 147 of file eval_intern.h.

Referenced by rb_load_protect(), ruby_options(), and ruby_setup().

◆ RB_OBJ_WRITE

#define RB_OBJ_WRITE (   a,
  slot,
 
)    UNALIGNED_MEMBER_ACCESS(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__))

Definition at line 175 of file eval_intern.h.

Referenced by rb_iseq_pathobj_set(), and rb_proc_create_from_captured().

◆ rb_thread_raised_clear

#define rb_thread_raised_clear (   th)    ((th)->ec.raised_flag = 0)

Definition at line 288 of file eval_intern.h.

Referenced by rb_threadptr_error_print().

◆ rb_thread_raised_p

#define rb_thread_raised_p (   th,
  f 
)    (((th)->ec.raised_flag & (f)) != 0)

Definition at line 287 of file eval_intern.h.

◆ rb_thread_raised_reset

#define rb_thread_raised_reset (   th,
  f 
)    ((th)->ec.raised_flag &= ~(f))

Definition at line 286 of file eval_intern.h.

◆ rb_thread_raised_set

#define rb_thread_raised_set (   th,
  f 
)    ((th)->ec.raised_flag |= (f))

Definition at line 285 of file eval_intern.h.

◆ ruby_longjmp

#define ruby_longjmp (   env,
  val 
)    RUBY_LONGJMP((env),(val))

Definition at line 60 of file eval_intern.h.

◆ ruby_setjmp

#define ruby_setjmp (   env)    RUBY_SETJMP(env)

Definition at line 59 of file eval_intern.h.

◆ SAVE_ROOT_JMPBUF

#define SAVE_ROOT_JMPBUF (   th,
  stmt 
)
Value:
if (ruby_setjmp((th)->root_jmpbuf) == 0) { \
SAVE_ROOT_JMPBUF_BEFORE_STMT \
stmt; \
SAVE_ROOT_JMPBUF_AFTER_STMT \
} \
else { \
rb_fiber_start(); \
} while (0)
if(len<=MAX_WORD_LENGTH &&len >=MIN_WORD_LENGTH)
Definition: zonetab.h:883
#define ruby_setjmp(env)
Definition: eval_intern.h:59

Definition at line 121 of file eval_intern.h.

Referenced by ruby_cleanup(), and ruby_options().

◆ SAVE_ROOT_JMPBUF_AFTER_STMT

#define SAVE_ROOT_JMPBUF_AFTER_STMT

Definition at line 118 of file eval_intern.h.

◆ SAVE_ROOT_JMPBUF_BEFORE_STMT

#define SAVE_ROOT_JMPBUF_BEFORE_STMT

Definition at line 117 of file eval_intern.h.

◆ TH_EXEC_TAG

#define TH_EXEC_TAG ( )    (ruby_setjmp(_tag.buf) ? rb_threadptr_tag_state(VAR_FROM_MEMORY(_th)) : (TH_REPUSH_TAG(), 0))

Definition at line 198 of file eval_intern.h.

Referenced by rb_eval_cmd(), rb_thread_terminate_all(), and rb_threadptr_error_print().

◆ TH_JUMP_TAG

#define TH_JUMP_TAG (   th,
  st 
)    rb_threadptr_tag_jump(th, st)

◆ TH_POP_TAG

#define TH_POP_TAG ( )
Value:
_th->ec.tag = _tag.prev; \
} while (0)

Definition at line 138 of file eval_intern.h.

Referenced by rb_fiber_start(), rb_postponed_job_flush(), and rb_thread_io_blocking_region().

◆ TH_PUSH_TAG

#define TH_PUSH_TAG (   th)
Value:
do { \
rb_thread_t * const _th = (th); \
struct rb_vm_tag _tag; \
_tag.state = TAG_NONE; \
_tag.tag = Qundef; \
_tag.prev = _th->ec.tag;
enum ruby_tag_type state
Definition: vm_core.h:701
#define TAG_NONE
Definition: vm_core.h:164
#define Qundef
Definition: ruby.h:439

Definition at line 131 of file eval_intern.h.

Referenced by rb_eval_cmd(), rb_exec_end_proc(), rb_fiber_start(), rb_postponed_job_flush(), rb_require_internal(), rb_thread_io_blocking_region(), rb_thread_terminate_all(), rb_threadptr_error_print(), and ruby_cleanup().

◆ TH_REPUSH_TAG

#define TH_REPUSH_TAG ( )    (void)(_th->ec.tag = &_tag)

Definition at line 145 of file eval_intern.h.

◆ TH_TMPPOP_TAG

#define TH_TMPPOP_TAG ( )    _th->ec.tag = _tag.prev

Definition at line 142 of file eval_intern.h.

◆ UNALIGNED_MEMBER_ACCESS

#define UNALIGNED_MEMBER_ACCESS (   expr)    expr

Definition at line 170 of file eval_intern.h.

◆ UNALIGNED_MEMBER_PTR

#define UNALIGNED_MEMBER_PTR (   ptr,
  mem 
)    UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)

Definition at line 172 of file eval_intern.h.

◆ VAR_FROM_MEMORY

#define VAR_FROM_MEMORY (   var)    (var)

Definition at line 155 of file eval_intern.h.

Referenced by rb_fiber_start().

◆ VAR_INITIALIZED

#define VAR_INITIALIZED (   var)    ((void)&(var))

Definition at line 156 of file eval_intern.h.

◆ VAR_NOCLOBBERED

#define VAR_NOCLOBBERED (   var)    var

Definition at line 157 of file eval_intern.h.

Referenced by rb_eval_cmd().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RAISED_EXCEPTION 
RAISED_STACKOVERFLOW 
RAISED_NOMEMORY 

Definition at line 278 of file eval_intern.h.

Function Documentation

◆ NORETURN() [1/6]

NORETURN ( static inline void   rb_threadptr_tag_jumprb_thread_t *, enum ruby_tag_type st)

◆ NORETURN() [2/6]

NORETURN ( void   rb_method_name_errorVALUE, VALUE)

◆ NORETURN() [3/6]

NORETURN ( void   rb_fiber_startvoid)

◆ NORETURN() [4/6]

NORETURN ( void   rb_print_undefVALUE, ID, rb_method_visibility_t)

◆ NORETURN() [5/6]

NORETURN ( void   rb_vm_localjump_errorconst char *, VALUE, int)

◆ NORETURN() [6/6]

NORETURN ( void   rb_raise_method_missingrb_thread_t *th, int argc, const VALUE *argv, VALUE obj, int call_status)

◆ rb_f_eval()

VALUE rb_f_eval ( int  argc,
const VALUE argv,
VALUE  self 
)

Definition at line 1385 of file vm_eval.c.

References NIL_P, NUM2INT, Qundef, rb_scan_args(), SafeStringValue, and StringValue.

Referenced by Init_vm_eval().

◆ rb_thread_cleanup()

void rb_thread_cleanup ( void  )

◆ rb_thread_terminate_all()

void rb_thread_terminate_all ( void  )

◆ rb_thread_wait_other_threads()

void rb_thread_wait_other_threads ( void  )

◆ rb_threadptr_backtrace_location_ary()

VALUE rb_threadptr_backtrace_location_ary ( rb_thread_t th,
long  lev,
long  n 
)

Definition at line 659 of file vm_backtrace.c.

◆ rb_threadptr_backtrace_object()

VALUE rb_threadptr_backtrace_object ( rb_thread_t th)

Definition at line 515 of file vm_backtrace.c.

References bt_iter_arg::prev_loc.

◆ rb_threadptr_backtrace_str_ary()

VALUE rb_threadptr_backtrace_str_ary ( rb_thread_t th,
long  lev,
long  n 
)

Definition at line 653 of file vm_backtrace.c.

Referenced by rb_make_backtrace().

◆ rb_threadptr_reset_raised()

int rb_threadptr_reset_raised ( rb_thread_t th)

◆ rb_threadptr_set_raised()

int rb_threadptr_set_raised ( rb_thread_t th)

◆ rb_threadptr_stack_check()

int rb_threadptr_stack_check ( rb_thread_t th)

Definition at line 4047 of file gc.c.

◆ rb_vm_call_cfunc()

VALUE rb_vm_call_cfunc ( VALUE  recv,
VALUE(*)(VALUE func,
VALUE  arg,
VALUE  block_handler,
VALUE  filename 
)

◆ rb_vm_cbase()

VALUE rb_vm_cbase ( void  )

◆ rb_vm_cref()

rb_cref_t* rb_vm_cref ( void  )

◆ rb_vm_cref_replace_with_duplicated_cref()

rb_cref_t* rb_vm_cref_replace_with_duplicated_cref ( void  )

◆ rb_vm_make_jump_tag_but_local_jump()

VALUE rb_vm_make_jump_tag_but_local_jump ( int  state,
VALUE  val 
)

Definition at line 1421 of file vm.c.

References GET_THREAD, Qnil, Qundef, TAG_BREAK, TAG_NEXT, TAG_REDO, TAG_RETRY, and TAG_RETURN.

Referenced by rb_fiber_start().

◆ rb_vm_set_progname()

void rb_vm_set_progname ( VALUE  filename)

◆ strrchr()

char* strrchr ( const char *  ,
const char   
)

Referenced by rb_feature_provided().