w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

vm.c File Reference
#include <stddef.h>
#include <stdarg.h>
#include <math.h>
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/class.h>
#include <mruby/hash.h>
#include <mruby/irep.h>
#include <mruby/numeric.h>
#include <mruby/proc.h>
#include <mruby/range.h>
#include <mruby/string.h>
#include <mruby/variable.h>
#include <mruby/error.h>
#include <mruby/opcode.h>
#include "value_array.h"
#include <mruby/throw.h>
#include <mruby/dump.h>
#include <mruby/presym.h>
Include dependency graph for vm.c:

Go to the source code of this file.

Macros

#define STACK_INIT_SIZE   128
 
#define CALLINFO_INIT_SIZE   32
 
#define MRB_STACK_GROWTH   128
 
#define MRB_FUNCALL_DEPTH_MAX   512
 
#define MRB_STACK_MAX   (0x40000 - MRB_STACK_GROWTH)
 
#define DEBUG(x)
 
#define CALL_MAXARGS   127
 
#define CI_ACC_SKIP   -1
 
#define CI_ACC_DIRECT   -2
 
#define CI_ACC_RESUMED   -3
 
#define MRB_FUNCALL_ARGC_MAX   16
 
#define MRB_CATCH_FILTER_RESCUE   (UINT32_C(1) << MRB_CATCH_RESCUE)
 
#define MRB_CATCH_FILTER_ENSURE   (UINT32_C(1) << MRB_CATCH_ENSURE)
 
#define MRB_CATCH_FILTER_ALL   (MRB_CATCH_FILTER_RESCUE | MRB_CATCH_FILTER_ENSURE)
 
#define catch_cover_p(pc, beg, end)   ((pc) > (ptrdiff_t)(beg) && (pc) <= (ptrdiff_t)(end))
 
#define THROW_TAGGED_BREAK(mrb, tag, proc, val)
 
#define UNWIND_ENSURE(mrb, ci, pc, tag, proc, val)
 
#define CHECKPOINT_LABEL_MAKE(tag)   L_CHECKPOINT_ ## tag
 
#define CHECKPOINT_RESTORE(tag)
 
#define CHECKPOINT_MAIN(tag)
 
#define CHECKPOINT_END(tag)
 
#define CODE_FETCH_HOOK(mrb, irep, pc, regs)
 
#define BYTECODE_DECODER(x)   (x)
 
#define INIT_DISPATCH   for (;;) { insn = BYTECODE_DECODER(*pc); CODE_FETCH_HOOK(mrb, irep, pc, regs); switch (insn) {
 
#define CASE(insn, ops)   case insn: pc++; FETCH_ ## ops (); mrb->c->ci->pc = pc;
 
#define NEXT   goto L_END_DISPATCH
 
#define JUMP   NEXT
 
#define END_DISPATCH   L_END_DISPATCH:;}}
 
#define regs   (mrb->c->ci->stack)
 
#define DISPATCH_CHECKPOINTS(n, i)   case n: goto CHECKPOINT_LABEL_MAKE(n);
 
#define TYPES2(a, b)   ((((uint16_t)(a))<<8)|(((uint16_t)(b))&0xff))
 
#define OP_MATH(op_name)
 
#define OP_MATH_CASE_INTEGER(op_name)
 
#define OP_MATH_CASE_FLOAT(op_name, t1, t2)
 
#define OP_MATH_OVERFLOW_INT()   goto L_INT_OVERFLOW
 
#define OP_MATH_CASE_STRING_add()
 
#define OP_MATH_CASE_STRING_sub()   (void)0
 
#define OP_MATH_CASE_STRING_mul()   (void)0
 
#define OP_MATH_OP_add   +
 
#define OP_MATH_OP_sub   -
 
#define OP_MATH_OP_mul   *
 
#define OP_MATH_TT_integer   MRB_TT_INTEGER
 
#define OP_MATH_TT_float   MRB_TT_FLOAT
 
#define OP_MATHI(op_name)
 
#define OP_MATHI_CASE_INTEGER(op_name)
 
#define OP_MATHI_CASE_FLOAT(op_name)
 
#define OP_CMP_BODY(op, v1, v2)   (v1(regs[a]) op v2(regs[a+1]))
 
#define OP_CMP(op, sym)
 

Enumerations

enum  localjump_error_kind { LOCALJUMP_ERROR_RETURN = 0 , LOCALJUMP_ERROR_BREAK = 1 , LOCALJUMP_ERROR_YIELD = 2 }
 

Functions

static void mrb_gc_arena_shrink (mrb_state *mrb, int idx)
 
void mrb_method_missing (mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args)
 
static void stack_clear (mrb_value *from, size_t count)
 
static void stack_copy (mrb_value *dst, const mrb_value *src, size_t size)
 
