mrb_state* mrb_open_core(mrb_allocf f, void *ud) { static const mrb_state mrb_state_zero = { 0 }; static const struct mrb_context mrb_context_zero = { 0 }; mrb_state *mrb; mrb = (mrb_state *)(f)(NULL, NULL, sizeof(mrb_state), ud); if (mrb == NULL) return NULL; *mrb = mrb_state_zero; mrb->ud = ud; mrb->allocf = f; mrb->current_white_part = MRB_GC_WHITE_A; mrb->atexit_stack_len = 0; #ifndef MRB_GC_FIXED_ARENA mrb->arena = (struct RBasic**)mrb_malloc(mrb, sizeof(struct RBasic*)*MRB_GC_ARENA_SIZE); mrb->arena_capa = MRB_GC_ARENA_SIZE; #endif mrb_init_heap(mrb); mrb->c = (struct mrb_context*)mrb_malloc(mrb, sizeof(struct mrb_context)); *mrb->c = mrb_context_zero; mrb->root_c = mrb->c; mrb_init_core(mrb); return mrb; }
mrb_state* mrb_open_allocf(mrb_allocf f, void *ud) { static const mrb_state mrb_state_zero = { 0 }; static const struct mrb_context mrb_context_zero = { 0 }; mrb_state *mrb; #ifdef MRB_NAN_BOXING mrb_assert(sizeof(void*) == 4); #endif mrb = (mrb_state *)(f)(NULL, NULL, sizeof(mrb_state), ud); if (mrb == NULL) return NULL; *mrb = mrb_state_zero; mrb->ud = ud; mrb->allocf = f; mrb->current_white_part = MRB_GC_WHITE_A; mrb_init_heap(mrb); mrb->c = (struct mrb_context*)mrb_malloc(mrb, sizeof(struct mrb_context)); *mrb->c = mrb_context_zero; mrb->root_c = mrb->c; mrb_init_core(mrb); return mrb; }
mrb_state* mrb_open_allocf(mrb_allocf f) { mrb_state *mrb = (f)(NULL, NULL, sizeof(mrb_state)); memset(mrb, 0, sizeof(mrb_state)); mrb->allocf = f; mrb->current_white_part = MRB_GC_WHITE_A; mrb_init_heap(mrb); mrb_init_core(mrb); mrb_init_ext(mrb); return mrb; }
mrb_state* mrb_open_allocf(mrb_allocf f, void *ud) { mrb_state *mrb = (mrb_state *)(f)(NULL, NULL, sizeof(mrb_state), ud); if (mrb == NULL) return NULL; memset(mrb, 0, sizeof(mrb_state)); mrb->ud = ud; mrb->allocf = f; mrb->current_white_part = MRB_GC_WHITE_A; mrb_init_heap(mrb); mrb_init_core(mrb); mrb_init_ext(mrb); return mrb; }
mrb_state* mrb_open_allocf(mrb_allocf f, void *ud) { static const mrb_state mrb_state_zero = { 0 }; static const struct mrb_context mrb_context_zero = { 0 }; mrb_state *mrb; #ifdef MRB_NAN_BOXING mrb_assert(sizeof(void*) == 4); #endif mrb = (mrb_state *)(f)(NULL, NULL, sizeof(mrb_state), ud); if (mrb == NULL) return NULL; *mrb = mrb_state_zero; mrb->ud = ud; mrb->allocf = f; mrb->current_white_part = MRB_GC_WHITE_A; mrb->compile_info.prev_pc = NULL; mrb->compile_info.code_base = NULL; mrb->compile_info.prev_coi = NULL; mrb->compile_info.disable_jit = 0; mrb->compile_info.nest_level = 0; #ifndef MRB_GC_FIXED_ARENA mrb->arena = (struct RBasic**)mrb_malloc(mrb, sizeof(struct RBasic*)*MRB_GC_ARENA_SIZE); mrb->arena_capa = MRB_GC_ARENA_SIZE; #endif mrb_init_heap(mrb); mrb->c = (struct mrb_context*)mrb_malloc(mrb, sizeof(struct mrb_context)); *mrb->c = mrb_context_zero; mrb->root_c = mrb->c; mrb_init_core(mrb); return mrb; }