Skip to content

Instantly share code, notes, and snippets.

@miura1729
Created February 23, 2026 07:28
Show Gist options
  • Select an option

  • Save miura1729/2257f30a4775b31245a57bc2e8aa1c69 to your computer and use it in GitHub Desktop.

Select an option

Save miura1729/2257f30a4775b31245a57bc2e8aa1c69 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 char v16qi __attribute__ ((vector_size (16)));
typedef unsigned char v16uqi __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 *v1457; /* @strage */
mrb_int v1458; /* @capa */
mrb_int v1460; /* @st */
mrb_int v1462; /* @ed */
};
static mrb_value main_Object_0(mrb_state *, mrb_value v9,struct gctab *);
static mrb_value main__Object__1(mrb_state *, mrb_value v399,struct gctab *);
mrb_value const0;
mrb_value const1;
static struct cls2_25 * to_ustringbuf__String__2(mrb_state *, char *v947,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 v5897, struct cls2_25 * v5898,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 v12855, struct cls2_25 * v12856,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 v13326, struct cls2_25 * v13327,struct gctab *);
static mrb_value fff__StringView__20(mrb_state *, struct cls2_25 * v14866,struct gctab *);
static mrb_int initialize__StringView__3(mrb_state *, struct cls2_25 * v2505, uint8_t *v2506, mrb_int v2507,struct gctab *);
static mrb_value _b_B_e__StringView__6(mrb_state *, struct cls2_25 * v3976, mrb_int v3977, uint8_t v3978,struct gctab *);
static mrb_int ed_e__StringView__5(mrb_state *, struct cls2_25 * v5494, mrb_int v5495,struct gctab *);
mrb_value const2;
mrb_value const3;
mrb_value const4;
static mrb_int each__StringView__8(mrb_state *, struct cls2_25 * v7409, gproc v7410,struct gctab *);
static mrb_int each__StringView__14(mrb_state *, struct cls2_25 * v7409, gproc v7410,struct gctab *);
static mrb_int each__StringView__17(mrb_state *, struct cls2_25 * v7409, gproc v7410,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 * v16330,struct gctab *);
static mrb_int initialize__StringView__9(mrb_state *, struct cls2_25 * v2505, uint8_t *v2506, mrb_int v2507,struct gctab *);
static v16qi to_usimd__StringView__5(mrb_state *, struct cls2_25 * v12430, mrb_int v12431,struct gctab *);
mrb_value const5;
static mrb_value each__StringView__21(mrb_state *, struct cls2_25 * v7409, gproc v7410,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 v17;
struct gctab *gctab = prevgctab;
L0:;
mutexself = v9;
self = v9;
/* START END */
v17 = main__Object__1(mrb, self, gctab);
return v17;
}
static mrb_value main__Object__1(mrb_state *mrb, mrb_value v399, struct gctab *prevgctab) {
struct env2 env;
struct REnv *venv = NULL;
mrb_value self;
mrb_value mutexself;
char *v418 = "sadfsdmmmase@pmapeeqwaaaabbbcccpetaaa";
struct cls2_25 * v420;
mrb_int v426;
mrb_int v428;
mrb_int v433;
mrb_int v435;
mrb_int v440;
mrb_int v442;
mrb_value v445;
mrb_value v448;
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 = v399;
self = v399;
/* START END */
gctab->caller_alloc = alloca((sizeof(uint8_t) * (1024 + 1)) + (sizeof(struct cls2_25 )) + (sizeof(uint8_t) * (1024 + 1)) + (sizeof(struct cls2_25 )));
v420 = to_ustringbuf__String__2(mrb, "sadfsdmmmase@pmapeeqwaaaabbbcccpetaaa", gctab);
v426 = find1__Object__7(mrb, self, v420, 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_fixnum_value(v426)));
pthread_mutex_unlock(((struct mmc_system *)mrb->ud)->io_mutex);
v428 = v426;
v433 = find2__Object__7(mrb, self, v420, 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_fixnum_value(v433)));
pthread_mutex_unlock(((struct mmc_system *)mrb->ud)->io_mutex);
v435 = v433;
v440 = find3__Object__7(mrb, self, v420, 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_fixnum_value(v440)));
pthread_mutex_unlock(((struct mmc_system *)mrb->ud)->io_mutex);
v442 = v440;
v445 = fff__StringView__20(mrb, v420, gctab);
v448 = fff__StringView__20(mrb, v420, gctab);
return mrb_nil_value();
}
static struct cls2_25 * to_ustringbuf__String__2(mrb_state *mrb, char *v947, struct gctab *prevgctab) {
struct env5 env;
struct REnv *venv = NULL;
char *self;
char *mutexself;
uint8_t *v978;
struct cls2_25 * v981;
mrb_int v986;
struct cls2_25 * v1015;
mrb_int v1016;
mrb_int v1017;
mrb_bool v1027;/*snd1*/
uint8_t v1003;
mrb_value v1008;
mrb_int v1010;/*snd1*/
mrb_int v1044;
struct gctab *gctab = prevgctab;
L49:;
mutexself = v947;
self = "sadfsdmmmase@pmapeeqwaaaabbbcccpetaaa";
/* START END */
v978 = prevgctab->caller_alloc;
prevgctab->caller_alloc += sizeof(uint8_t) * 1025;
v981 = prevgctab->caller_alloc;
prevgctab->caller_alloc += sizeof(struct cls2_25);
v981->v1457 = NULL;
initialize__StringView__3(mrb, v981, v978, 1024, gctab);
v986 = 37;
v1015 = v981; /* 1*/
v1016 = 0; /* 1*/
v1017 = v986; /* 1*/
L51:;
v1027 = (v1016 < v1017);
if (v1027) goto L50; else goto L52;
L50:;
{
pthread_mutex_t *mut = (((struct mmc_system *)mrb->ud)->io_mutex);
pthread_mutex_lock(mut);
}
v1003 = self[v1016];
pthread_mutex_unlock(((struct mmc_system *)mrb->ud)->io_mutex);
v1008 = _b_B_e__StringView__6(mrb, v1015, v1016, v1003, gctab);
v1010 = (v1016 + 1);
v1015 = v1015; /* 2*/
v1016 = v1010; /* 2*/
v1017 = v1017; /* 2*/
goto L51;
L52:;
v1044 = ed_e__StringView__5(mrb, v1015, v1016, gctab);
return v1015;
}
static mrb_int find1__Object__7(mrb_state *mrb, mrb_value v5897, struct cls2_25 * v5898, struct gctab *prevgctab) {
struct env16 env;
struct REnv *venv = NULL;
mrb_value self;
mrb_value mutexself;
struct cls2_25 * v5904;
struct proc17 v5913;
mrb_int v5959;
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;
L284:;
mutexself = v5897;
self = v5897;
v5904 = v5898;
/* START END */
v5913.id = 17;
v5913.self = self;
v5913.env = &env;
v5959 = each__StringView__8(mrb, v5898, ((gproc)&v5913), gctab);
if (gctab->ret_status) {
prevgctab->ret_status = gctab->ret_status;
return v5959;
}
return v5959;
}
static mrb_int find2__Object__7(mrb_state *mrb, mrb_value v12855, struct cls2_25 * v12856, struct gctab *prevgctab) {
struct env31 env;
struct REnv *venv = NULL;
mrb_value self;
mrb_value mutexself;
struct cls2_25 * v12862;
struct proc32 v12871;
mrb_int v12917;
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;
L607:;
mutexself = v12855;
self = v12855;
v12862 = v12856;
/* START END */
v12871.id = 32;
v12871.self = self;
v12871.env = &env;
v12917 = each__StringView__14(mrb, v12856, ((gproc)&v12871), gctab);
if (gctab->ret_status) {
prevgctab->ret_status = gctab->ret_status;
return v12917;
}
return v12917;
}
static mrb_int find3__Object__7(mrb_state *mrb, mrb_value v13326, struct cls2_25 * v13327, struct gctab *prevgctab) {
struct env34 env;
struct REnv *venv = NULL;
mrb_value self;
mrb_value mutexself;
struct cls2_25 * v13333;
struct proc35 v13342;
mrb_int v13388;
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;
L632:;
mutexself = v13326;
self = v13326;
v13333 = v13327;
/* START END */
v13342.id = 35;
v13342.self = self;
v13342.env = &env;
v13388 = each__StringView__17(mrb, v13327, ((gproc)&v13342), gctab);
if (gctab->ret_status) {
prevgctab->ret_status = gctab->ret_status;
return v13388;
}
return v13388;
}
static mrb_value fff__StringView__20(mrb_state *mrb, struct cls2_25 * v14866, struct gctab *prevgctab) {
struct env38 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
mrb_value v14880;
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;
L704:;
mutexself = v14866;
self = v14866;
/* START END */
v14880 = ttt_uaux__StringView__20(mrb, self, gctab);
return v14880;
}
static mrb_int initialize__StringView__3(mrb_state *mrb, struct cls2_25 * v2505, uint8_t *v2506, mrb_int v2507, struct gctab *prevgctab) {
struct env8 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
uint8_t *v2512;
mrb_int v2513;
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;
L121:;
mutexself = v2505;
self = v2505;
v2512 = v2506;
v2513 = v2507;
/* START END */
self->v1457 = v2506; /* [:uint8_t, "*", 0] -> [:uint8_t, "*", 0] */
self->v1458 = 1024; /* mrb_int -> mrb_int */
self->v1460 = 0; /* mrb_int -> mrb_int */
self->v1462 = 0; /* mrb_int -> mrb_int */
return 0;
}
static mrb_value _b_B_e__StringView__6(mrb_state *mrb, struct cls2_25 * v3976, mrb_int v3977, uint8_t v3978, struct gctab *prevgctab) {
struct env11 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
uint8_t *iv_1457;/* @strage */
mrb_int iv_1460;/* @st */
mrb_int iv_1462;/* @ed */
mrb_int v3986;
uint8_t v3987;
uint8_t *v3998;
mrb_int v3999;
uint8_t v4003;/*snd*/
uint8_t v4005;
mrb_int v4006;
mrb_int v4007;/*snd*/
mrb_bool v4009;/*snd1*/
mrb_value v4037;
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;
L190:;
mutexself = v3976;
self = v3976;
iv_1457 = mutexself->v1457;
iv_1460 = mutexself->v1460;
iv_1462 = mutexself->v1462;
v3986 = v3977;
v3987 = v3978;
/* START END */
v3998 = self->v1457;
v3999 = self->v1460;
v4003 = v3978;
v3998[(((v3999 + v3977) < 0) ? 1 - (v3999 + v3977) : (v3999 + v3977))] = v4003;
v4005 = v4003;
v4006 = self->v1462;
v4007 = v3977;
v4009 = (v4006 < v4007);
if (v4009) goto L191; else goto L192;
L191:;
self->v1462 = v3977; /* mrb_int -> mrb_int */
v4037 = (mrb_fixnum_value(v3977)); /* 1*/
L193:;
return v4037;
L192:;
v4037 = mrb_nil_value(); /* 2*/
goto L193;
}
static mrb_int ed_e__StringView__5(mrb_state *mrb, struct cls2_25 * v5494, mrb_int v5495, struct gctab *prevgctab) {
struct env14 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
mrb_int v5500;
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;
L262:;
mutexself = v5494;
self = v5494;
v5500 = v5495;
/* START END */
self->v1462 = v5495; /* mrb_int -> mrb_int */
return v5495;
}
static mrb_int each__StringView__8(mrb_state *mrb, struct cls2_25 * v7409, gproc v7410, struct gctab *prevgctab) {
struct env20 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
gproc v7429;
uint8_t *v7459;
mrb_int v7460;
struct cls2_25 * v7462;
gproc v7493;
struct cls2_25 * v7494;
mrb_bool v7521;
v16qi v7564;
char *v7568;
mrb_int v7571;
v16qi v7717;
mrb_int v7719;
mrb_int v7720;
mrb_int v7733;
mrb_bool v7735;/*snd1*/
v16qi v7597;
mrb_int v7599;
mrb_int v7602;/*snd1*/
mrb_bool v7606;/*snd1*/
v16qi v7633;
mrb_int v7635;
mrb_int v7636;
v16qi v7637;
mrb_int v7638;
mrb_int v7654;
mrb_int v7659;/*snd1*/
mrb_bool v7661;/*snd1*/
mrb_int v7685;/*snd1*/
mrb_int v7710;/*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;
L356:;
mutexself = v7409;
self = v7409;
v7429 = v7410;
/* START END */
v7459 = self->v1457;
v7460 = self->v1458;
v7462 = alloca(sizeof(struct cls2_25));
v7462->v1457 = NULL;
initialize__StringView__9(mrb, v7462, v7459, v7460, gctab);
v7493 = v7410; /* 1*/
v7494 = v7462; /* 1*/
L358:;
v7521 = 1;
L360:;
v7564 = (v16qi){97, 119, 107, };
v7568 = "awk";
v7571 = 3;
v7717 = v7564; /* 1*/
v7719 = v7571; /* 1*/
v7720 = 0; /* 1*/
L366:;
v7733 = self->v1462;
v7735 = (v7720 < v7733);
if (v7735) goto L361; else goto L367;
L361:;
v7597 = to_usimd__StringView__5(mrb, self, v7720, gctab);
v7599 = self->v1462;
v7602 = (v7599 - v7720);
v7606 = (v7602 > 16);
v7633 = v7717; /* 1*/
v7635 = v7719; /* 1*/
v7636 = v7720; /* 1*/
v7637 = v7597; /* 1*/
v7638 = v7602; /* 1*/
if (v7606) goto L362; else goto L363;
L362:;
v7633 = v7717; /* 2*/
v7635 = v7719; /* 2*/
v7636 = v7720; /* 2*/
v7637 = v7597; /* 2*/
v7638 = 16; /* 2*/
L363:;
v7654 = __builtin_ia32_pcmpestri128(v7633, v7635, v7637, v7638, 12);
v7659 = (v7638 - v7635);
v7661 = (v7654 < v7659);
if (v7661) goto L364; else goto L365;
L364:;
v7685 = (v7636 + v7654);
mrb_gc_arena_restore(mrb, ai);
return v7685;
L365:;
v7710 = ((v7636 + 16) - v7635);
v7717 = v7633; /* 2*/
v7719 = v7635; /* 2*/
v7720 = v7710; /* 2*/
goto L366;
L367:;
mrb_gc_arena_restore(mrb, ai);
return -1;
mrb_gc_arena_restore(mrb, ai);
}
static mrb_int each__StringView__14(mrb_state *mrb, struct cls2_25 * v7409, gproc v7410, struct gctab *prevgctab) {
struct env20 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
gproc v7429;
uint8_t *v7459;
mrb_int v7460;
struct cls2_25 * v7462;
gproc v7493;
struct cls2_25 * v7494;
mrb_bool v7521;
v16qi v7564;
char *v7568;
mrb_int v7571;
v16qi v7717;
mrb_int v7719;
mrb_int v7720;
mrb_int v7733;
mrb_bool v7735;/*snd1*/
v16qi v7597;
mrb_int v7599;
mrb_int v7602;/*snd1*/
mrb_bool v7606;/*snd1*/
v16qi v7633;
mrb_int v7635;
mrb_int v7636;
v16qi v7637;
mrb_int v7638;
mrb_int v7654;
mrb_int v7659;/*snd1*/
mrb_bool v7661;/*snd1*/
mrb_int v7685;/*snd1*/
mrb_int v7710;/*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;
L356:;
mutexself = v7409;
self = v7409;
v7429 = v7410;
/* START END */
v7459 = self->v1457;
v7460 = self->v1458;
v7462 = alloca(sizeof(struct cls2_25));
v7462->v1457 = NULL;
initialize__StringView__9(mrb, v7462, v7459, v7460, gctab);
v7493 = v7410; /* 1*/
v7494 = v7462; /* 1*/
L358:;
v7521 = 1;
L360:;
v7564 = (v16qi){109, 97, 112, };
v7568 = "map";
v7571 = 3;
v7717 = v7564; /* 1*/
v7719 = v7571; /* 1*/
v7720 = 0; /* 1*/
L366:;
v7733 = self->v1462;
v7735 = (v7720 < v7733);
if (v7735) goto L361; else goto L367;
L361:;
v7597 = to_usimd__StringView__5(mrb, self, v7720, gctab);
v7599 = self->v1462;
v7602 = (v7599 - v7720);
v7606 = (v7602 > 16);
v7633 = v7717; /* 1*/
v7635 = v7719; /* 1*/
v7636 = v7720; /* 1*/
v7637 = v7597; /* 1*/
v7638 = v7602; /* 1*/
if (v7606) goto L362; else goto L363;
L362:;
v7633 = v7717; /* 2*/
v7635 = v7719; /* 2*/
v7636 = v7720; /* 2*/
v7637 = v7597; /* 2*/
v7638 = 16; /* 2*/
L363:;
v7654 = __builtin_ia32_pcmpestri128(v7633, v7635, v7637, v7638, 12);
v7659 = (v7638 - v7635);
v7661 = (v7654 < v7659);
if (v7661) goto L364; else goto L365;
L364:;
v7685 = (v7636 + v7654);
mrb_gc_arena_restore(mrb, ai);
return v7685;
L365:;
v7710 = ((v7636 + 16) - v7635);
v7717 = v7633; /* 2*/
v7719 = v7635; /* 2*/
v7720 = v7710; /* 2*/
goto L366;
L367:;
mrb_gc_arena_restore(mrb, ai);
return -1;
mrb_gc_arena_restore(mrb, ai);
}
static mrb_int each__StringView__17(mrb_state *mrb, struct cls2_25 * v7409, gproc v7410, struct gctab *prevgctab) {
struct env20 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
gproc v7429;
uint8_t *v7459;
mrb_int v7460;
struct cls2_25 * v7462;
gproc v7493;
struct cls2_25 * v7494;
mrb_bool v7521;
v16qi v7564;
char *v7568;
mrb_int v7571;
v16qi v7717;
mrb_int v7719;
mrb_int v7720;
mrb_int v7733;
mrb_bool v7735;/*snd1*/
v16qi v7597;
mrb_int v7599;
mrb_int v7602;/*snd1*/
mrb_bool v7606;/*snd1*/
v16qi v7633;
mrb_int v7635;
mrb_int v7636;
v16qi v7637;
mrb_int v7638;
mrb_int v7654;
mrb_int v7659;/*snd1*/
mrb_bool v7661;/*snd1*/
mrb_int v7685;/*snd1*/
mrb_int v7710;/*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;
L356:;
mutexself = v7409;
self = v7409;
v7429 = v7410;
/* START END */
v7459 = self->v1457;
v7460 = self->v1458;
v7462 = alloca(sizeof(struct cls2_25));
v7462->v1457 = NULL;
initialize__StringView__9(mrb, v7462, v7459, v7460, gctab);
v7493 = v7410; /* 1*/
v7494 = v7462; /* 1*/
L358:;
v7521 = 1;
L360:;
v7564 = (v16qi){112, 101, 116, };
v7568 = "pet";
v7571 = 3;
v7717 = v7564; /* 1*/
v7719 = v7571; /* 1*/
v7720 = 0; /* 1*/
L366:;
v7733 = self->v1462;
v7735 = (v7720 < v7733);
if (v7735) goto L361; else goto L367;
L361:;
v7597 = to_usimd__StringView__5(mrb, self, v7720, gctab);
v7599 = self->v1462;
v7602 = (v7599 - v7720);
v7606 = (v7602 > 16);
v7633 = v7717; /* 1*/
v7635 = v7719; /* 1*/
v7636 = v7720; /* 1*/
v7637 = v7597; /* 1*/
v7638 = v7602; /* 1*/
if (v7606) goto L362; else goto L363;
L362:;
v7633 = v7717; /* 2*/
v7635 = v7719; /* 2*/
v7636 = v7720; /* 2*/
v7637 = v7597; /* 2*/
v7638 = 16; /* 2*/
L363:;
v7654 = __builtin_ia32_pcmpestri128(v7633, v7635, v7637, v7638, 12);
v7659 = (v7638 - v7635);
v7661 = (v7654 < v7659);
if (v7661) goto L364; else goto L365;
L364:;
v7685 = (v7636 + v7654);
mrb_gc_arena_restore(mrb, ai);
return v7685;
L365:;
v7710 = ((v7636 + 16) - v7635);
v7717 = v7633; /* 2*/
v7719 = v7635; /* 2*/
v7720 = v7710; /* 2*/
goto L366;
L367:;
mrb_gc_arena_restore(mrb, ai);
return -1;
mrb_gc_arena_restore(mrb, ai);
}
static mrb_value ttt_uaux__StringView__20(mrb_state *mrb, struct cls2_25 * v16330, struct gctab *prevgctab) {
struct env41 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
struct proc42 v16343;
mrb_value v16455;
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;
L773:;
mutexself = v16330;
self = v16330;
/* START END */
v16343.id = 42;
v16343.self = self;
v16343.env = &env;
v16455 = each__StringView__21(mrb, self, ((gproc)&v16343), gctab);
if (gctab->ret_status) {
prevgctab->ret_status = gctab->ret_status;
return v16455;
}
return v16455;
}
static mrb_int initialize__StringView__9(mrb_state *mrb, struct cls2_25 * v2505, uint8_t *v2506, mrb_int v2507, struct gctab *prevgctab) {
struct env8 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
uint8_t *v2512;
mrb_int v2513;
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;
L121:;
mutexself = v2505;
self = v2505;
v2512 = v2506;
v2513 = v2507;
/* START END */
self->v1457 = v2506; /* [:uint8_t, "*", 0] -> [:uint8_t, "*", 0] */
self->v1458 = 1024; /* mrb_int -> mrb_int */
self->v1460 = 0; /* mrb_int -> mrb_int */
self->v1462 = 0; /* mrb_int -> mrb_int */
return 0;
}
static v16qi to_usimd__StringView__5(mrb_state *mrb, struct cls2_25 * v12430, mrb_int v12431, struct gctab *prevgctab) {
struct env29 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
uint8_t *iv_1457;/* @strage */
mrb_int iv_1460;/* @st */
mrb_int v12439;
uint8_t *v12449;
mrb_int v12450;
mrb_int v12451;/*snd*/
mrb_int v12453;/*snd1*/
v16qi v12455;
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;
L585:;
mutexself = v12430;
self = v12430;
iv_1457 = mutexself->v1457;
iv_1460 = mutexself->v1460;
v12439 = v12431;
/* START END */
v12449 = self->v1457;
v12450 = self->v1460;
v12451 = v12431;
v12453 = (v12450 + v12451);
v12455 = (__builtin_ia32_loaddqu((v12449 + v12453)));
return v12455;
}
static mrb_value each__StringView__21(mrb_state *mrb, struct cls2_25 * v7409, gproc v7410, struct gctab *prevgctab) {
struct env20 env;
struct REnv *venv = NULL;
struct cls2_25 * self;
struct cls2_25 * mutexself;
gproc v7429;
uint8_t *v7459;
mrb_int v7460;
struct cls2_25 * v7462;
gproc v7493;
struct cls2_25 * v7494;
mrb_bool v7521;
mrb_bool v7802;
char *v7844 = "for select";
char *v7846;
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;
L356:;
mutexself = v7409;
self = v7409;
v7429 = v7410;
/* START END */
v7459 = self->v1457;
v7460 = self->v1458;
v7462 = alloca(sizeof(struct cls2_25));
v7462->v1457 = NULL;
initialize__StringView__9(mrb, v7462, v7459, v7460, gctab);
v7493 = v7410; /* 1*/
v7494 = v7462; /* 1*/
L358:;
v7521 = 0;
L359:;
L369:;
v7802 = 1;
L371:;
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);
v7846 = "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:0x208814f0>, 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:0x208814f0>, 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:0x208814f0>, 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:0x208814f0>
-- effects ---
Class StringView
Instance variables
@strage: Array<[:undef] => CodeGenC::BYTE e=false pos =true> e=false l=4 th={Thread Proc<irep=207024b0 <#<Irep:0x20672df8> pos=../mruby-meta-circular/sample/stringbuf.rb:171>> 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:0x208814f0>, Array<[:undef] => CodeGenC::BYTE e=false pos =true> e=false l=4 th={Thread Proc<irep=207024b0 <#<Irep:0x20672df8> pos=../mruby-meta-circular/sample/stringbuf.rb:171>> 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:0x21298788>, Array<[:undef] => CodeGenC::BYTE e=false pos =true> e=false l=4 th={Thread Proc<irep=207024b0 <#<Irep:0x20672df8> pos=../mruby-meta-circular/sample/stringbuf.rb:171>> 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:0x208814f0>, 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:0x208814f0>, 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:0x208814f0>, 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:0x208814f0>, Proc<irep=206f68b8 <#<Irep:0x2105b880> pos=../mruby-meta-circular/sample/stringbuf.rb:131>>) -> Fixnum e=false pos =false
each (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x208814f0>, Proc<irep=20706c08 <#<Irep:0x21bdf618> pos=../mruby-meta-circular/sample/stringbuf.rb:140>>) -> Fixnum e=false pos =false
each (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x208814f0>, Proc<irep=20703ba0 <#<Irep:0x21e021c0> pos=../mruby-meta-circular/sample/stringbuf.rb:149>>) -> Fixnum e=false pos =false
each (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x208814f0>, Proc<irep=206fbcb0 <#<Irep:0x22370a10> pos=../mruby-meta-circular/sample/stringbuf.rb:93>>) -> 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 @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 @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 @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 @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 @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 @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:0x21298788>, 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:0x21298788>, 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:0x208814f0>, 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:0x208814f0>, 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:0x208814f0>, NilClass e=false l=0 var=0) -> Literal NilClass|Literal Fixnum
-- effects ---
ttt_aux (StringView e=false l=4 var=0 home=#<RiteSSA::Inst:0x208814f0>, NilClass e=false l=0 var=0) -> Literal NilClass|Literal Fixnum
-- effects ---
[] (StringView e=false l=5 var=0 home=#<RiteSSA::Inst:0x21298788>, 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