static void stack_init (mrb_state *mrb)
 
static void envadjust (mrb_state *mrb, mrb_value *oldbase, mrb_value *newbase, size_t oldsize)
 
static void stack_extend_alloc (mrb_state *mrb, mrb_int room)
 
void mrb_stack_extend (mrb_state *mrb, mrb_int room)
 
static struct REnvuvenv (mrb_state *mrb, mrb_int up)
 
static const struct RProctop_proc (mrb_state *mrb, const struct RProc *proc)
 
static mrb_callinfocipush (mrb_state *mrb, mrb_int push_stacks, mrb_int acc, struct RClass *target_class, const struct RProc *proc, mrb_sym mid, mrb_int argc)
 
void mrb_env_unshare (mrb_state *mrb, struct REnv *e)
 
static mrb_callinfocipop (mrb_state *mrb)
 
void mrb_exc_set (mrb_state *mrb, mrb_value exc)
 
static mrb_value mrb_run (mrb_state *mrb, const struct RProc *proc, mrb_value self)
 
mrb_value mrb_funcall (mrb_state *mrb, mrb_value self, const char *name, mrb_int argc,...)
 
mrb_value mrb_funcall_id (mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc,...)
 
static mrb_int ci_nregs (mrb_callinfo *ci)
 
mrb_value mrb_funcall_with_block (mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc, const mrb_value *argv, mrb_value blk)
 
mrb_value mrb_funcall_argv (mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc, const mrb_value *argv)
 
mrb_value mrb_exec_irep (mrb_state *mrb, mrb_value self, struct RProc *p)
 
mrb_value mrb_f_send (mrb_state *mrb, mrb_value self)
 
static mrb_value eval_under (mrb_state *mrb, mrb_value self, mrb_value blk, struct RClass *c)
 
mrb_value mrb_mod_module_eval (mrb_state *mrb, mrb_value mod)
 
mrb_value mrb_obj_instance_eval (mrb_state *mrb, mrb_value self)
 
mrb_value mrb_yield_with_class (mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv, mrb_value self, struct RClass *c)
 
mrb_value mrb_yield_argv (mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv)
 
mrb_value mrb_yield (mrb_state *mrb, mrb_value b, mrb_value arg)
 
mrb_value mrb_yield_cont (mrb_state *mrb, mrb_value b, mrb_value self, mrb_int argc, const mrb_value *argv)
 
static struct RBreakbreak_new (mrb_state *mrb, uint32_t tag, const struct RProc *p, mrb_value val)
 
static const struct mrb_irep_catch_handlercatch_handler_find (mrb_state *mrb, mrb_callinfo *ci, const mrb_code *pc, uint32_t filter)
 
static void localjump_error (mrb_state *mrb, localjump_error_kind kind)
 
static void argnum_error (mrb_state *mrb, mrb_int num)
 
static mrb_bool break_tag_p (struct RBreak *brk, uint32_t tag)
 
static void prepare_tagged_break (mrb_state *mrb, uint32_t tag, const struct RProc *proc, mrb_value val)
 
mrb_value mrb_vm_run (mrb_state *mrb, const struct RProc *proc, mrb_value self, mrb_int stack_keep)
 
static mrb_bool check_target_class (mrb_state *mrb)
 
void mrb_hash_check_kdict (mrb_state *mrb, mrb_value self)
 
mrb_value mrb_vm_exec (mrb_state *mrb, const struct RProc *proc, const mrb_code *pc)
 
mrb_value mrb_top_run (mrb_state *mrb, const struct RProc *proc, mrb_value self, mrb_int stack_keep)
 

Macro Definition Documentation

◆ BYTECODE_DECODER

#define BYTECODE_DECODER (   x)    (x)

Definition at line 926 of file vm.c.

◆ CALL_MAXARGS

#define CALL_MAXARGS   127

Definition at line 87 of file vm.c.

◆ CALLINFO_INIT_SIZE

#define CALLINFO_INIT_SIZE   32

Definition at line 40 of file vm.c.

◆ CASE

#define CASE (   insn,
  ops 
)    case insn: pc++; FETCH_ ## ops (); mrb->c->ci->pc = pc;

Definition at line 938 of file vm.c.

◆ catch_cover_p

#define catch_cover_p (   pc,
  beg,
  end 
)    ((pc) > (ptrdiff_t)(beg) && (pc) <= (ptrdiff_t)(end))

◆ CHECKPOINT_END

#define CHECKPOINT_END (   tag)
Value:
} while (0); \
} while (0)

Definition at line 913 of file vm.c.

◆ CHECKPOINT_LABEL_MAKE

#define CHECKPOINT_LABEL_MAKE (   tag)    L_CHECKPOINT_ ## tag

Definition at line 900 of file vm.c.

◆ CHECKPOINT_MAIN

