Skip to content

Instantly share code, notes, and snippets.

@miura1729
Created February 22, 2026 10:04
Show Gist options
  • Select an option

  • Save miura1729/656269342c565f43330d97bc0586997d to your computer and use it in GitHub Desktop.

Select an option

Save miura1729/656269342c565f43330d97bc0586997d to your computer and use it in GitHub Desktop.
#include <mruby.h>
#include <mruby/value.h>
#include <mruby/array.h>
#include <mruby/hash.h>
#include <mruby/throw.h>
#include <mruby/proc.h>
#include <mruby/string.h>
#include <mruby/range.h>
#include <mruby/error.h>
#include <mruby/variable.h>
#include <mruby/throw.h>
#include <mruby/data.h>
#include <mruby/class.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <pthread.h>
#undef mrb_int
typedef mrb_float mrb_float2;
#define mrb_float_value2(n) ({\
mrb_value rc; \
rc.f = n; \
rc; \
})
#define mmc_boxing_array(src, size, boxing_func) ({ \
mrb_value ary; \
ary = mrb_ary_new_capa(mrb, (size)); \
for (int i = 0; i < (size); i++) { \
mrb_ary_push(mrb, ary, (boxing_func)(mrb, (src)[i])); \
} \
ary; \
})
#define ARY_PTR2(a) ({struct RArray* ary=(a);ARY_PTR(ary);})
#define ARY_LEN2(a) ({struct RArray* ary=(a);ARY_LEN(ary);})
typedef void *gproc;
struct gctab {
int size;
int csize;
int osize;
struct gctab *prev;
mrb_value **complex;
mrb_value **object;
void *caller_alloc;
int ret_status;
mrb_value *single[0];
};
typedef mrb_value mrb_value_mutex;
typedef mrb_value mrb_value_mutex_emptylock;
struct mutex_wrapper {
pthread_mutex_t mp;
mrb_value obj;
};
struct mutex_wrapper_emptylock {
pthread_mutex_t mp;
pthread_cond_t empty_cond;
mrb_value obj;
};
void mrb_mutex_free(mrb_state *mrb, void *data)
{
struct mutex_wrapper *mutex_data = (struct mutex_wrapper *)data;
pthread_mutex_destroy(&mutex_data->mp);
mrb_free(mrb, data);
}
mrb_data_type mutex_data_header = {"Mutex Data", mrb_mutex_free};
mrb_data_type thread_data_header = {"Thread Data", mrb_free};
struct thread_list {
struct pthead_t *thread;
mrb_state *mrb;
struct thread_list *next;
};
struct mmc_system {
struct RClass *pthread_class;
struct thread_list *thread_list;
mrb_state *root_mrb;
pthread_mutex_t *io_mutex;
pthread_mutex_t *gc_mutex;
};
typedef unsigned char v16uc __attribute__ ((vector_size (16)));
void mrb_mark_local(mrb_state *mrb)
{
if (mrb->ud == NULL) {
return;
}
struct thread_list *thlist = ((struct mmc_system *)mrb->ud)->thread_list;
while (thlist) {
mrb_state *tmrb = thlist->mrb;
struct gctab *curtab = (struct gctab *)tmrb->allocf_ud;
thlist = thlist->next;
while (curtab) {
for (int i = curtab->size; i--;) {
if (!mrb_immediate_p(*curtab->single[i])) {
mrb_gc_mark(mrb, mrb_basic_ptr(*curtab->single[i]));
}
}
for (int i = curtab->osize; i--;) {
if (!mrb_immediate_p(*curtab->object[i])) {
mrb_gc_mark(mrb, mrb_basic_ptr(*curtab->object[i]));
}
}
for (int i = curtab->csize; i--;) {
mrb_value *cptr = curtab->complex[i];
for (int j = 0; cptr[j].value.ttt != MRB_TT_FREE; j++) {
if (!mrb_immediate_p(cptr[i])) {
mrb_gc_mark(mrb, mrb_basic_ptr(cptr[j]));
}
}
}
curtab = curtab->prev;
}
}
}
struct env2 {
struct env0 *prev;
};
struct env5 {
struct env2 *prev;
};
struct env16 {
struct env2 *prev;
};
struct env31 {
struct env2 *prev;
};
struct env34 {
struct env2 *prev;
};
struct env38 {
struct env2 *prev;
};
struct env8 {
struct env5 *prev;
};
struct env11 {
struct env5 *prev;
};
struct env14 {
struct env5 *prev;
};
struct env20 {
struct env16 *prev;
};
struct env41 {
struct env38 *prev;
};
struct env29 {
struct env20 *prev;
};
struct cls0_24 {
};
struct cls2_25 {
uint8_t *v1303; /* @strage */
mrb_int v1304; /* @capa */
mrb_int v1306; /* @st */
mrb_int v1308; /* @ed */
};
static mrb_value main_Object_0(mrb_state *, mrb_value v9,struct gctab *);
static mrb_value main__Object__1(mrb_state *, mrb_value v356,struct gctab *);
mrb_value const0;
mrb_value const1;
static struct cls2_25 * to_ustringbuf__String__2(mrb_state *, char *v843,struct gctab *);
struct proc17 {
int id;
void *code[1];
struct env16 *env;
mrb_value self;
};
static mrb_int find1__Object__7(mrb_state *, mrb_value v4873, struct cls2_25 * v4874,struct gctab *);
struct proc32 {
int id;
void *code[1];
struct env31 *env;
mrb_value self;
};
static mrb_int find2__Object__7(mrb_state *, mrb_value v10412, struct cls2_25 * v10413,struct gctab *);
struct proc35 {
int id;
void *code[1];
struct env34 *env;
mrb_value self;
};
static mrb_int find3__Object__7(mrb_state *, mrb_value v10832, struct cls2_25 * v10833,struct gctab *);
static mrb_value fff__StringView__20(mrb_state *, struct cls2_25 * v12075,struct gctab *);
static mrb_int initialize__StringView__3(mrb_state *, struct cls2_25 * v2108, uint8_t *v2109, mrb_int v2110,struct gctab *);
static mrb_value _b_B_e__StringView__6(mrb_state *, struct cls2_25 * v3289, mrb_int v3290, uint8_t v3291,struct gctab *);
static mrb_int ed_e__StringView__5(mrb_state *, struct cls2_25 * v4514, mrb_int v4515,struct gctab *);
mrb_value const2;
mrb_value const3;
mrb_value const4;
static mrb_int each__StringView__8(mrb_state *, struct cls2_25 * v6091, gproc v6092,struct gctab *);
static mrb_int each__StringView__14(mrb_state *, struct cls2_25 * v6091, gproc v6092,struct gctab *);
static mrb_int each__StringView__17(mrb_state *, struct cls2_25 * v6091, gproc v6092,struct gctab *);
struct proc42 {
int id;
void *code[1];
struct env41 *env;
struct cls2_25 * self;
};
static mrb_value ttt_uaux__StringView__20(mrb_state *, struct cls2_25 * v13249,struct gctab *);
static mrb_int initialize__StringView__9(mrb_state *, struct cls2_25 * v2108, uint8_t *v2109, mrb_int v2110,struct gctab *);
static v16uc to_usimd__StringView__5(mrb_state *, struct cls2_25 * v10035, mrb_int v10036,struct gctab *);
mrb_value const5;
static mrb_value each__StringView__21(mrb_state *, struct cls2_25 * v6091, gproc v6092,struct gctab *);
int main(int argc, char **argv)
{
mrb_state *mrb = mrb_open();
struct mrb_jmpbuf c_jmp;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
struct RClass *pthread_class;
struct thread_list *thread_list;
pthread_mutex_t *io_mutex;
pthread_mutex_t *gc_mutex;
struct mmc_system *mmc_system;
gctab->prev = NULL;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
mmc_system = malloc(sizeof(struct mmc_system));
pthread_class = mrb_define_class(mrb, "Pthread", mrb->object_class);
mmc_system->pthread_class = pthread_class;
thread_list = malloc(sizeof(struct thread_list));
thread_list->thread = pthread_self();
thread_list->next = NULL;
thread_list->mrb = mrb;
mmc_system->thread_list = thread_list;
io_mutex = malloc(sizeof(pthread_mutex_t));
pthread_mutex_init(io_mutex, NULL);
mmc_system->root_mrb = mrb;
mmc_system->io_mutex = io_mutex;
gc_mutex = malloc(sizeof(pthread_mutex_t));
pthread_mutex_init(gc_mutex, NULL);
mmc_system->gc_mutex = gc_mutex;
mrb->ud = (void *)mmc_system;
MRB_SET_INSTANCE_TT(((struct mmc_system *)mrb->ud)->pthread_class, MRB_TT_DATA);
MRB_TRY(&c_jmp) {
mrb->jmp = &c_jmp;
main_Object_0(mrb, mrb_top_self(mrb), gctab);
}
MRB_CATCH(&c_jmp) {
mrb_p(mrb, mrb_obj_value(mrb->exc));
return 1;
}
MRB_END_EXC(&c_jmp);
return 0;
}
static mrb_value main_Object_0(mrb_state *mrb, mrb_value v9, struct gctab *prevgctab) {
mrb_value self;
mrb_value mutexself;
mrb_value v16;
struct gctab *gctab = prevgctab;
L0:;
mutexself = v9;
self = v9;
/* START END */
v16 = main__Object__1(mrb, self, gctab);
return v16;
}
static mrb_value main__Object__1(mrb_state *mrb, mrb_value v356, struct gctab *prevgctab) {
struct env2 env;
struct REnv *venv = NULL;
mrb_value self;
mrb_value mutexself;
char *v371 = "foo";
struct cls2_25 * v373;
mrb_int v378;
mrb_int v382;
mrb_int v386;
mrb_value v389;
mrb_value v392;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab) + 0 * sizeof(mrb_value *));
gctab->prev = prevgctab;
gctab->complex = NULL;
gctab->object = NULL;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L22:;
mutexself = v356;
self = v356;
/* START END */
gctab->caller_alloc = alloca((sizeof(uint8_t) * (1024 + 1)) + (sizeof(struct cls2_25 )) + (sizeof(uint8_t) * (1024 + 1)) + (sizeof(struct cls2_25 )));
v373 = to_ustringbuf__String__2(mrb, "foo", gctab);
v378 = find1__Object__7(mrb, self, v373, gctab);
v382 = find2__Object__7(mrb, self, v373, gctab);
v386 = find3__Object__7(mrb, self, v373, gctab);
v389 = fff__StringView__20(mrb, v373, gctab);
v392 = fff__StringView__20(mrb, v373, gctab);
return mrb_nil_value();
}
static struct cls2_25 * to_ustringbuf__String__2(mrb_state *mrb, char *v843, struct gctab *prevgctab) {
struct env5 env;
struct REnv *venv = NULL;
char *self;
char *mutexself;
uint8_t *v872;
struct cls2_25 * v875;
mrb_int v880;
struct cls2_25 * v908;
mrb_int v909;
mrb_int v910;
mrb_bool v919;/*snd1*/
uint8_t v896;
mrb_value v901;
mrb_int v903;/*snd1*/
mrb_int v935;
struct gctab *gctab = prevgctab;
L49:;
mutexself = v843;
self = "foo";
/* START END */
v872 = prevgctab->caller_alloc;
prevgctab->caller_alloc += sizeof(uint8_t) * 1025;
v875 = prevgctab->caller_alloc;
prevgctab->caller_alloc += sizeof(struct cls2_25);
v875->v1303 = NULL;
initialize__StringView__3(mrb, v875, v872, 1024, gctab);
v880 = 3;
v908 = v875; /* 1*/
v909 = 0; /* 1*/
v910 = v880; /* 1*/
L51:;
v919 = (v909 < v910);
if (v919) goto L50; else goto L52;
L50:;
{
pthread_mutex_t *mut = (((struct mmc_system *)mrb->ud)->io_mutex);
pthread_mutex_lock(mut);
}
v896 = self[v909];
pthread_mutex_unlock(((struct mmc_system *)mrb->ud)->io_mutex);
v901 = _b_B_e__StringView__6(mrb, v908, v909, v896, gctab);
v903 = (v909 + 1);
v908 = v908; /* 2*/
v909 = v903; /* 2*/
v910 = v910; /* 2*/
goto L51;
L52:;
v935 = ed_e__StringView__5(mrb, v908, v909, gctab);
return v908;
}
static mrb_int find1__Object__7(mrb_state *mrb, mrb_value v4873, struct cls2_25 * v4874, struct gctab *prevgctab) {
struct env16 env;
struct REnv *venv = NULL;
mrb_value self;
mrb_value mutexself;
struct cls2_25 * v4879;
struct proc17 v4887;
mrb_int v4929;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L272:;
mutexself = v4873;
self = v4873;
v4879 = v4874;
/* START END */
v4887.id = 17;
v4887.self = self;
v4887.env = &env;
v4929 = each__StringView__8(mrb, v4874, ((gproc)&v4887), gctab);
if (gctab->ret_status) {
prevgctab->ret_status = gctab->ret_status;
return v4929;
}
return v4929;
}
static mrb_int find2__Object__7(mrb_state *mrb, mrb_value v10412, struct cls2_25 * v10413, struct gctab *prevgctab) {
struct env31 env;
struct REnv *venv = NULL;
mrb_value self;
mrb_value mutexself;
struct cls2_25 * v10418;
struct proc32 v10426;
mrb_int v10468;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L575:;
mutexself = v10412;
self = v10412;
v10418 = v10413;
/* START END */
v10426.id = 32;
v10426.self = self;
v10426.env = &env;
v10468 = each__StringView__14(mrb, v10413, ((gproc)&v10426), gctab);
if (gctab->ret_status) {
prevgctab->ret_status = gctab->ret_status;
return v10468;
}
return v10468;
}
static mrb_int find3__Object__7(mrb_state *mrb, mrb_value v10832, struct cls2_25 * v10833, struct gctab *prevgctab) {
struct env34 env;
struct REnv *venv = NULL;
mrb_value self;
mrb_value mutexself;
struct cls2_25 * v10838;
struct proc35 v10846;
mrb_int v10888;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L600:;
mutexself = v10832;
self = v10832;
v10838 = v10833;
/* START END */
v10846.id = 35;
v10846.self = self;
v10846.env = &env;
v10888 = each__StringView__17(mrb, v10833, ((gproc)&v10846), gctab);
if (gctab->ret_status) {
prevgctab->ret_status = gctab->ret_status;
return v10888;
}
return v10888;
}
static mrb_value fff__StringView__20(mrb_state *mrb, struct cls2_25 * v12075, struct gctab *prevgctab) {
struct env38 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
mrb_value v12087;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L668:;
mutexself = v12075;
self = v12075;
/* START END */
v12087 = ttt_uaux__StringView__20(mrb, self, gctab);
return v12087;
}
static mrb_int initialize__StringView__3(mrb_state *mrb, struct cls2_25 * v2108, uint8_t *v2109, mrb_int v2110, struct gctab *prevgctab) {
struct env8 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
uint8_t *v2114;
mrb_int v2115;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L117:;
mutexself = v2108;
self = v2108;
v2114 = v2109;
v2115 = v2110;
/* START END */
self->v1303 = v2109; /* [:uint8_t, "*", 0] -> [:uint8_t, "*", 0] */
self->v1304 = 1024; /* mrb_int -> mrb_int */
self->v1306 = 0; /* mrb_int -> mrb_int */
self->v1308 = 0; /* mrb_int -> mrb_int */
return 0;
}
static mrb_value _b_B_e__StringView__6(mrb_state *mrb, struct cls2_25 * v3289, mrb_int v3290, uint8_t v3291, struct gctab *prevgctab) {
struct env11 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
uint8_t *iv_1303;/* @strage */
mrb_int iv_1306;/* @st */
mrb_int iv_1308;/* @ed */
mrb_int v3298;
uint8_t v3299;
uint8_t *v3309;
mrb_int v3310;
uint8_t v3314;/*snd*/
uint8_t v3316;
mrb_int v3317;
mrb_int v3318;/*snd*/
mrb_bool v3320;/*snd1*/
mrb_value v3346;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L182:;
mutexself = v3289;
self = v3289;
iv_1303 = mutexself->v1303;
iv_1306 = mutexself->v1306;
iv_1308 = mutexself->v1308;
v3298 = v3290;
v3299 = v3291;
/* START END */
v3309 = self->v1303;
v3310 = self->v1306;
v3314 = v3291;
v3309[(((v3310 + v3290) < 0) ? 1 - (v3310 + v3290) : (v3310 + v3290))] = v3314;
v3316 = v3314;
v3317 = self->v1308;
v3318 = v3290;
v3320 = (v3317 < v3318);
if (v3320) goto L183; else goto L184;
L183:;
self->v1308 = v3290; /* mrb_int -> mrb_int */
v3346 = (mrb_fixnum_value(v3290)); /* 1*/
L185:;
return v3346;
L184:;
v3346 = mrb_nil_value(); /* 2*/
goto L185;
}
static mrb_int ed_e__StringView__5(mrb_state *mrb, struct cls2_25 * v4514, mrb_int v4515, struct gctab *prevgctab) {
struct env14 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
mrb_int v4519;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L250:;
mutexself = v4514;
self = v4514;
v4519 = v4515;
/* START END */
self->v1308 = v4515; /* mrb_int -> mrb_int */
return v4515;
}
static mrb_int each__StringView__8(mrb_state *mrb, struct cls2_25 * v6091, gproc v6092, struct gctab *prevgctab) {
struct env20 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
gproc v6106;
uint8_t *v6129;
mrb_int v6130;
struct cls2_25 * v6132;
gproc v6158;
struct cls2_25 * v6159;
mrb_bool v6181;
v16uc v6214;
char *v6218;
mrb_int v6221;
mrb_int v6257;
mrb_int v6258;
mrb_int v6266;
mrb_bool v6268;/*snd1*/
v16uc v6242;
mrb_int v6248;/*snd1*/
int ai = mrb_gc_arena_save(mrb);
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L340:;
mutexself = v6091;
self = v6091;
v6106 = v6092;
/* START END */
v6129 = self->v1303;
v6130 = self->v1304;
v6132 = alloca(sizeof(struct cls2_25));
v6132->v1303 = NULL;
initialize__StringView__9(mrb, v6132, v6129, v6130, gctab);
v6158 = v6092; /* 1*/
v6159 = v6132; /* 1*/
L342:;
v6181 = 1;
L344:;
v6214 = (v16uc){97, 97, 97, };
v6218 = "aaa";
v6221 = 3;
v6257 = v6221; /* 1*/
v6258 = 0; /* 1*/
L346:;
v6266 = self->v1308;
v6268 = (v6258 < v6266);
if (v6268) goto L345; else goto L347;
L345:;
v6242 = to_usimd__StringView__5(mrb, self, v6258, gctab);
v6248 = ((v6258 + 16) - v6257);
v6257 = v6257; /* 2*/
v6258 = v6248; /* 2*/
goto L346;
L347:;
mrb_gc_arena_restore(mrb, ai);
return 0;
mrb_gc_arena_restore(mrb, ai);
}
static mrb_int each__StringView__14(mrb_state *mrb, struct cls2_25 * v6091, gproc v6092, struct gctab *prevgctab) {
struct env20 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
gproc v6106;
uint8_t *v6129;
mrb_int v6130;
struct cls2_25 * v6132;
gproc v6158;
struct cls2_25 * v6159;
mrb_bool v6181;
v16uc v6214;
char *v6218;
mrb_int v6221;
mrb_int v6257;
mrb_int v6258;
mrb_int v6266;
mrb_bool v6268;/*snd1*/
v16uc v6242;
mrb_int v6248;/*snd1*/
int ai = mrb_gc_arena_save(mrb);
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L340:;
mutexself = v6091;
self = v6091;
v6106 = v6092;
/* START END */
v6129 = self->v1303;
v6130 = self->v1304;
v6132 = alloca(sizeof(struct cls2_25));
v6132->v1303 = NULL;
initialize__StringView__9(mrb, v6132, v6129, v6130, gctab);
v6158 = v6092; /* 1*/
v6159 = v6132; /* 1*/
L342:;
v6181 = 1;
L344:;
v6214 = (v16uc){98, 98, 98, };
v6218 = "bbb";
v6221 = 3;
v6257 = v6221; /* 1*/
v6258 = 0; /* 1*/
L346:;
v6266 = self->v1308;
v6268 = (v6258 < v6266);
if (v6268) goto L345; else goto L347;
L345:;
v6242 = to_usimd__StringView__5(mrb, self, v6258, gctab);
v6248 = ((v6258 + 16) - v6257);
v6257 = v6257; /* 2*/
v6258 = v6248; /* 2*/
goto L346;
L347:;
mrb_gc_arena_restore(mrb, ai);
return 0;
mrb_gc_arena_restore(mrb, ai);
}
static mrb_int each__StringView__17(mrb_state *mrb, struct cls2_25 * v6091, gproc v6092, struct gctab *prevgctab) {
struct env20 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
gproc v6106;
uint8_t *v6129;
mrb_int v6130;
struct cls2_25 * v6132;
gproc v6158;
struct cls2_25 * v6159;
mrb_bool v6181;
v16uc v6214;
char *v6218;
mrb_int v6221;
mrb_int v6257;
mrb_int v6258;
mrb_int v6266;
mrb_bool v6268;/*snd1*/
v16uc v6242;
mrb_int v6248;/*snd1*/
int ai = mrb_gc_arena_save(mrb);
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L340:;
mutexself = v6091;
self = v6091;
v6106 = v6092;
/* START END */
v6129 = self->v1303;
v6130 = self->v1304;
v6132 = alloca(sizeof(struct cls2_25));
v6132->v1303 = NULL;
initialize__StringView__9(mrb, v6132, v6129, v6130, gctab);
v6158 = v6092; /* 1*/
v6159 = v6132; /* 1*/
L342:;
v6181 = 1;
L344:;
v6214 = (v16uc){99, 99, 99, };
v6218 = "ccc";
v6221 = 3;
v6257 = v6221; /* 1*/
v6258 = 0; /* 1*/
L346:;
v6266 = self->v1308;
v6268 = (v6258 < v6266);
if (v6268) goto L345; else goto L347;
L345:;
v6242 = to_usimd__StringView__5(mrb, self, v6258, gctab);
v6248 = ((v6258 + 16) - v6257);
v6257 = v6257; /* 2*/
v6258 = v6248; /* 2*/
goto L346;
L347:;
mrb_gc_arena_restore(mrb, ai);
return 0;
mrb_gc_arena_restore(mrb, ai);
}
static mrb_value ttt_uaux__StringView__20(mrb_state *mrb, struct cls2_25 * v13249, struct gctab *prevgctab) {
struct env41 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
struct proc42 v13260;
mrb_value v13363;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L733:;
mutexself = v13249;
self = v13249;
/* START END */
v13260.id = 42;
v13260.self = self;
v13260.env = &env;
v13363 = each__StringView__21(mrb, self, ((gproc)&v13260), gctab);
if (gctab->ret_status) {
prevgctab->ret_status = gctab->ret_status;
return v13363;
}
return v13363;
}
static mrb_int initialize__StringView__9(mrb_state *mrb, struct cls2_25 * v2108, uint8_t *v2109, mrb_int v2110, struct gctab *prevgctab) {
struct env8 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
uint8_t *v2114;
mrb_int v2115;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L117:;
mutexself = v2108;
self = v2108;
v2114 = v2109;
v2115 = v2110;
/* START END */
self->v1303 = v2109; /* [:uint8_t, "*", 0] -> [:uint8_t, "*", 0] */
self->v1304 = 1024; /* mrb_int -> mrb_int */
self->v1306 = 0; /* mrb_int -> mrb_int */
self->v1308 = 0; /* mrb_int -> mrb_int */
return 0;
}
static v16uc to_usimd__StringView__5(mrb_state *mrb, struct cls2_25 * v10035, mrb_int v10036, struct gctab *prevgctab) {
struct env29 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
uint8_t *iv_1303;/* @strage */
mrb_int iv_1306;/* @st */
mrb_int v10043;
uint8_t *v10052;
mrb_int v10053;
mrb_int v10054;/*snd*/
mrb_int v10056;/*snd1*/
v16uc v10058;
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab));
gctab->prev = prevgctab;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L553:;
mutexself = v10035;
self = v10035;
iv_1303 = mutexself->v1303;
iv_1306 = mutexself->v1306;
v10043 = v10036;
/* START END */
v10052 = self->v1303;
v10053 = self->v1306;
v10054 = v10036;
v10056 = (v10053 + v10054);
v10058 = (*(v16uc *)(v10052 + v10056));
return v10058;
}
static mrb_value each__StringView__21(mrb_state *mrb, struct cls2_25 * v6091, gproc v6092, struct gctab *prevgctab) {
struct env20 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
gproc v6106;
uint8_t *v6129;
mrb_int v6130;
struct cls2_25 * v6132;
gproc v6158;
struct cls2_25 * v6159;
mrb_bool v6181;
mrb_bool v6320;
char *v6352 = "for select";
char *v6354;
int ai = mrb_gc_arena_save(mrb);
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab) + 1 * sizeof(mrb_value *));
gctab->prev = prevgctab;
gctab->complex = NULL;
gctab->object = NULL;
gctab->size = 0;
gctab->csize = 0;
gctab->osize = 0;
gctab->ret_status = 0;
L340:;
mutexself = v6091;
self = v6091;
v6106 = v6092;
/* START END */
v6129 = self->v1303;
v6130 = self->v1304;
v6132 = alloca(sizeof(struct cls2_25));
v6132->v1303 = NULL;
initialize__StringView__9(mrb, v6132, v6129, v6130, gctab);
v6158 = v6092; /* 1*/
v6159 = v6132; /* 1*/
L342:;
v6181 = 0;
L343:;
L349:;
v6320 = 1;
L351:;
gctab->size = 0;
mrb->allocf_ud = (void *)gctab;
{
pthread_mutex_t *mut = (((struct mmc_system *)mrb->ud)->io_mutex);
pthread_mutex_lock(mut);
}
mrb->allocf_ud = (void *)gctab;
mrb_p(mrb, (mrb_str_new_cstr(mrb, "for select")));
pthread_mutex_unlock(((struct mmc_system *)mrb->ud)->io_mutex);
v6354 = "for select";
mrb_gc_arena_restore(mrb, ai);
return (mrb_fixnum_value(0));
mrb_gc_arena_restore(mrb, ai);
}
/*
Class Object
Instance variables
methodes
main (Literal Object, NilClass e=false l=0 var=0) -> Literal NilClass
-- effects ---
find1 (Literal Object, StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, NilClass e=false l=0 var=0) -> Fixnum e=false pos =false
-- effects ---
find2 (Literal Object, StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, NilClass e=false l=0 var=0) -> Fixnum e=false pos =false
-- effects ---
find3 (Literal Object, StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, NilClass e=false l=0 var=0) -> Fixnum e=false pos =false
-- effects ---
Class String
Instance variables
methodes
to_stringbuf (Literal String, NilClass e=false l=0 var=0) -> StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>
-- effects ---
Class StringView
Instance variables
@strage: Array<[:undef] => CodeGenC::BYTE e=false pos =true> e=false l=4 th={Thread Proc<irep=-22b2d350 <#<Irep:0x7fffdd477e30> pos=../mruby-meta-circular/sample/stringbuf.rb:162>> e=false=>:iv_read}
@capa: Literal Fixnum
@st: Literal Fixnum
@ed: Fixnum e=false pos =true
methodes
initialize (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, Array<[:undef] => CodeGenC::BYTE e=false pos =true> e=false l=4 th={Thread Proc<irep=-22b2d350 <#<Irep:0x7fffdd477e30> pos=../mruby-meta-circular/sample/stringbuf.rb:162>> e=false=>:iv_read}, Literal Fixnum, NilClass e=false l=0 var=0) -> Literal Fixnum
initialize (StringView e=false l=5 var=0 home=#<RiteSSA::Inst:0x7fffddfe9ea0>, Array<[:undef] => CodeGenC::BYTE e=false pos =true> e=false l=4 th={Thread Proc<irep=-22b2d350 <#<Irep:0x7fffdd477e30> pos=../mruby-meta-circular/sample/stringbuf.rb:162>> e=false=>:iv_read}, Literal Fixnum, NilClass e=false l=0 var=0) -> Literal Fixnum
-- effects ---
iv_write @strage SETIV 1 1
iv_write @capa SETIV 1 1
iv_write @st SETIV 1 1
iv_write @ed SETIV 1 1
iv_write @strage SETIV 1 1
iv_write @capa SETIV 1 1
iv_write @st SETIV 1 1
iv_write @ed SETIV 1 1
iv_write @strage SETIV 1 1
iv_write @capa SETIV 1 1
iv_write @st SETIV 1 1
iv_write @ed SETIV 1 1
iv_write @strage SETIV 1 1
iv_write @capa SETIV 1 1
iv_write @st SETIV 1 1
iv_write @ed SETIV 1 1
[]= (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, Literal Fixnum, CodeGenC::BYTE e=false pos =true, NilClass e=false l=0 var=0) -> Literal NilClass
[]= (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, Fixnum e=false pos =true, CodeGenC::BYTE e=false pos =true, NilClass e=false l=0 var=0) -> Fixnum e=false pos =true|Literal NilClass
-- effects ---
iv_read @strage GETIV 1 1
iv_read @st GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @st GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @st GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @st GETIV 1 1
iv_read @ed GETIV 1 1
iv_write @ed SETIV 1 1
iv_write @ed SETIV 1 1
ed= (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, Fixnum e=false pos =true, NilClass e=false l=0 var=0) -> Fixnum e=false pos =true
-- effects ---
iv_write @ed SETIV 1 1
iv_write @ed SETIV 1 1
each (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, Proc<irep=-22b30650 <#<Irep:0x7fffddddb7b0> pos=../mruby-meta-circular/sample/stringbuf.rb:123>>) -> Fixnum e=false pos =false
each (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, Proc<irep=-22b30330 <#<Irep:0x7fffde82ada0> pos=../mruby-meta-circular/sample/stringbuf.rb:132>>) -> Fixnum e=false pos =false
each (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, Proc<irep=-22b2d860 <#<Irep:0x7fffde9edc90> pos=../mruby-meta-circular/sample/stringbuf.rb:141>>) -> Fixnum e=false pos =false
each (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, Proc<irep=-22b2d280 <#<Irep:0x7fffdeefb110> pos=../mruby-meta-circular/sample/stringbuf.rb:85>>) -> Literal NilClass|Literal Fixnum
-- effects ---
iv_read @strage GETIV 1 1
iv_read @capa GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @capa GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @capa GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @capa GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @capa GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @capa GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @ed GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @capa GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @capa GETIV 1 1
start_with (StringView e=false l=5 var=0 home=#<RiteSSA::Inst:0x7fffddfe9ea0>, Literal String, NilClass e=false l=0 var=0) -> Literal TrueClass|Literal FalseClass
-- effects ---
iv_read @strage GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @strage GETIV 1 1
st (StringView e=false l=5 var=0 home=#<RiteSSA::Inst:0x7fffddfe9ea0>, NilClass e=false l=0 var=0) -> Literal Fixnum
-- effects ---
iv_read @st GETIV 1 1
iv_read @st GETIV 1 1
to_simd (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, Literal Fixnum, NilClass e=false l=0 var=0) -> MMC_EXT::Vector e=false l=0 var=0
to_simd (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, Fixnum e=false pos =true, NilClass e=false l=0 var=0) -> MMC_EXT::Vector e=false l=0 var=0
-- effects ---
iv_read @strage GETIV 1 1
iv_read @st GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @st GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @st GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @st GETIV 1 1
fff (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, NilClass e=false l=0 var=0) -> Literal NilClass|Literal Fixnum
-- effects ---
ttt_aux (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x7fffdd659ea0>, NilClass e=false l=0 var=0) -> Literal NilClass|Literal Fixnum
-- effects ---
[] (StringView e=false l=5 var=0 home=#<RiteSSA::Inst:0x7fffddfe9ea0>, Literal Fixnum, NilClass e=false l=0 var=0) -> CodeGenC::BYTE e=false pos =true
-- effects ---
iv_read @strage GETIV 1 1
iv_read @st GETIV 1 1
iv_read @strage GETIV 1 1
iv_read @st GETIV 1 1
Class #<Class:MMC_EXT>
Instance variables
methodes
Class #<Class:MMC_EXT::SIMD>
Instance variables
methodes
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment