mruby/c VM Source Code master (2026/08/06)
Loading...
Searching...
No Matches
vm.c File Reference

mruby bytecode executor. More...

#include "opcode.h"
#include "mrubyc.h"
Include dependency graph for vm.c:

Go to the source code of this file.

Macros

#define CALL_MAXARGS   15
#define IS_CLASS_OR_MODULE(v)
#define EXT
#define FLAG_REST   0x1000
#define FLAG_M2   0x0f80
#define FLAG_KW   0x007c
#define FLAG_DICT   0x0002
#define FLAG_BLOCK   0x0001
#define EXT

Functions

static void send_by_name (mrbc_vm *vm, mrbc_sym sym_id, int a, int c)
static const mrbc_irep_catch_handlerfind_catch_handler_ensure (const mrbc_vm *vm)
void mrbc_cleanup_vm (void)
mrbc_callinfomrbc_push_callinfo (mrbc_vm *vm, mrbc_sym method_id, int reg_offset, int n_args)
void mrbc_pop_callinfo (mrbc_vm *vm)
mrbc_vmmrbc_vm_new (int regs_size)
mrbc_vmmrbc_vm_open (mrbc_vm *vm)
void mrbc_vm_begin (mrbc_vm *vm)
void mrbc_vm_end (mrbc_vm *vm)
void mrbc_vm_close (mrbc_vm *vm)
static void op_nop (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_move (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadl (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadi8 (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadineg (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadi_n (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadi16 (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadi32 (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadsym (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadnil (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadself (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadtrue (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadfalse (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_getgv (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_setgv (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_getiv (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_setiv (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_getconst (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_setconst (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_getmcnst (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_getupvar (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_setupvar (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_getidx (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_getidx0 (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_setidx (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_jmp (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_jmpif (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_jmpnot (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_jmpnil (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_jmpuw (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_except (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_rescue (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_raiseif (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_matcherr (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_ssend (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_ssend0 (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_ssendb (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_send (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_send0 (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_sendb (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_blkcall (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_super (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_argary (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_enter (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_key_p (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_keyend (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_karg (mrbc_vm *vm, mrbc_value *regs EXT)
static void sub_op_return (mrbc_vm *vm, mrbc_value *regs, int a)
static void op_return (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_return_blk (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_retself (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_retnil (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_rettrue (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_retfalse (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_break (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_blkpush (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_add (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_addi (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_sub (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_subi (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_addilv (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_subilv (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_mul (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_div (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_eq (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_lt (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_le (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_gt (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_ge (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_array (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_array2 (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_arycat (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_arypush (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_arysplat (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_aref (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_aset (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_apost (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_intern (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_symbol (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_string (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_strcat (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_hash (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_hashadd (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_hashcat (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_block (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_method (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_range_inc (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_range_exc (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_oclass (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_class (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_module (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_exec (mrbc_vm *vm, mrbc_value *regs EXT)
static void sub_irep_inc_dec_ref (mrbc_irep *irep, int inc_dec)
static void sub_newmethod (mrbc_class *cls, mrbc_method *method, mrbc_sym sym_id)
static void sub_op_def (mrbc_vm *vm, mrbc_class *cls, mrbc_irep *irep, mrbc_sym sym_id)
static void op_def (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_tdef (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_sdef (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_alias (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_sclass (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_tclass (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_ext (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_stop (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_unsupported (mrbc_vm *vm, mrbc_value *regs EXT)
int mrbc_vm_run (mrbc_vm *vm)

Variables

static uint16_t free_vm_bitmap [MAX_VM_COUNT/16+1]
 for getting the VM ID

Detailed Description

mruby bytecode executor.

Copyright (C) 2015-      Kyushu Institute of Technology.
Copyright (C) 2015-2026  Shimane IT Open-Innovation Center.
Copyright (C) 2026-      Shimane Institute for Industrial Technology.

This file is distributed under BSD 3-Clause License.

Fetch mruby VM bytecodes, decode and execute.

Definition in file vm.c.

Macro Definition Documentation

◆ CALL_MAXARGS

#define CALL_MAXARGS   15

Definition at line 31 of file vm.c.

◆ EXT [1/2]

#define EXT

Definition at line 423 of file vm.c.

◆ EXT [2/2]

#define EXT

Definition at line 423 of file vm.c.

◆ FLAG_BLOCK

#define FLAG_BLOCK   0x0001

◆ FLAG_DICT

#define FLAG_DICT   0x0002

◆ FLAG_KW

#define FLAG_KW   0x007c

◆ FLAG_M2

#define FLAG_M2   0x0f80

◆ FLAG_REST

#define FLAG_REST   0x1000

◆ IS_CLASS_OR_MODULE

#define IS_CLASS_OR_MODULE ( v)
Value:
#define mrbc_type(o)
Definition boxing_no.h:57
@ MRBC_TT_MODULE
Module.
Definition value.h:91
@ MRBC_TT_CLASS
Class.
Definition value.h:90

Definition at line 35 of file vm.c.

Function Documentation

◆ find_catch_handler_ensure()

const mrbc_irep_catch_handler * find_catch_handler_ensure ( const mrbc_vm * vm)
static

Find ensure catch handler

Definition at line 172 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_cleanup_vm()

void mrbc_cleanup_vm ( void )

cleanup

Definition at line 201 of file vm.c.

Here is the caller graph for this function:

◆ mrbc_pop_callinfo()

void mrbc_pop_callinfo ( mrbc_vm * vm)

Pop current status from callinfo stack

Definition at line 241 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_push_callinfo()

mrbc_callinfo * mrbc_push_callinfo ( mrbc_vm * vm,
mrbc_sym method_id,
int reg_offset,
int n_args )

Push current status to callinfo stack

Definition at line 210 of file vm.c.

Here is the caller graph for this function:

◆ mrbc_vm_begin()

void mrbc_vm_begin ( mrbc_vm * vm)

VM initializer.

Parameters
vmPointer to VM

Definition at line 340 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_vm_close()

void mrbc_vm_close ( mrbc_vm * vm)

Close the VM.

Parameters
vmPointer to VM

Definition at line 402 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_vm_end()

void mrbc_vm_end ( mrbc_vm * vm)

VM finalizer.

Parameters
vmPointer to VM

Definition at line 366 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_vm_new()

mrbc_vm * mrbc_vm_new ( int regs_size)

Create (allocate) VM structure.

Parameters
regs_sizenum of registor.
Returns
Pointer to mrbc_vm.
Return values
NULLerror.

Code example

mrbc_vm *vm;
mrbc_load_mrb( vm, byte_code );
int mrbc_load_mrb(mrbc_vm *vm, const void *bytecode)
Definition load.c:306
void mrbc_vm_close(mrbc_vm *vm)
Definition vm.c:402
mrbc_vm * mrbc_vm_new(int regs_size)
Definition vm.c:287
mrbc_vm * mrbc_vm_open(mrbc_vm *vm)
Definition vm.c:309
int mrbc_vm_run(mrbc_vm *vm)
Definition vm.c:3160
void mrbc_vm_end(mrbc_vm *vm)
Definition vm.c:366
void mrbc_vm_begin(mrbc_vm *vm)
Definition vm.c:340
struct VM mrbc_vm
Virtual Machine.
#define MAX_REGS_SIZE
Definition vm_config.h:25

Definition at line 287 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_vm_open()

mrbc_vm * mrbc_vm_open ( mrbc_vm * vm)

Open the VM.

Parameters
vmPointer to VM or NULL.
Returns
Pointer to VM, or NULL is error.

Definition at line 309 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_vm_run()

int mrbc_vm_run ( mrbc_vm * vm)

Fetch a bytecode and execute

Parameters
vmA pointer to VM.
Return values
0(maybe) preemption by timer.
1program done.
2exception occurred.

Definition at line 3160 of file vm.c.

Here is the caller graph for this function:

◆ op_add()

void op_add ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ADD

R[a] = R[a]+R[a+1]

Definition at line 2006 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_addi()

void op_addi ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ADDI

R[a] = R[a]+mrb_int(b)

Definition at line 2050 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_addilv()

void op_addilv ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ADDILV

R[a] = R[a]+mrb_int(c); R[b],R[b+1] for method call

Definition at line 2148 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_alias()

void op_alias ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ALIAS

alias_method(target_class,Syms[a],Syms[b])

Definition at line 3057 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_apost()

void op_apost ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_APOST

R[a],R[a+1]..R[a+c] = R[a][b..]

Definition at line 2569 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_aref()

void op_aref ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_AREF

R[a] = R[b][c]

Definition at line 2523 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_argary()

void op_argary ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ARGARY

R[a] = argument array (16=m5:r1:m5:d1:lv4)

flags: mmmm_mrmm_mmmd_llll

Definition at line 1426 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_array()

void op_array ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ARRAY

R[a] = ary_new(R[a],R[a+1]..R[a+b])

Definition at line 2410 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_array2()

void op_array2 ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ARRAY2

R[a] = ary_new(R[b],R[b+1]..R[b+c])

Definition at line 2430 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_arycat()

void op_arycat ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ARYCAT

ary_cat(R[a],R[a+1])

Definition at line 2450 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_arypush()

void op_arypush ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ARYPUSH

ary_push(R[a],R[a+1]..R[a+b])

Definition at line 2488 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_arysplat()

void op_arysplat ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ARYSPLAT

R[a] = ary_dup(R[a])

Definition at line 2508 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_aset()

void op_aset ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ASET

R[b][c] = R[a]

Definition at line 2553 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_blkcall()

void op_blkcall ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_BLKCALL

R[a] = R[a].call(R[a+1],... ,R[a+b]); direct block call

Definition at line 1317 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_blkpush()

void op_blkpush ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_BLKPUSH

R[a] = block (16=m5:r1:m5:d1:lv4)

Definition at line 1953 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_block()

void op_block ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_BLOCK

R[a] = lambda(Irep[b],L_BLOCK)

Definition at line 2753 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_break()

void op_break ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_BREAK

break R[a]

Definition at line 1906 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_class()

void op_class ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_CLASS

R[a] = newclass(R[a],Syms[b],R[a+1])

Definition at line 2830 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_def()

void op_def ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_DEF

R[a].newmethod(Syms[b],R[a+1]); R[a] = Syms[b]

Definition at line 3003 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_div()

void op_div ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_DIV

R[a] = R[a]/R[a+1]

Definition at line 2248 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_enter()

void op_enter ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_ENTER

arg setup according to flags (24=n1:m5:o5:r1:m5:k5:d1:b1)

flags: nmmm_mmoo_ooor_mmmm_mkkk_kkdb

Definition at line 1508 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_eq()

void op_eq ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_EQ

R[a] = R[a]==R[a+1]

Definition at line 2305 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_except()

void op_except ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_EXCEPT

R[a] = exc

Definition at line 1023 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_exec()

void op_exec ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_EXEC

R[a] = blockexec(R[a],Irep[b])

Definition at line 2925 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_ext()

void op_ext ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_EXTn

make 1st operand (a) 16bit make 2nd operand (b) 16bit make 2nd operand (b) 16bit

Definition at line 3117 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_ge()

void op_ge ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_GE

R[a] = R[a]>=R[a+1]

Definition at line 2389 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_getconst()

void op_getconst ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_GETCONST

R[a] = constget(Syms[b])

Definition at line 695 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_getgv()

void op_getgv ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_GETGV

R[a] = getglobal(Syms[b])

Definition at line 616 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_getidx()

void op_getidx ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_GETIDX

R[a] = R[a][R[a+1]]

Definition at line 885 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_getidx0()

void op_getidx0 ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_GETIDX0

R[a] = R[b][0]; a+1 for method call

Definition at line 898 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_getiv()

void op_getiv ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_GETIV

R[a] = ivget(Syms[b])

Definition at line 650 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_getmcnst()

void op_getmcnst ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_GETMCNST

R[a] = R[a]::Syms[b]

Definition at line 773 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_getupvar()

void op_getupvar ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_GETUPVAR

R[a] = uvget(b,c)

b: target offset of regs. c: nested block level.

Definition at line 820 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_gt()

void op_gt ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_GT

R[a] = R[a]>R[a+1]

Definition at line 2368 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_hash()

void op_hash ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_HASH

R[a] = hash_new(R[a],R[a+1]..R[a+b*2-1])

Definition at line 2689 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_hashadd()

void op_hashadd ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_HASHADD

hash_push(R[a],R[a+1]..R[a+b*2])

Definition at line 2711 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_hashcat()

void op_hashcat ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_HASHCAT

R[a] = hash_cat(R[a],R[a+1])

Definition at line 2733 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_intern()

void op_intern ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_INTERN

R[a] = intern(R[a])

Definition at line 2610 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_jmp()

void op_jmp ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_JMP

pc+=a

Definition at line 931 of file vm.c.

Here is the caller graph for this function:

◆ op_jmpif()

void op_jmpif ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_JMPIF

if R[a] pc+=b

Definition at line 944 of file vm.c.

Here is the caller graph for this function:

◆ op_jmpnil()

void op_jmpnil ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_JMPNIL

if R[a]==nil pc+=b

Definition at line 974 of file vm.c.

Here is the caller graph for this function:

◆ op_jmpnot()

void op_jmpnot ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_JMPNOT

if !R[a] pc+=b

Definition at line 959 of file vm.c.

Here is the caller graph for this function:

◆ op_jmpuw()

void op_jmpuw ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_JMPUW

unwind_and_jump_to(a)

Definition at line 989 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_karg()

void op_karg ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

op_karg

R[a] = kdict[Syms[b]]; kdict.delete(Syms[b])

Definition at line 1691 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_key_p()

void op_key_p ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

op_key_p

R[a] = kdict.key?(Syms[b])

Definition at line 1652 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_keyend()

void op_keyend ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

op_keyend

raise unless kdict.empty?

Definition at line 1670 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_le()

void op_le ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LE

R[a] = R[a]<=R[a+1]

Definition at line 2347 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadfalse()

void op_loadfalse ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADFALSE

R[a] = false

Definition at line 602 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadi16()

void op_loadi16 ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADI16

R[a] = mrb_int(b)

Definition at line 516 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadi32()

void op_loadi32 ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADI32

R[a] = mrb_int((b<<16)+c)

Definition at line 531 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadi8()

void op_loadi8 ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADI8

R[a] = mrb_int(b)

Definition at line 470 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadi_n()

void op_loadi_n ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADI_n (n=-1,0,1..7)

R[a] = mrb_int(n)

Definition at line 498 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadineg()

void op_loadineg ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADINEG

R[a] = mrb_int(-b)

Definition at line 484 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadl()

void op_loadl ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADL

R[a] = Pool[b]

Definition at line 456 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadnil()

void op_loadnil ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADNIL

R[a] = nil

Definition at line 559 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadself()

void op_loadself ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADSELF

R[a] = self

Definition at line 573 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadsym()

void op_loadsym ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADSYM

R[a] = Syms[b]

Definition at line 545 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_loadtrue()

void op_loadtrue ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LOADTRUE

R[a] = true

Definition at line 588 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_lt()

void op_lt ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_LT

R[a] = R[a]<R[a+1]

Definition at line 2326 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_matcherr()

void op_matcherr ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_MATCHERR

raise NoMatchingPatternError unless R[a]

Definition at line 1209 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_method()

void op_method ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_METHOD

R[a] = lambda(Irep[b],L_METHOD)

Definition at line 2769 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_module()

void op_module ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_MODULE

R[a] = newmodule(R[a],Syms[b])

Definition at line 2890 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_move()

void op_move ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_MOVE

R[a] = R[b]

Definition at line 441 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_mul()

void op_mul ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_MUL

R[a] = R[a]*R[a+1]

Definition at line 2204 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_nop()

void op_nop ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_NOP

No operation

Definition at line 430 of file vm.c.

Here is the caller graph for this function:

◆ op_oclass()

void op_oclass ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_OCLASS

R[a] = ::Object

Definition at line 2815 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_raiseif()

void op_raiseif ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_RAISEIF

raise(R[a]) if R[a]

Definition at line 1055 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_range_exc()

void op_range_exc ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_RANGE_EXC

R[a] = range_new(R[a],R[a+1],TRUE)

Definition at line 2800 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_range_inc()

void op_range_inc ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_RANGE_INC

R[a] = range_new(R[a],R[a+1],FALSE)

Definition at line 2785 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_rescue()

void op_rescue ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_RESCUE

R[b] = R[a].isa?(R[b])

Definition at line 1038 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_retfalse()

void op_retfalse ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_RETFALSE

return false

Definition at line 1890 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_retnil()

void op_retnil ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_RETNIL

return nil

Definition at line 1858 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_retself()

void op_retself ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_RETSELF

return self

Definition at line 1841 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_rettrue()

void op_rettrue ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_RETTRUE

return true

Definition at line 1874 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_return()

void op_return ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_RETURN

return R[a] (normal)

Definition at line 1774 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_return_blk()

void op_return_blk ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_RETURN_BLK

return R[a] (in-block return)

Definition at line 1787 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_sclass()

void op_sclass ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SCLASS

R[a] = R[a].singleton_class

Definition at line 3087 of file vm.c.

Here is the caller graph for this function:

◆ op_sdef()

void op_sdef ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SDEF

R[a].singleton_class.newmethod(Syms[b],Irep[c]); R[a] = Syms[b]

Definition at line 3039 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_send()

void op_send ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SEND

R[a] = R[a].send(Syms[b],R[a+1]..,R[a+n+1]:R[a+n+2]..) (c=n|k<<4)

Definition at line 1278 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_send0()

void op_send0 ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SEND0

R[a] = R[a].send(Syms[b]) (no args)

Definition at line 1291 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_sendb()

void op_sendb ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SENDB

R[a] = R[a].send(Syms[b],R[a+1]..,R[a+n+1]:R[a+n+2]..,&R[a+n+2k+1])

Definition at line 1304 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_setconst()

void op_setconst ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SETCONST

constset(Syms[b],R[a])

Definition at line 753 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_setgv()

void op_setgv ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SETGV

setglobal(Syms[b], R[a])

Definition at line 636 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_setidx()

void op_setidx ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SETIDX

R[a][R[a+1]] = R[a+2]

Definition at line 918 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_setiv()

void op_setiv ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SETIV

ivset(Syms[b],R[a])

Definition at line 672 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_setupvar()

void op_setupvar ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SETUPVAR

uvset(b,c,R[a])

Definition at line 853 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_ssend()

void op_ssend ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SSEND

R[a] = self.send(Syms[b],R[a+1]..,R[a+n+1]:R[a+n+2]..) (c=n|k<<4)

Definition at line 1224 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_ssend0()

void op_ssend0 ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SSEND0

R[a] = self.send(Syms[b]) (no args)

Definition at line 1242 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_ssendb()

void op_ssendb ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SSENDB

R[a] = self.send(Syms[b],R[a+1]..,R[a+n+1]:R[a+n+2]..,&R[a+n+2k+1])

Definition at line 1260 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_stop()

void op_stop ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_STOP

stop VM

Definition at line 3131 of file vm.c.

Here is the caller graph for this function:

◆ op_strcat()

void op_strcat ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_STRCAT

str_cat(R[a],R[a+1])

Definition at line 2663 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_string()

void op_string ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_STRING

R[a] = str_dup(Pool[b])

Definition at line 2649 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_sub()

void op_sub ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SUB

R[a] = R[a]-R[a+1]

Definition at line 2077 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_subi()

void op_subi ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SUBI

R[a] = R[a]-mrb_int(b)

Definition at line 2121 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_subilv()

void op_subilv ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SUBILV

R[a] = R[a]-mrb_int(c); R[b],R[b+1] for method call

Definition at line 2176 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_super()

void op_super ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SUPER

R[a] = super(R[a+1],... ,R[a+b+1])

Definition at line 1330 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_symbol()

void op_symbol ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_SYMBOL

R[a] = intern(Pool[b])

Definition at line 2628 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_tclass()

void op_tclass ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_TCLASS

R[a] = target_class

Definition at line 3099 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_tdef()

void op_tdef ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

OP_TDEF

target_class.newmethod(Syms[b],Irep[c]); R[a] = Syms[b]

Definition at line 3021 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_unsupported()

void op_unsupported ( mrbc_vm * vm,
mrbc_value *regs EXT )
inlinestatic

Definition at line 3144 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_by_name()

void send_by_name ( mrbc_vm * vm,
mrbc_sym sym_id,
int a,
int c )
static

Method call by method name's id

Parameters
vmpointer to VM.
sym_idmethod name symbol id
aoperand a
cbit: 0-3=narg, 4-7=karg, 8=have block param flag.

Definition at line 57 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sub_irep_inc_dec_ref()

void sub_irep_inc_dec_ref ( mrbc_irep * irep,
int inc_dec )
static

Definition at line 2942 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sub_newmethod()

void sub_newmethod ( mrbc_class * cls,
mrbc_method * method,
mrbc_sym sym_id )
static

Definition at line 2951 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sub_op_def()

void sub_op_def ( mrbc_vm * vm,
mrbc_class * cls,
mrbc_irep * irep,
mrbc_sym sym_id )
static

Definition at line 2975 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sub_op_return()

void sub_op_return ( mrbc_vm * vm,
mrbc_value * regs,
int a )
inlinestatic

op_return, op_return_blk subroutine.

Definition at line 1713 of file vm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ free_vm_bitmap

uint16_t free_vm_bitmap[MAX_VM_COUNT/16+1]
static

for getting the VM ID

Definition at line 43 of file vm.c.