#define CHECKPOINT_MAIN (   tag)
Value:
} while (0); \
} \
do {

Definition at line 908 of file vm.c.

◆ CHECKPOINT_RESTORE

#define CHECKPOINT_RESTORE (   tag)
Value:
do { \
if (FALSE) { \
CHECKPOINT_LABEL_MAKE(tag): \
do {
@ FALSE
Definition: dd.h:101
Definition: xmlparse.c:179
do
Definition: tex4ht.c:8363

Definition at line 902 of file vm.c.

◆ CI_ACC_DIRECT

#define CI_ACC_DIRECT   -2

Definition at line 249 of file vm.c.

◆ CI_ACC_RESUMED

#define CI_ACC_RESUMED   -3

Definition at line 250 of file vm.c.

◆ CI_ACC_SKIP

#define CI_ACC_SKIP   -1

Definition at line 248 of file vm.c.

◆ CODE_FETCH_HOOK

#define CODE_FETCH_HOOK (   mrb,
  irep,
  pc,
  regs 
)

Definition at line 920 of file vm.c.

◆ DEBUG

#define DEBUG (   x)

Definition at line 61 of file vm.c.

◆ DISPATCH_CHECKPOINTS

#define DISPATCH_CHECKPOINTS (   n,
  i 
)    case n: goto CHECKPOINT_LABEL_MAKE(n);

◆ END_DISPATCH

#define END_DISPATCH   L_END_DISPATCH:;}}

Definition at line 941 of file vm.c.

◆ INIT_DISPATCH

#define INIT_DISPATCH   for (;;) { insn = BYTECODE_DECODER(*pc); CODE_FETCH_HOOK(mrb, irep, pc, regs); switch (insn) {

Definition at line 937 of file vm.c.

◆ JUMP

#define JUMP   NEXT

Definition at line 940 of file vm.c.

◆ MRB_CATCH_FILTER_ALL

#define MRB_CATCH_FILTER_ALL   (MRB_CATCH_FILTER_RESCUE | MRB_CATCH_FILTER_ENSURE)

Definition at line 771 of file vm.c.

◆ MRB_CATCH_FILTER_ENSURE

#define MRB_CATCH_FILTER_ENSURE   (UINT32_C(1) << MRB_CATCH_ENSURE)

Definition at line 770 of file vm.c.

◆ MRB_CATCH_FILTER_RESCUE

#define MRB_CATCH_FILTER_RESCUE   (UINT32_C(1) << MRB_CATCH_RESCUE)

Definition at line 769 of file vm.c.

◆ MRB_FUNCALL_ARGC_MAX

#define MRB_FUNCALL_ARGC_MAX   16

Definition at line 313 of file vm.c.

◆ MRB_FUNCALL_DEPTH_MAX

#define MRB_FUNCALL_DEPTH_MAX   512

Definition at line 49 of file vm.c.

◆ MRB_STACK_GROWTH

#define MRB_STACK_GROWTH   128

Definition at line 44 of file vm.c.

◆ MRB_STACK_MAX

#define MRB_STACK_MAX   (0x40000 - MRB_STACK_GROWTH)

Definition at line 55 of file vm.c.

◆ NEXT

#define NEXT   goto L_END_DISPATCH

Definition at line 939 of file vm.c.

◆ OP_CMP

#define OP_CMP (   op,
  sym 
)
Value:
do {\
int result;\
/* need to check if - is overridden */\
switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\
break;\
break;\
break;\
break;\
default:\
c = 1;\
mid = MRB_OPSYM(sym);\
goto L_SEND_SYM;\
}\
if (result) {\
SET_TRUE_VALUE(regs[a]);\
}\
else {\
SET_FALSE_VALUE(regs[a]);\
}\
} while(0)
#define mrb_fixnum(o)
Definition: boxing_nan.h:70
MRB_INLINE enum mrb_vtype mrb_type(mrb_value o)
Definition: boxing_word.h:195
#define MRB_OPSYM(name)
Definition: disable.h:14
#define a(n)
Definition: gpos-common.c:148
Definition: sh.h:1226
double mrb_float
Definition: value.h:85
@ MRB_TT_FLOAT
Definition: value.h:110
@ MRB_TT_INTEGER
Definition: value.h:111
#define regs
#define OP_CMP_BODY(op, v1, v2)
#define TYPES2(a, b)
#define sym(x)
Definition: y.tab.c:133

◆ OP_CMP_BODY

#define OP_CMP_BODY (   op,
  v1,
  v2 
)    (v1(regs[a]) op v2(regs[a+1]))

◆ OP_MATH

