mruby/c VM Source Code release 4.0.0
Loading...
Searching...
No Matches
vm.h File Reference

mruby bytecode executor. More...

#include "value.h"
#include "symbol.h"
#include "c_proc.h"
Include dependency graph for vm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  IREP
 IREP Internal REPresentation. More...
struct  IREP_CATCH_HANDLER
 IREP Catch Handler. More...
struct  CALLINFO
 Call information. More...
struct  VM
 Virtual Machine. More...

Macros

#define mrbc_irep_tbl_syms(irep)
 get a symbol id table pointer.
#define mrbc_irep_symbol_id(irep, n)
 get a n'th symbol id in irep
#define mrbc_irep_symbol_cstr(irep, n)
 get a n'th symbol string in irep
#define mrbc_irep_tbl_pools(irep)
 get a pool data offset table pointer.
#define mrbc_irep_pool_ptr(irep, n)
 get a pointer to n'th pool data.
#define mrbc_irep_tbl_ireps(irep)
 get a child irep table pointer.
#define mrbc_irep_child_irep(irep, n)
 get a n'th child irep

Typedefs

typedef struct IREP mrbc_irep
 IREP Internal REPresentation.
typedef struct IREP_CATCH_HANDLER mrbc_irep_catch_handler
 IREP Catch Handler.
typedef struct CALLINFO mrbc_callinfo
 Call information.
typedef struct VM mrbc_vm
 Virtual Machine.

Functions

static mrbc_valuemrbc_get_self (mrbc_vm *vm, mrbc_value *regs)
static mrbc_sym mrbc_get_callee_symid (const mrbc_vm *vm)
static const char * mrbc_get_callee_name (const mrbc_vm *vm)
static int mrbc_c_block_given (mrbc_vm *vm, mrbc_value v[], int argc)

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.h.

Macro Definition Documentation

◆ mrbc_irep_child_irep

#define mrbc_irep_child_irep ( irep,
n )
Value:
( mrbc_irep_tbl_ireps(irep)[(n)] )
#define mrbc_irep_tbl_ireps(irep)
get a child irep table pointer.
Definition vm.h:96

get a n'th child irep

Definition at line 100 of file vm.h.

◆ mrbc_irep_pool_ptr

#define mrbc_irep_pool_ptr ( irep,
n )
Value:
( (irep)->pool + mrbc_irep_tbl_pools(irep)[(n)] )
#define mrbc_irep_tbl_pools(irep)
get a pool data offset table pointer.
Definition vm.h:87

get a pointer to n'th pool data.

Definition at line 91 of file vm.h.

◆ mrbc_irep_symbol_cstr

#define mrbc_irep_symbol_cstr ( irep,
n )
Value:
const char * mrbc_symid_to_str(mrbc_sym sym_id)
Definition symbol.c:242
#define mrbc_irep_symbol_id(irep, n)
get a n'th symbol id in irep
Definition vm.h:80

get a n'th symbol string in irep

Definition at line 83 of file vm.h.

◆ mrbc_irep_symbol_id

#define mrbc_irep_symbol_id ( irep,
n )
Value:
#define mrbc_irep_tbl_syms(irep)
get a symbol id table pointer.
Definition vm.h:77

get a n'th symbol id in irep

Definition at line 80 of file vm.h.

◆ mrbc_irep_tbl_ireps

#define mrbc_irep_tbl_ireps ( irep)
Value:
( (mrbc_irep **)((irep)->data + (irep)->ofs_ireps) )
struct IREP mrbc_irep
IREP Internal REPresentation.

get a child irep table pointer.

Definition at line 96 of file vm.h.

◆ mrbc_irep_tbl_pools

#define mrbc_irep_tbl_pools ( irep)
Value:
( (uint16_t *)((irep)->data + (irep)->ofs_pools) )

get a pool data offset table pointer.

Definition at line 87 of file vm.h.

◆ mrbc_irep_tbl_syms

#define mrbc_irep_tbl_syms ( irep)
Value:
((mrbc_sym *)(irep)->data)
int16_t mrbc_sym
mruby/c symbol ID
Definition value.h:62

get a symbol id table pointer.

Definition at line 77 of file vm.h.

Typedef Documentation

◆ mrbc_callinfo

typedef struct CALLINFO mrbc_callinfo

Call information.

◆ mrbc_irep

typedef struct IREP mrbc_irep

IREP Internal REPresentation.

◆ mrbc_irep_catch_handler

IREP Catch Handler.

◆ mrbc_vm

typedef struct VM mrbc_vm

Virtual Machine.

Function Documentation

◆ mrbc_c_block_given()

int mrbc_c_block_given ( mrbc_vm * vm,
mrbc_value v[],
int argc )
inlinestatic

(BETA) check if a block is passed to a method.

Parameters
vmA pointer to VM.
vregister top.
argcn of arguments.
Returns
0 or 1

Definition at line 241 of file vm.h.

◆ mrbc_get_callee_name()

const char * mrbc_get_callee_name ( const mrbc_vm * vm)
inlinestatic

get callee name

Parameters
vmPointer to VM
Returns
string

Definition at line 227 of file vm.h.

Here is the call graph for this function:

◆ mrbc_get_callee_symid()

mrbc_sym mrbc_get_callee_symid ( const mrbc_vm * vm)
inlinestatic

get callee symbol id

Parameters
vmPointer to VM
Returns
string

Definition at line 215 of file vm.h.

◆ mrbc_get_self()

mrbc_value * mrbc_get_self ( mrbc_vm * vm,
mrbc_value * regs )
inlinestatic

get the self object

Parameters
vmA pointer to VM.
regsregistor
Returns
pointer to self object

Definition at line 203 of file vm.h.

Here is the caller graph for this function: