mruby/c VM Source Code master (2026/08/06)
Loading...
Searching...
No Matches
class.c
Go to the documentation of this file.
1
14
15/***** Feature test switches ************************************************/
16/***** System headers *******************************************************/
17//@cond
18#include "vm_config.h"
19#include <stdint.h>
20#include <string.h>
21#include <assert.h>
22//@endcond
23
24/***** Local headers ********************************************************/
25#include "mrubyc.h"
26
27/***** Constant values ******************************************************/
28/***** Macros ***************************************************************/
29#define IS_CLASS_OR_MODULE(v) \
30 (mrbc_type(v) == MRBC_TT_CLASS || mrbc_type(v) == MRBC_TT_MODULE)
31
32
33/***** Typedefs *************************************************************/
34/***** Function prototypes **************************************************/
35/***** Local variables ******************************************************/
36/***** Global variables *****************************************************/
43 0, // MRBC_TT_EMPTY = 0,
44 MRBC_CLASS(NilClass), // MRBC_TT_NIL = 1,
45 MRBC_CLASS(FalseClass), // MRBC_TT_FALSE = 2,
46 MRBC_CLASS(TrueClass), // MRBC_TT_TRUE = 3,
47 MRBC_CLASS(Integer), // MRBC_TT_INTEGER = 4,
48#if MRBC_USE_FLOAT
49 MRBC_CLASS(Float), // MRBC_TT_FLOAT = 5,
50#else
51 0, // MRBC_TT_FLOAT = 5,
52#endif
53 MRBC_CLASS(Symbol), // MRBC_TT_SYMBOL = 6,
54 0, // MRBC_TT_CLASS = 7,
55 0, // MRBC_TT_MODULE = 8,
56 0, // MRBC_TT_OBJECT = 9,
57 MRBC_CLASS(Proc), // MRBC_TT_PROC = 10,
58 MRBC_CLASS(Array), // MRBC_TT_ARRAY = 11,
59#if MRBC_USE_STRING
60 MRBC_CLASS(String), // MRBC_TT_STRING = 12,
61#else
62 0, // MRBC_TT_STRING = 12,
63#endif
64 MRBC_CLASS(Range), // MRBC_TT_RANGE = 13,
65 MRBC_CLASS(Hash), // MRBC_TT_HASH = 14,
66 0, // MRBC_TT_EXCEPTION = 15,
67};
68
69
70/***** Signal catching functions ********************************************/
71/***** Local functions ******************************************************/
72//================================================================
80mrbc_class * mrbc_traverse_class_tree( mrbc_class *cls, mrbc_class *nest_buf[], int *nest_idx )
81{
82 cls = cls->super;
83
84 if( cls == 0 ) {
85 if( *nest_idx == 0 ) return 0; // does not have super class.
86 cls = nest_buf[--(*nest_idx)]; // rewind to the saved point.
87 cls = cls->super;
88 }
89
90 // when alias module
91 if( cls->flag_alias && cls->super ) {
92 // save the branch point to nest_buf.
93 if( *nest_idx >= MRBC_TRAVERSE_NEST_LEVEL ) {
94 mrbc_printf("Warning: Module nest exceeds upper limit.\n");
95 } else {
96 nest_buf[(*nest_idx)++] = cls;
97 }
98 }
99
100 return cls;
101}
102
103
104//================================================================
112{
113 if( *nest_idx == 0 ) return 0; // does not have super class.
114 return nest_buf[--(*nest_idx)]; // rewind to the saved point.
115}
116
117
118/***** Global functions *****************************************************/
119
120//----------------------------------------------------------------
121static mrbc_class * sub_define_class_or_module(struct VM *vm, const mrbc_class *outer, const char *name, mrbc_class *super, mrbc_vtype vtype)
122{
123 mrbc_sym sym_id = mrbc_str_to_symid(name);
124 if( sym_id < 0 ) {
125 mrbc_raise(vm, MRBC_CLASS(Exception), "Overflow MAX_SYMBOLS_COUNT");
126 return NULL;
127 }
128
129 // already defined?
130 const mrbc_value *val = outer ?
131 mrbc_get_class_const( outer, sym_id ) : mrbc_get_const(sym_id);
132
133 if( val ) {
134 if( mrbc_type(*val) != vtype ) { // is not TT_CLASS or TT_MODULE
135 mrbc_raisef(vm, MRBC_CLASS(TypeError), "%s is not a %s", name,
136 vtype == MRBC_TT_CLASS ? "class" : "module");
137 return NULL;
138 }
139 return val->cls;
140 }
141
142 // create a new class/module.
144 mrbc_sym sym_id1 = sym_id;
145
146 if( outer ) {
148
149 mrbc_make_nested_symbol_s( buf, outer->sym_id, sym_id );
150 sym_id1 = mrbc_symbol( mrbc_symbol_new( vm, buf ));
151 }
152
153 *cls = (mrbc_class){
154 .sym_id = sym_id1,
155 .flag_module = (vtype == MRBC_TT_MODULE),
156 .super = super,
157#if defined(MRBC_DEBUG)
158 .name = name,
159#endif
160 };
161#if defined(MRBC_DEBUG)
162 if( vtype == MRBC_TT_CLASS ) {
163 cls->obj_mark_[0] = 'C';
164 cls->obj_mark_[1] = 'L';
165 } else {
166 cls->obj_mark_[0] = 'M';
167 cls->obj_mark_[1] = 'O';
168 }
169#endif
170 mrbc_kv_init_handle( vm, &cls->ivar, 0 );
171
172 // register to global constant
173 if( outer ) {
174 mrbc_set_class_const( outer, sym_id, &mrbc_immediate_value(vtype, .cls = cls) );
175 } else {
176 mrbc_set_const( sym_id, &mrbc_immediate_value(vtype, .cls = cls) );
177 }
178
179 return cls;
180}
181
182
183//================================================================
191mrbc_class * mrbc_define_class(struct VM *vm, const char *name, mrbc_class *super)
192{
193 return sub_define_class_or_module( vm, NULL, name,
194 (super ? super : MRBC_CLASS(Object)), MRBC_TT_CLASS );
195}
196
197
198//================================================================
207mrbc_class * mrbc_define_class_under(struct VM *vm, const mrbc_class *outer, const char *name, mrbc_class *super)
208{
209 return sub_define_class_or_module( vm, outer, name,
210 (super ? super : MRBC_CLASS(Object)), MRBC_TT_CLASS );
211}
212
213
214//================================================================
221mrbc_class * mrbc_define_module(struct VM *vm, const char *name)
222{
223 return sub_define_class_or_module( vm, NULL, name, NULL, MRBC_TT_MODULE );
224}
225
226
227//================================================================
235mrbc_class * mrbc_define_module_under(struct VM *vm, const mrbc_class *outer, const char *name)
236{
237 return sub_define_class_or_module( vm, outer, name, NULL, MRBC_TT_MODULE);
238}
239
240
241//================================================================
249void mrbc_define_method(struct VM *vm, mrbc_class *cls, const char *name, mrbc_func_t cfunc)
250{
251 if( cls == NULL ) cls = MRBC_CLASS(Object); // set default to Object.
252 if( cls->flag_nomethod ) {
253 mrbc_raisef(vm, MRBC_CLASS(NotImplementedError),
254 "Adding methods to the %s class is not supported",
256 return;
257 }
258
260
261 method->type = 'm';
262 method->c_func = 1;
263 method->sym_id = mrbc_str_to_symid( name );
264 if( method->sym_id < 0 ) {
265 mrbc_raise(vm, MRBC_CLASS(Exception), "Overflow MAX_SYMBOLS_COUNT");
266 }
267 method->func = cfunc;
268 method->next = cls->method_link;
269 cls->method_link = method;
270}
271
272
273//================================================================
281mrbc_value mrbc_instance_new(struct VM *vm, mrbc_class *cls, int size)
282{
283 mrbc_instance *instance = mrbc_alloc(vm, sizeof(mrbc_instance) + size);
284
285 *instance = (mrbc_instance){
287 .cls = cls,
289 };
290
291 return mrbc_immediate_value(MRBC_TT_OBJECT, .instance = instance);
292}
293
294
295//================================================================
301{
302 assert( mrbc_type(*v) == MRBC_TT_OBJECT );
303
304#if MRBC_INSTANCE_DESTRUCTOR
305 mrbc_class *cls = v->instance->cls;
306 if( !cls->flag_builtin && cls->destructor ) cls->destructor( v );
307#endif
308
311}
312
313
314//================================================================
323{
324 mrbc_kv_handle *kvh;
325
326 assert(mrbc_type(*target) == MRBC_TT_CLASS ||
327 mrbc_type(*target) == MRBC_TT_OBJECT);
328
329 if( mrbc_type(*target) == MRBC_TT_CLASS ) {
330 if( target->cls->flag_builtin ) return E_NOTIMP_ERROR;
331 kvh = &target->cls->ivar;
332 } else {
333 kvh = &target->instance->ivar;
334 }
335
336 mrbc_incref(v);
337 mrbc_kv_set( kvh, sym_id, v );
338
339 return 0;
340}
341
342
343//================================================================
351{
352 mrbc_kv_handle *kvh;
353
354 assert(mrbc_type(*target) == MRBC_TT_CLASS ||
355 mrbc_type(*target) == MRBC_TT_OBJECT);
356
357 if( mrbc_type(*target) == MRBC_TT_CLASS ) {
358 if( target->cls->flag_builtin ) return mrbc_nil_value();
359 kvh = &target->cls->ivar;
360 } else {
361 kvh = &target->instance->ivar;
362 }
363
364 mrbc_value *v = mrbc_kv_get( kvh, sym_id );
365 if( !v ) return mrbc_nil_value();
366
367 mrbc_incref(v);
368 return *v;
369}
370
371
372#if defined(MRBC_ALLOC_VMID)
373//================================================================
378void mrbc_instance_clear_vm_id(mrbc_value *v)
379{
380 mrbc_set_vm_id( v->instance, 0 );
381 mrbc_kv_clear_vm_id( &v->instance->ivar );
382}
383#endif
384
385
386//================================================================
393int mrbc_obj_is_kind_of( const mrbc_value *obj, const mrbc_class *tcls )
394{
395 mrbc_class *cls = find_class_by_object( obj );
397 int nest_idx = 0;
398
399 while( cls != tcls ) {
400 cls = mrbc_traverse_class_tree( cls, nest_buf, &nest_idx );
401 if( !cls ) return 0;
402 if( cls->flag_alias ) cls = cls->aliased;
403 }
404
405 return 1;
406}
407
408
409//================================================================
418{
420 int nest_idx = 0;
421 int flag_module = cls->flag_module;
422 mrbc_class *cls_save = cls;
423
424 if( cls->flag_alias ) {
425 if( cls->super ) nest_buf[nest_idx++] = cls;
426 cls = cls->aliased;
427 }
428
429 while( 1 ) {
430 mrbc_method *method;
431
432 assert( !cls->flag_alias );
433 if( cls->flag_nomethod ) goto next_class;
434 for( method = cls->method_link; method != 0; method = method->next ) {
435 if( method->sym_id == sym_id ) {
436 *r_method = *method;
437 r_method->cls = cls_save;
438 return cls_save;
439 }
440 }
441
442 struct RBuiltinClass *c = (struct RBuiltinClass *)cls;
443 int right = c->num_builtin_method;
444 if( right == 0 ) goto next_class;
445 right--;
446 int left = 0;
447
448 while( left < right ) {
449 int mid = (left + right) / 2;
450 if( c->method_symbols[mid] < sym_id ) {
451 left = mid + 1;
452 } else {
453 right = mid;
454 }
455 }
456
457 if( c->method_symbols[right] == sym_id ) {
458 *r_method = (mrbc_method){
459 .type = 'm',
460 .c_func = 2,
461 .sym_id = sym_id,
462 .func = c->method_functions[right],
463 .cls = cls_save,
464 };
465 return cls_save;
466 }
467
468 next_class:
469 cls = mrbc_traverse_class_tree( cls, nest_buf, &nest_idx );
470 if( cls == NULL ) {
471 if( !flag_module ) break;
472 cls = MRBC_CLASS(Object);
473 flag_module = 0;
474 }
475 cls_save = cls;
476 if( cls->flag_alias ) {
477 cls = cls->aliased;
478 }
479 } // loop next.
480
481 return NULL;
482}
483
484
485//================================================================
492{
494 if( sym_id < 0 ) return NULL;
495
497 if( obj == NULL ) return NULL;
498 if( !IS_CLASS_OR_MODULE(*obj) ) return NULL;
499
500 return obj->cls;
501}
502
503
504//================================================================
526mrbc_value mrbc_send( struct VM *vm, mrbc_value *v, int argc,
527 mrbc_value *recv, const char *method_name, int n_params, ... )
528{
529 mrbc_method method;
530 mrbc_class *cls = find_class_by_object(recv);
531 mrbc_sym sym_id = mrbc_str_to_symid(method_name);
532
533 if( mrbc_find_method( &method, cls, sym_id ) == 0 ) {
534 mrbc_raisef(vm, MRBC_CLASS(NoMethodError), "undefined method '%s' for %s",
535 method_name, mrbc_symid_to_str(cls->sym_id) );
536 goto ERROR;
537 }
538 if( !method.c_func ) {
539 mrbc_raisef(vm, MRBC_CLASS(NotImplementedError),
540 "Method needs to be C function. '%s' for %s",
541 method_name, mrbc_symid_to_str(cls->sym_id) );
542 goto ERROR;
543 }
544
545 // create call stack.
546 mrbc_value *regs = v + argc + 2;
547 mrbc_decref( &regs[0] );
548 regs[0] = *recv;
549 mrbc_incref(recv);
550
551 va_list ap;
552 va_start(ap, n_params);
553 int i;
554 for( i = 1; i <= n_params; i++ ) {
555 mrbc_decref( &regs[i] );
556 regs[i] = *va_arg(ap, mrbc_value *);
557 }
558 mrbc_decref( &regs[i] );
559 mrbc_set_nil( &regs[i] );
560 va_end(ap);
561
562 // call method.
563 vm->callee_sym_id = sym_id;
564 method.func(vm, regs, n_params);
565 mrbc_value ret = regs[0];
566
567 for(; i >= 0; i-- ) {
568 mrbc_set_tt(&regs[i], MRBC_TT_EMPTY);
569 }
570
571 return ret;
572
573 ERROR:
574 return mrbc_nil_value();
575}
576
577
578//================================================================
581void c_ineffect(struct VM *vm, mrbc_value v[], int argc)
582{
583 // nothing to do.
584}
585
586
587//================================================================
593int mrbc_run_mrblib(const void *bytecode)
594{
595 // instead of mrbc_vm_open()
597
598 if( mrbc_load_mrb(vm, bytecode) ) {
600 return 2;
601 }
602
603 int ret;
604
605 mrbc_vm_begin(vm);
606 do {
607 ret = mrbc_vm_run(vm);
608 } while( ret == 0 );
609 mrbc_vm_end(vm);
610 mrbc_vm_close(vm);
611
612 return ret;
613}
614
615#define MRBC_DEFINE_BUILTIN_CLASS_TABLE
616#include "_autogen_builtin_class.h"
617#undef MRBC_DEFINE_BUILTIN_CLASS_TABLE
618
619
620//================================================================
628
629
630//================================================================
634{
635 mrbc_value vcls;
636
637 for( int i = 0; i < sizeof(MRBC_BuiltinClass)/sizeof(struct MRBC_BuiltinClass); i++ ) {
638 mrbc_class *cls = MRBC_BuiltinClass[i].cls;
639
640 cls->super = MRBC_BuiltinClass[i].super;
641 if( !cls->flag_nomethod ) cls->method_link = 0;
643 vcls.cls = cls;
644
645 mrbc_set_const( cls->sym_id, &vcls );
646 }
647
648#if MRBC_USE_MATH
650#endif
651}
652
653
654//================================================================
658{
659 extern const uint8_t mrblib_bytecode[];
660 mrbc_run_mrblib(mrblib_bytecode);
661}
void * mrbc_raw_alloc_no_free(unsigned int size)
Definition alloc.c:631
void mrbc_raw_free(void *ptr)
Definition alloc.c:707
static void mrbc_set_nil(mrbc_value *p)
Definition boxing_no.h:99
#define mrbc_immediate_value(...)
Definition boxing_no.h:75
#define mrbc_symbol(o)
Definition boxing_no.h:62
#define mrbc_nil_value()
Definition boxing_no.h:70
static void mrbc_set_tt(mrbc_value *p, mrbc_vtype type)
Definition boxing_no.h:125
#define mrbc_type(o)
Definition boxing_no.h:57
struct RObject mrbc_value
Value object. Default version.
void mrbc_init_module_math(void)
Definition c_math.c:246
mrbc_value mrbc_instance_new(struct VM *vm, mrbc_class *cls, int size)
Definition class.c:281
mrbc_class * mrbc_get_class_by_name(const char *name)
Definition class.c:491
mrbc_class * mrbc_find_method(mrbc_method *r_method, mrbc_class *cls, mrbc_sym sym_id)
Definition class.c:417
void mrbc_init_class(void)
Definition class.c:623
mrbc_class * mrbc_define_module_under(struct VM *vm, const mrbc_class *outer, const char *name)
Definition class.c:235
void c_ineffect(struct VM *vm, mrbc_value v[], int argc)
Definition class.c:581
int mrbc_obj_is_kind_of(const mrbc_value *obj, const mrbc_class *tcls)
Definition class.c:393
void mrbc_init_class_c(void)
Definition class.c:633
void mrbc_define_method(struct VM *vm, mrbc_class *cls, const char *name, mrbc_func_t cfunc)
Definition class.c:249
mrbc_value mrbc_instance_getiv(mrbc_value *target, mrbc_sym sym_id)
Definition class.c:350
mrbc_class * mrbc_traverse_class_tree(mrbc_class *cls, mrbc_class *nest_buf[], int *nest_idx)
Definition class.c:80
void mrbc_init_class_mrblib(void)
Definition class.c:657
void mrbc_instance_delete(mrbc_value *v)
Definition class.c:300
#define IS_CLASS_OR_MODULE(v)
Definition class.c:29
mrbc_class * mrbc_define_module(struct VM *vm, const char *name)
Definition class.c:221
int mrbc_run_mrblib(const void *bytecode)
Definition class.c:593
mrbc_value mrbc_send(struct VM *vm, mrbc_value *v, int argc, mrbc_value *recv, const char *method_name, int n_params,...)
Definition class.c:526
mrbc_class * mrbc_define_class_under(struct VM *vm, const mrbc_class *outer, const char *name, mrbc_class *super)
Definition class.c:207
static mrbc_class * sub_define_class_or_module(struct VM *vm, const mrbc_class *outer, const char *name, mrbc_class *super, mrbc_vtype vtype)
Definition class.c:121
int mrbc_instance_setiv(mrbc_value *target, mrbc_sym sym_id, mrbc_value *v)
Definition class.c:322
mrbc_class *const mrbc_class_tbl[MRBC_TT_MAXVAL+1]
Definition class.c:42
mrbc_class * mrbc_define_class(struct VM *vm, const char *name, mrbc_class *super)
Definition class.c:191
mrbc_class * mrbc_traverse_class_tree_skip(mrbc_class *nest_buf[], int *nest_idx)
Definition class.c:111
struct RInstance mrbc_instance
Instance object.
#define MRBC_TRAVERSE_NEST_LEVEL
Definition class.h:35
struct RMethod mrbc_method
Method management structure.
#define MRBC_CLASS(cls)
Definition class.h:55
static mrbc_class * find_class_by_object(const mrbc_value *obj)
Definition class.h:265
struct RClass mrbc_class
Class object.
void mrbc_printf(const char *fstr,...)
Definition console.c:205
void mrbc_raise(struct VM *vm, struct RClass *exc_cls, const char *msg)
Definition error.c:145
void mrbc_print_vm_exception(const struct VM *vm)
Definition error.c:231
void mrbc_raisef(struct VM *vm, struct RClass *exc_cls, const char *fstr,...)
Definition error.c:168
int mrbc_set_class_const(const mrbc_class *cls, mrbc_sym sym_id, mrbc_value *v)
Definition global.c:76
mrbc_value * mrbc_get_const(mrbc_sym sym_id)
Definition global.c:93
int mrbc_set_const(mrbc_sym sym_id, mrbc_value *v)
Definition global.c:57
mrbc_value * mrbc_get_class_const(const mrbc_class *cls, mrbc_sym sym_id)
Definition global.c:106
int mrbc_kv_init_handle(struct VM *vm, mrbc_kv_handle *kvh, int size)
Definition keyvalue.c:128
void mrbc_kv_delete_data(mrbc_kv_handle *kvh)
Definition keyvalue.c:167
mrbc_value * mrbc_kv_get(mrbc_kv_handle *kvh, mrbc_sym sym_id)
Definition keyvalue.c:284
int mrbc_kv_set(mrbc_kv_handle *kvh, mrbc_sym sym_id, mrbc_value *set_val)
Definition keyvalue.c:228
#define MRBC_KVH_INITIALIZER(vm)
Definition keyvalue.h:63
struct RKeyValueHandle mrbc_kv_handle
Key-Value handle.
int mrbc_load_mrb(mrbc_vm *vm, const void *bytecode)
Definition load.c:306
Include at once the necessary header files.
Built-in class object.
Definition class.h:128
uint8_t num_builtin_method
num of built-in method.
Definition class.h:139
unsigned int flag_module
is module?
Definition class.h:137
mrbc_sym sym_id
class name's symbol ID
Definition class.h:134
const mrbc_sym * method_symbols
built-in method sym-id table.
Definition class.h:148
const mrbc_func_t * method_functions
built-in method function table.
Definition class.h:149
struct RMethod * method_link
pointer to method link.
Definition class.h:107
unsigned int flag_alias
is module alias?
Definition class.h:101
struct RClass * super
pointer to super class.
Definition class.h:103
struct RClass * aliased
aliased class or module.
Definition class.h:108
unsigned int flag_builtin
is built-in class? (= 0)
Definition class.h:98
mrbc_sym sym_id
class name's symbol ID
Definition class.h:97
void(* destructor)(mrbc_value *)
specify a destructor if need.
Definition class.h:112
unsigned int flag_nomethod
is built-in no method class? (= 0)
Definition class.h:99
mrbc_kv_handle ivar
class instance valiables.
Definition class.h:114
unsigned int flag_module
is module?
Definition class.h:100
struct RClass * cls
pointer to class of this object.
Definition class.h:183
struct RKeyValueHandle ivar
instance variable.
Definition class.h:184
struct RClass * cls
return value for mrbc_find_method.
Definition class.h:208
mrbc_sym sym_id
function names symbol ID
Definition class.h:201
uint8_t type
M:OP_DEF or OP_ALIAS, m:mrblib or define_method().
Definition class.h:199
struct RMethod * next
link to next method.
Definition class.h:207
uint8_t c_func
0:IREP, 1:C Func, 2:C Func (built-in)
Definition class.h:200
mrbc_func_t func
to C function.
Definition class.h:204
struct RInstance * instance
Definition boxing_no.h:29
struct RClass * cls
Definition boxing_no.h:28
Virtual Machine.
Definition vm.h:150
mrbc_sym callee_sym_id
Current called method.
Definition vm.h:170
mrbc_sym mrbc_search_symid(const char *str)
Definition symbol.c:259
mrbc_value mrbc_symbol_new(struct VM *vm, const char *str)
Definition symbol.c:335
mrbc_sym mrbc_str_to_symid(const char *str)
Definition symbol.c:218
void mrbc_make_nested_symbol_s(char *buf, mrbc_sym id1, mrbc_sym id2)
Definition symbol.c:279
const char * mrbc_symid_to_str(mrbc_sym sym_id)
Definition symbol.c:239
#define MRBC_NESTED_SYMBOL_BUF_LEN
Definition symbol.h:28
static void mrbc_decref(mrbc_value *v)
Definition value.h:572
#define MRBC_INIT_OBJECT_HEADER_DI(t)
Definition value.h:147
void(* mrbc_func_t)(struct VM *vm, struct RObject *v, int argc)
Definition value.h:63
#define MRBC_TT_MAXVAL
Definition value.h:104
static void mrbc_incref(mrbc_value *v)
Definition value.h:557
@ E_NOTIMP_ERROR
Definition value.h:123
int16_t mrbc_sym
mruby/c symbol ID
Definition value.h:62
mrbc_vtype
Definition value.h:69
@ MRBC_TT_EMPTY
Definition value.h:80
@ MRBC_TT_OBJECT
General instance.
Definition value.h:95
@ MRBC_TT_MODULE
Module.
Definition value.h:91
@ MRBC_TT_CLASS
Class.
Definition value.h:90
void mrbc_vm_close(mrbc_vm *vm)
Definition vm.c:402
mrbc_vm * mrbc_vm_new(int regs_size)
Definition vm.c:287
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.
Global configuration of mruby/c VM's.
#define MAX_REGS_SIZE
Definition vm_config.h:25
#define MRBC_DEBUG
Definition vm_config.h:122