#define OP_MATH (   op_name)
Value:
/* need to check if op is overridden */ \
switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) { \
OP_MATH_CASE_INTEGER(op_name); \
OP_MATH_CASE_FLOAT(op_name, integer, float); \
OP_MATH_CASE_FLOAT(op_name, float, integer); \
OP_MATH_CASE_FLOAT(op_name, float, float); \
OP_MATH_CASE_STRING_##op_name(); \
default: \
c = 1; \
mid = MRB_OPSYM(op_name); \
goto L_SEND_SYM; \
} \
NEXT;
int integer
Definition: pbmtopk.c:38

◆ OP_MATH_CASE_FLOAT

#define OP_MATH_CASE_FLOAT (   op_name,
  t1,
  t2 
)
Value:
case TYPES2(OP_MATH_TT_##t1, OP_MATH_TT_##t2): \
{ \
mrb_float z = mrb_##t1(regs[a]) OP_MATH_OP_##op_name mrb_##t2(regs[a+1]); \
SET_FLOAT_VALUE(mrb, regs[a], z); \
} \
break
int z
Definition: dviconv.c:26
#define t1
#define t2

◆ OP_MATH_CASE_INTEGER

#define OP_MATH_CASE_INTEGER (   op_name)
Value:
{ \
mrb_int x = mrb_integer(regs[a]), y = mrb_integer(regs[a+1]), z; \
if (mrb_int_##op_name##_overflow(x, y, &z)) \
OP_MATH_OVERFLOW_INT(); \
} \
break
#define SET_INT_VALUE(mrb, r, n)
Definition: boxing_nan.h:118
#define mrb_integer(o)
Definition: boxing_nan.h:71
kerning y
Definition: ttdriver.c:212
float x
Definition: cordic.py:15

◆ OP_MATH_CASE_STRING_add

#define OP_MATH_CASE_STRING_add ( )
Value:
regs[a] = mrb_str_plus(mrb, regs[a], regs[a+1]); \
mrb_gc_arena_restore(mrb, ai); \
break
mrb_value mrb_str_plus(mrb_state *mrb, mrb_value a, mrb_value b)
Definition: string.c:870
@ MRB_TT_STRING
Definition: value.h:124

◆ OP_MATH_CASE_STRING_mul

#define OP_MATH_CASE_STRING_mul ( )    (void)0

◆ OP_MATH_CASE_STRING_sub

#define OP_MATH_CASE_STRING_sub ( )    (void)0

◆ OP_MATH_OP_add

#define OP_MATH_OP_add   +

◆ OP_MATH_OP_mul

#define OP_MATH_OP_mul   *

◆ OP_MATH_OP_sub

#define OP_MATH_OP_sub   -

◆ OP_MATH_OVERFLOW_INT

#define OP_MATH_OVERFLOW_INT ( )    goto L_INT_OVERFLOW

◆ OP_MATH_TT_float

#define OP_MATH_TT_float   MRB_TT_FLOAT

◆ OP_MATH_TT_integer

#define OP_MATH_TT_integer   MRB_TT_INTEGER

◆ OP_MATHI

#define OP_MATHI (   op_name)
Value:
/* need to check if op is overridden */ \
switch (mrb_type(regs[a])) { \
OP_MATHI_CASE_INTEGER(op_name); \
OP_MATHI_CASE_FLOAT(op_name); \
default: \
SET_INT_VALUE(mrb,regs[a+1], b); \
c = 1; \
mid = MRB_OPSYM(op_name); \
goto L_SEND_SYM; \
} \
NEXT;
#define b
Definition: jpegint.h:372

◆ OP_MATHI_CASE_FLOAT

#define OP_MATHI_CASE_FLOAT (   op_name)
Value:
case MRB_TT_FLOAT: \
{ \
mrb_float z = mrb_float(regs[a]) OP_MATH_OP_##op_name b; \
SET_FLOAT_VALUE(mrb, regs[a], z); \
} \
break

◆ OP_MATHI_CASE_INTEGER

#define OP_MATHI_CASE_INTEGER (   op_name)
Value:
{ \
mrb_int x = mrb_integer(regs[a]), y = (mrb_int)b, z; \
if (mrb_int_##op_name##_overflow(x, y, &z)) \
OP_MATH_OVERFLOW_INT(); \
} \
break
int32_t mrb_int
Definition: value.h:35

◆ regs

#define regs   (mrb->c->ci->stack)

◆ STACK_INIT_SIZE

#define STACK_INIT_SIZE   128

Definition at line 39 of file vm.c.

◆ THROW_TAGGED_BREAK

#define THROW_TAGGED_BREAK (   mrb,
  tag,
  proc,
  val 
)
Value:
do { \
prepare_tagged_break(mrb, tag, proc, val); \
goto L_CATCH_TAGGED_BREAK; \
} while (0)
Definition: obx.h:103
Definition: strexpr.c:21

Definition at line 870 of file vm.c.

◆ TYPES2

#define TYPES2 (   a,
  b 
)    ((((uint16_t)(a))<<8)|(((uint16_t)(b))&0xff))

◆ UNWIND_ENSURE

#define UNWIND_ENSURE (   mrb,
  ci,
  pc,
  tag,
  proc,
  val 
)
Value:
do { \
if (ch) { \
THROW_TAGGED_BREAK(mrb, tag, proc, val); \
} \
} while (0)
long pc
Definition: disdvi.c:114
ch
Definition: t4ht.c:1443
#define MRB_CATCH_FILTER_ENSURE
Definition: vm.c:770
static const struct mrb_irep_catch_handler * catch_handler_find(mrb_state *mrb, mrb_callinfo *ci, const mrb_code *pc, uint32_t filter)
Definition: vm.c:774

