mruby/c VM Source Code release 3.4
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 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 (struct VM *vm, mrbc_sym sym_id, int a, int c)
static const mrbc_irep_catch_handlerfind_catch_handler_ensure (const struct VM *vm)
void mrbc_cleanup_vm (void)
mrbc_sym mrbc_get_callee_symid (struct VM *vm)
const char * mrbc_get_callee_name (struct VM *vm)
mrbc_callinfomrbc_push_callinfo (struct VM *vm, mrbc_sym method_id, int reg_offset, int n_args)
void mrbc_pop_callinfo (struct VM *vm)
mrbc_vmmrbc_vm_new (int regs_size)
mrbc_vmmrbc_vm_open (struct VM *vm)
void mrbc_vm_begin (struct VM *vm)
void mrbc_vm_end (struct VM *vm)
void mrbc_vm_close (struct 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_loadi (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_loadt (mrbc_vm *vm, mrbc_value *regs EXT)
static void op_loadf (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_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_ssend (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_sendb (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 op_return__sub (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_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_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_arydup (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_incref (mrbc_irep *irep, int inc_dec)
static void sub_def_alias (mrbc_class *cls, mrbc_method *method, mrbc_sym sym_id)
static void op_def (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 (struct 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- Shimane IT Open-Innovation Center.

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 30 of file vm.c.

◆ EXT [1/2]

#define EXT

Definition at line 432 of file vm.c.

◆ EXT [2/2]

#define EXT

Definition at line 432 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

Function Documentation

◆ find_catch_handler_ensure()

const mrbc_irep_catch_handler * find_catch_handler_ensure ( const struct VM * vm)
static

Find ensure catch handler

Definition at line 151 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 180 of file vm.c.

Here is the caller graph for this function:

◆ mrbc_get_callee_name()

const char * mrbc_get_callee_name ( struct VM * vm)

get callee name

Parameters
vmPointer to VM
Returns
string

Definition at line 209 of file vm.c.

◆ mrbc_get_callee_symid()

mrbc_sym mrbc_get_callee_symid ( struct VM * vm)

get callee symbol id

Parameters
vmPointer to VM
Returns
string

Definition at line 192 of file vm.c.

◆ mrbc_pop_callinfo()

void mrbc_pop_callinfo ( struct VM * vm)

Pop current status from callinfo stack

Definition at line 246 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 ( struct VM * vm,
mrbc_sym method_id,
int reg_offset,
int n_args )

Push current status to callinfo stack

Definition at line 219 of file vm.c.

Here is the caller graph for this function:

◆ mrbc_vm_begin()

void mrbc_vm_begin ( struct VM * vm)

VM initializer.

Parameters
vmPointer to VM

Definition at line 348 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 ( struct VM * vm)

Close the VM.

Parameters
vmPointer to VM

Definition at line 411 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 ( struct VM * vm)

VM finalizer.

Parameters
vmPointer to VM

Definition at line 375 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(struct VM *vm, const void *bytecode)
Definition load.c:292
mrbc_vm * mrbc_vm_new(int regs_size)
Definition vm.c:292
void mrbc_vm_end(struct VM *vm)
Definition vm.c:375
mrbc_vm * mrbc_vm_open(struct VM *vm)
Definition vm.c:316
void mrbc_vm_begin(struct VM *vm)
Definition vm.c:348
int mrbc_vm_run(struct VM *vm)
Definition vm.c:2889
void mrbc_vm_close(struct VM *vm)
Definition vm.c:411
struct VM mrbc_vm
Virtual Machine.
#define MAX_REGS_SIZE
Definition vm_config.h:23

Definition at line 292 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 ( struct VM * vm)

Open the VM.

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

Definition at line 316 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 ( struct 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 2889 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 1848 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 1888 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 2785 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 2342 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 2296 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 1351 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 2180 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 2201 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 2222 of file vm.c.

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

◆ op_arydup()

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

OP_ARYDUP

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

Definition at line 2281 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 2260 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 2326 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 1795 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 2528 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 1749 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 2607 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 2755 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 2022 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 (23=m5:o5:r1:m5:k5:d1:b1)

flags: 0mmm_mmoo_ooor_mmmm_mkkk_kkdb

Definition at line 1423 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 2075 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 1010 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 2699 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 2846 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 2159 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 710 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 625 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 892 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 659 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 784 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 827 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 2138 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 2462 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 2485 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 2508 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 2383 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 918 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 931 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 961 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 946 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 976 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 1606 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 1567 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 1585 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 2117 of file vm.c.

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

◆ op_loadf()

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

OP_LOADF

R[a] = false

Definition at line 611 of file vm.c.

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

◆ op_loadi()

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

OP_LOADI

R[a] = mrb_int(b)

Definition at line 479 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 525 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 540 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 507 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 493 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 465 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 568 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 582 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 554 of file vm.c.

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

◆ op_loadt()

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

OP_LOADT

R[a] = true

Definition at line 597 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 2096 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 2545 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 2665 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 450 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 1982 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 439 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 2592 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 1042 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 2577 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 2562 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 1025 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 1682 of file vm.c.

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

◆ op_return__sub()

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

op_return, op_return_blk subroutine.

Definition at line 1628 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 1695 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 2816 of file vm.c.

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 1231 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 1244 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 764 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 645 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 905 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 685 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 860 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 1195 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 1213 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 2860 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 2436 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 2422 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 1915 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 1955 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 1257 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 2401 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 2828 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 2873 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 ( struct 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 52 of file vm.c.

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

◆ sub_def_alias()

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

Definition at line 2726 of file vm.c.

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

◆ sub_irep_incref()

void sub_irep_incref ( mrbc_irep * irep,
int inc_dec )
static

Definition at line 2717 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 38 of file vm.c.