Definition at line 876 of file vm.c.

Enumeration Type Documentation

◆ localjump_error_kind

Enumerator
LOCALJUMP_ERROR_RETURN 
LOCALJUMP_ERROR_BREAK 
LOCALJUMP_ERROR_YIELD 

Definition at line 807 of file vm.c.

Function Documentation

◆ argnum_error()

◆ break_new()

static struct RBreak* break_new ( mrb_state mrb,
uint32_t  tag,
const struct RProc p,
mrb_value  val 
)
static

◆ break_tag_p()

static mrb_bool break_tag_p ( struct RBreak brk,
uint32_t  tag 
)
static

Definition at line 854 of file vm.c.

References FALSE, MRB_TT_BREAK, NULL, and TRUE.

Referenced by prepare_tagged_break().

◆ catch_handler_find()

◆ check_target_class()

static mrb_bool check_target_class ( mrb_state mrb)
static

◆ ci_nregs()

static mrb_int ci_nregs ( mrb_callinfo ci)
static

Definition at line 356 of file vm.c.

References mrb_callinfo::argc, MRB_PROC_CFUNC_P, n, p, and mrb_callinfo::proc.

Referenced by mrb_funcall_with_block(), and mrb_yield_with_class().

◆ cipop()

static mrb_callinfo* cipop ( mrb_state mrb)
inlinestatic

Definition at line 299 of file vm.c.

References mrb_state::c, c, mrb_env_unshare(), and mrb_vm_ci_env().

Referenced by mrb_funcall_with_block(), mrb_vm_exec(), and mrb_yield_with_class().

◆ cipush()

◆ envadjust()

static void envadjust ( mrb_state mrb,
mrb_value oldbase,
mrb_value newbase,
size_t  oldsize 
)
inlinestatic

◆ eval_under()

◆ localjump_error()

static void localjump_error ( mrb_state mrb,
localjump_error_kind  kind 
)
static

Definition at line 814 of file vm.c.

References E_LOCALJUMP_ERROR, kind, mrb_exc_new_str(), mrb_exc_set(), mrb_str_cat(), mrb_str_new_capa(), and msg.

Referenced by mrb_vm_exec().

◆ mrb_env_unshare()

void mrb_env_unshare ( mrb_state mrb,
struct REnv e 
)

◆ mrb_exc_set()

◆ mrb_exec_irep()

◆ mrb_f_send()

◆ mrb_funcall()

mrb_value mrb_funcall ( mrb_state mrb,
mrb_value  val,
const char *  name,
mrb_int  argc,
  ... 
)

Call existing ruby functions.

Example:

 #include <stdio.h>
 #include <mruby.h>
 #include "mruby/compile.h"

 int
 main()
 {
   mrb_int i = 99;
   mrb_state *mrb = mrb_open();

   if (!mrb) { }
   FILE *fp = fopen("test.rb","r");
   mrb_value obj = mrb_load_file(mrb,fp);
   mrb_funcall(mrb, obj, "method_name", 1, mrb_fixnum_value(i));
   mrb_funcall_id(mrb, obj, MRB_SYM(method_name), 1, mrb_fixnum_value(i));
   fclose(fp);
   mrb_close(mrb);
 }
Parameters
mrbThe current mruby state.
valA reference to an mruby value.
nameThe name of the method.
argcThe number of arguments the method has.
...Variadic values(not type safe!).
Returns
[mrb_value] mruby function value.

Definition at line 317 of file vm.c.

References ap, argc, argv, E_ARGUMENT_ERROR, i, REnv::mid, MRB_FUNCALL_ARGC_MAX, mrb_funcall_argv(), mrb_intern_cstr, mrb_raise(), MRB_STRINGIZE, name, va_arg, va_end, and va_start.

Referenced by mrb_debug_eval(), mrb_obj_ceqq(), and mrb_sys_fail().

◆ mrb_funcall_argv()

mrb_value mrb_funcall_argv ( mrb_state mrb,
mrb_value  val,
mrb_sym  name,
mrb_int  argc,
const mrb_value argv 
)

Call existing ruby functions. This is basically the type safe version of mrb_funcall.

 #include <stdio.h>
 #include <mruby.h>
 #include "mruby/compile.h"
 int
 main()
 {
   mrb_state *mrb = mrb_open();
   mrb_value obj = mrb_fixnum_value(1);

   if (!mrb) { }

   FILE *fp = fopen("test.rb","r");
   mrb_value obj = mrb_load_file(mrb,fp);
   mrb_funcall_argv(mrb, obj, MRB_SYM(method_name), 1, &obj); // Calling ruby function from test.rb.
   fclose(fp);
   mrb_close(mrb);
  }
Parameters
mrbThe current mruby state.
valA reference to an mruby value.
name_symThe symbol representing the method.
argcThe number of arguments the method has.
objPointer to the object.
Returns
[mrb_value] mrb_value mruby function value.
See also
mrb_funcall

Definition at line 481 of file vm.c.

References argc, argv, mrb_funcall_with_block(), and mrb_nil_value().

Referenced by const_get(), convert_type(), mcall(), mrb_class_inherited(), mrb_funcall(), mrb_funcall_id(), mrb_hash_get(), mrb_make_exception(), mrb_obj_ceqq(), mrb_obj_new(), obj_hash_code(), and obj_respond_to().

◆ mrb_funcall_id()

◆ mrb_funcall_with_block()

◆ mrb_gc_arena_shrink()

static void mrb_gc_arena_shrink ( mrb_state mrb,
int  idx 
)
static

Definition at line 67 of file vm.c.

References gen-ucd-table::gc, mrb_state::gc, idx, MRB_GC_ARENA_SIZE, and mrb_realloc().

Referenced by mrb_vm_exec().

◆ mrb_hash_check_kdict()

void mrb_hash_check_kdict ( mrb_state mrb,
mrb_value  self 
)

Definition at line 1156 of file hash.c.

Referenced by mrb_vm_exec().

◆ mrb_method_missing()

void mrb_method_missing ( mrb_state mrb,
mrb_sym  name,
mrb_value  self,
mrb_value  args 
)

Definition at line 485 of file kernel.c.

References mrb_no_method_error(), and name.

Referenced by mrb_funcall_with_block(), mrb_obj_missing(), and mrb_vm_exec().

◆ mrb_mod_module_eval()

mrb_value mrb_mod_module_eval ( mrb_state mrb,
mrb_value  mod 
)

Definition at line 627 of file vm.c.

References a, b, E_NOTIMP_ERROR, eval_under(), mod(), mrb_class_ptr, mrb_get_args(), and mrb_raise().

Referenced by mrb_init_class().

◆ mrb_obj_instance_eval()

mrb_value mrb_obj_instance_eval ( mrb_state mrb,
mrb_value  self 
)

Definition at line 659 of file vm.c.

References a, b, E_NOTIMP_ERROR, eval_under(), mrb_get_args(), mrb_raise(), and mrb_singleton_class_ptr().

Referenced by f_instance_eval(), and mrb_init_class().

◆ mrb_run()

static mrb_value mrb_run ( mrb_state mrb,
const struct RProc proc,
mrb_value  self 
)
static

Definition at line 2843 of file vm.c.

References mrb_callinfo::argc, mrb_state::c, mrb_context::ci, and mrb_vm_run().

Referenced by mrb_funcall_with_block(), and mrb_yield_with_class().

◆ mrb_stack_extend()

◆ mrb_top_run()

mrb_value mrb_top_run ( mrb_state mrb,
const struct RProc proc,
mrb_value  self,
mrb_int  stack_keep 
)

◆ mrb_vm_exec()

mrb_value mrb_vm_exec ( mrb_state mrb,
const struct RProc proc,
const mrb_code pc 
)

Definition at line 998 of file vm.c.

References a, abort(), acc, mrb_callinfo::acc, add, mrb_callinfo::argc, argc, argnum_error(), argv, argv0, RArray::ary, ARY_LEN, ARY_PTR, ARY_SET_LEN, B, b, base, BB, BBB, RProc::body, break_new(), BS, BSS, mrb_state::c, c, CALL_MAXARGS, CASE, catch_handler_find(), ch, check_target_class(), CHECKPOINT_END, CHECKPOINT_LABEL_MAKE, CHECKPOINT_MAIN, CHECKPOINT_RESTORE, mrb_context::ci, CI_ACC_DIRECT, CI_ACC_RESUMED, CI_ACC_SKIP, mrb_context::cibase, cipop(), cipush(), DEBUG, DISPATCH_CHECKPOINTS, div(), link_confs::dst, e, E_ARGUMENT_ERROR, E_FIBER_ERROR, E_LOCALJUMP_ERROR, E_NOMETHOD_ERROR, E_RANGE_ERROR, E_RUNTIME_ERROR, E_TYPE_ERROR, ec, END_DISPATCH, mrb_state::exc, f, FALSE, FETCH_BBB, fprintf, gt, hash, i, idx, INIT_DISPATCH, int(), int16_t, INT32_MAX, INT32_MIN, RProc::irep, IREP_TT_FLOAT, IREP_TT_INT32, IREP_TT_INT64, IREP_TT_NFLAG, IREP_TT_SFLAG, mrb_irep::iseq, mrb_state::jmp, JUMP, k, len, localjump_error(), LOCALJUMP_ERROR_RETURN, LOCALJUMP_ERROR_YIELD, m, mrb_callinfo::mid, REnv::mid, mrb_alias_method(), mrb_array_p, mrb_ary_concat(), mrb_ary_new_capa(), mrb_ary_new_from_values(), mrb_ary_ptr, mrb_ary_push(), mrb_ary_ref(), mrb_ary_set(), mrb_ary_splat(), mrb_ary_unshift(), MRB_ASPEC_KDICT, MRB_ASPEC_KEY, MRB_ASPEC_OPT, MRB_ASPEC_POST, MRB_ASPEC_REQ, MRB_ASPEC_REST, mrb_assert, mrb_bool_value(), mrb_break_p, mrb_break_proc_get, mrb_break_tag_get(), mrb_break_value_get(), MRB_CATCH, MRB_CATCH_FILTER_ALL, MRB_CATCH_FILTER_ENSURE, mrb_class(), mrb_class_ptr, mrb_closure_new(), mrb_const_get(), mrb_const_set(), mrb_define_method_raw(), MRB_END_EXC, mrb_ensure_hash_type(), MRB_ENV_LEN, MRB_ENV_ONSTACK_P, mrb_exc_new(), mrb_exc_new_lit, mrb_exc_new_str(), mrb_exc_set(), MRB_FIBER_RUNNING, MRB_FIBER_TERMINATED, mrb_field_write_barrier(), mrb_fixnum_value(), MRB_FL_CLASS_IS_PREPENDED, mrb_float_value(), mrb_format(), mrb_gc_arena_restore(), mrb_gc_arena_save(), mrb_gc_arena_shrink(), mrb_gc_protect(), mrb_gv_get(), mrb_gv_set(), mrb_hash_check_kdict(), mrb_hash_delete_key(), mrb_hash_dup(), mrb_hash_empty_p(), mrb_hash_get(), mrb_hash_key_p(), mrb_hash_keys(), mrb_hash_merge(), mrb_hash_new(), mrb_hash_new_capa(), mrb_hash_p, mrb_hash_set(), mrb_int_value(), mrb_integer, mrb_integer_p, mrb_intern_str(), mrb_irep_catch_handler_unpack, mrb_iv_get(), mrb_iv_set(), MRB_METHOD_CFUNC, MRB_METHOD_CFUNC_P, MRB_METHOD_FROM_PROC, MRB_METHOD_FUNC, mrb_method_missing(), MRB_METHOD_NOARG_P, MRB_METHOD_PROC, MRB_METHOD_PROC_P, mrb_method_search_vm(), MRB_METHOD_UNDEF_P, mrb_nil_p, mrb_nil_value(), mrb_num_div_flo(), mrb_num_div_int(), mrb_obj_eq(), mrb_obj_is_kind_of(), mrb_obj_ptr, mrb_obj_value(), MRB_OPSYM, MRB_PROC_CFUNC, MRB_PROC_CFUNC_P, MRB_PROC_ENV, MRB_PROC_ENV_P, mrb_proc_new(), MRB_PROC_ORPHAN, MRB_PROC_ORPHAN_P, mrb_proc_p, mrb_proc_ptr, MRB_PROC_SCOPE, MRB_PROC_SET_TARGET_CLASS, MRB_PROC_STRICT, MRB_PROC_STRICT_P, MRB_PROC_TARGET_CLASS, mrb_range_new(), mrb_singleton_class(), mrb_stack_extend(), mrb_str_concat(), mrb_str_new(), mrb_str_new_static(), MRB_SYM, mrb_sym_name(), mrb_symbol_value(), mrb_test, MRB_THROW, MRB_TRY, MRB_TT_BREAK, MRB_TT_CLASS, MRB_TT_EXCEPTION, MRB_TT_FLOAT, MRB_TT_ICLASS, MRB_TT_INTEGER, MRB_TT_MODULE, MRB_TT_PROC, mrb_type(), mrb_type_convert(), mrb_undef_method_id(), mrb_vm_ci_env(), mrb_vm_ci_proc_set(), mrb_vm_ci_target_class(), mrb_vm_const_get(), mrb_vm_const_set(), mrb_vm_cv_get(), mrb_vm_cv_set(), mrb_vm_define_class(), mrb_vm_define_module(), mrb_vm_special_get(), mrb_vm_special_set(), mrb_write_barrier(), NEXT, mrb_irep::nlocals, mrb_irep::nregs, NULL, mrb_state::object_class, OP_ADD, OP_CALL, OP_CMP, OP_DIV, OP_EQ, OP_JMP, OP_L_BLOCK, OP_L_CAPTURE, OP_L_LAMBDA, OP_L_METHOD, OP_L_STRICT, OP_LE, OP_LOADNIL, OP_LT, OP_MATH, OP_MATHI, OP_MOVE, OP_MUL, OP_R_BREAK, OP_R_NORMAL, OP_R_RETURN, OP_RETURN, OP_SUB, optable, p, pc, mrb_callinfo::pc, mrb_irep::pool, pp, pre, printf(), mrb_callinfo::proc, r, RARRAY_LEN, RARRAY_PTR, RBREAK_TAG_BREAK, RBREAK_TAG_BREAK_INTARGET, RBREAK_TAG_BREAK_UPPER, RBREAK_TAG_FOREACH, RBREAK_TAG_JUMP, RBREAK_TAG_RETURN, RBREAK_TAG_RETURN_BLOCK, RBREAK_TAG_RETURN_TOPLEVEL, RBREAK_TAG_STOP, regs, mrb_irep::reps, rest, mrb_state::root_c, S, SET_FALSE_VALUE, SET_FIXNUM_VALUE, SET_FLOAT_VALUE, SET_INT_VALUE, SET_NIL_VALUE, SET_SYM_VALUE, SET_TRUE_VALUE, stack, mrb_callinfo::stack, stack_clear(), stack_copy(), mrb_context::status, mrb_context::stbase, str, sub, RClass::super, sym, mrb_irep::syms, target, mrb_callinfo::target_class, THROW_TAGGED_BREAK, top_proc(), TRUE, RObject::tt, TYPES2, u, mrb_callinfo::u, uint32_t, UNWIND_ENSURE, uvenv(), v, val, value_move(), mrb_context::vmexec, W, cordic::x, y, and Z.

Referenced by fiber_switch(), and mrb_vm_run().

◆ mrb_vm_run()

◆ mrb_yield()

mrb_value mrb_yield ( mrb_state mrb,
mrb_value  b,
mrb_value  arg 
)

Definition at line 726 of file vm.c.

References b, MRB_PROC_ENV, mrb_proc_ptr, MRB_PROC_TARGET_CLASS, mrb_yield_with_class(), and p.

Referenced by os_each_object_cb().

◆ mrb_yield_argv()

mrb_value mrb_yield_argv ( mrb_state mrb,
mrb_value  b,
mrb_int  argc,
const mrb_value argv 
)

Definition at line 718 of file vm.c.

References argc, argv, b, MRB_PROC_ENV, mrb_proc_ptr, MRB_PROC_TARGET_CLASS, mrb_yield_with_class(), and p.

◆ mrb_yield_cont()

◆ mrb_yield_with_class()

◆ prepare_tagged_break()

static void prepare_tagged_break ( mrb_state mrb,
uint32_t  tag,
const struct RProc proc,
mrb_value  val 
)
static

Definition at line 860 of file vm.c.

References break_new(), break_tag_p(), mrb_state::exc, and mrb_break_tag_set().

◆ stack_clear()

static void stack_clear ( mrb_value from,
size_t  count 
)
inlinestatic

Definition at line 92 of file vm.c.

References count, memset(), and SET_NIL_VALUE.

Referenced by eval_under(), mrb_exec_irep(), mrb_vm_exec(), mrb_vm_run(), and stack_extend_alloc().

◆ stack_copy()

static void stack_copy ( mrb_value dst,
const mrb_value src,
size_t  size 
)
inlinestatic

◆ stack_extend_alloc()

static void stack_extend_alloc ( mrb_state mrb,
mrb_int  room 
)
static

◆ stack_init()

static void stack_init ( mrb_state mrb)
static

◆ top_proc()

static const struct RProc* top_proc ( mrb_state mrb,
const struct RProc proc 
)
inlinestatic

Definition at line 238 of file vm.c.

References MRB_PROC_SCOPE_P, and MRB_PROC_STRICT_P.

Referenced by mrb_vm_exec().

◆ uvenv()

static struct REnv* uvenv ( mrb_state mrb,
mrb_int  up 
)
inlinestatic

Definition at line 212 of file vm.c.

References mrb_state::c, cb, mrb_context::ci, mrb_context::cibase, e, MRB_PROC_ENV, mrb_vm_ci_env(), NULL, mrb_callinfo::proc, and up.

Referenced by mrb_vm_exec().